summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2015-10-26 18:31:25 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2015-10-26 18:54:04 -0400
commit17a58ee0a95ac6b15cec3731f93262a6378e7d6a (patch)
treef90203a130f6bcfbe6ae4ad2f104b904eaa425d4
parentf76b3890ff32308c4fcaf7cbecb073d945ae411e (diff)
downloadspack-17a58ee0a95ac6b15cec3731f93262a6378e7d6a.tar.gz
spack-17a58ee0a95ac6b15cec3731f93262a6378e7d6a.tar.bz2
spack-17a58ee0a95ac6b15cec3731f93262a6378e7d6a.tar.xz
spack-17a58ee0a95ac6b15cec3731f93262a6378e7d6a.zip
architecture: use uname if available
-rw-r--r--lib/spack/spack/architecture.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index 0c4b605e91..e0d42c2077 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -24,6 +24,7 @@
##############################################################################
import os
import platform as py_platform
+import subprocess
from llnl.util.lang import memoized
@@ -69,12 +70,24 @@ def get_mac_sys_type():
Version(mac_ver).up_to(2), py_platform.machine())
+def get_sys_type_from_uname():
+ """Return the architecture from uname."""
+ try:
+ arch_proc = subprocess.Popen(['uname', '-i'],
+ stdout=subprocess.PIPE)
+ arch, _ = arch_proc.communicate()
+ return arch.strip()
+ except:
+ return None
+
+
@memoized
def sys_type():
"""Returns a SysType for the current machine."""
methods = [get_sys_type_from_spack_globals,
get_sys_type_from_environment,
- get_mac_sys_type]
+ get_mac_sys_type,
+ get_sys_type_from_uname]
# search for a method that doesn't return None
sys_type = None