summaryrefslogtreecommitdiff
path: root/morphlib/util.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-08-16 10:55:05 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-08-16 10:55:05 +0000
commit0a5ef89e107c22a5d1931838526fe3b22af42b95 (patch)
treea718c4093c41d50407893b6b485a2396c4eaf183 /morphlib/util.py
parent087fa4c8ea29d722e1cf5ab3a5509fc9c482796b (diff)
parente808380a723383f18cf5643b9b813e9f86520e9c (diff)
downloadmorph-0a5ef89e107c22a5d1931838526fe3b22af42b95.tar.gz
Merge branch 'liw/refactor-edit-v2'
Reviewed-by: Richard Maw Reviewed-by: Daniel Silverstone
Diffstat (limited to 'morphlib/util.py')
-rw-r--r--morphlib/util.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/morphlib/util.py b/morphlib/util.py
index b83211e3..7526c93c 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -359,3 +359,25 @@ def parse_environment_pairs(env, pairs):
# 3 unnecessary lists, but I felt this was the most
# easy to read. Using itertools.chain may be more efficicent
return dict(env.items() + extra_env.items())
+
+
+
+def get_host_architecture(): # pragma: no cover
+ '''Get the canonical Morph name for the host's architecture.'''
+
+ machine = os.uname()[-1]
+
+ table = {
+ 'x86_64': 'x86_64',
+ 'i386': 'x86_32',
+ 'i486': 'x86_32',
+ 'i586': 'x86_32',
+ 'i686': 'x86_32',
+ 'armv7l': 'armv7l',
+ 'armv7b': 'armv7b',
+ }
+
+ if machine not in table:
+ raise morphlib.Error('Unknown host architecture %s' % machine)
+
+ return table[machine]