diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2016-05-31 03:01:05 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-05-31 03:01:05 -0700 |
commit | 7bdf63a0fa87cce6f9237ffae4a8903311327d54 (patch) | |
tree | 185bd00902aecabba6f3632ee55f23898e7e1ee6 /lib | |
parent | 24ee32d7b0cb209f8a17f6df7e8715fa508d0f5d (diff) | |
download | spack-7bdf63a0fa87cce6f9237ffae4a8903311327d54.tar.gz spack-7bdf63a0fa87cce6f9237ffae4a8903311327d54.tar.bz2 spack-7bdf63a0fa87cce6f9237ffae4a8903311327d54.tar.xz spack-7bdf63a0fa87cce6f9237ffae4a8903311327d54.zip |
Fix some bugs in architecture.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/architecture.py | 14 | ||||
-rw-r--r-- | lib/spack/spack/operating_systems/linux_distro.py | 13 |
2 files changed, 16 insertions, 11 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index a0ef4f14da..88cebc0943 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -487,25 +487,23 @@ def arch_from_dict(d): @memoized def all_platforms(): - modules = [] - + classes = [] mod_path = spack.platform_path - mod_string = "spack.platformss" + parent_module = "spack.platforms" for name in list_modules(mod_path): - mod_name = mod_string + name - path = join_path(mod_path, name) + ".py" - mod = imp.load_source(mod_name, path) + mod_name = '%s.%s' % (parent_module, name) class_name = mod_to_class(name) + mod = __import__(mod_name, fromlist=[class_name]) if not hasattr(mod, class_name): tty.die('No class %s defined in %s' % (class_name, mod_name)) cls = getattr(mod, class_name) if not inspect.isclass(cls): tty.die('%s.%s is not a class' % (mod_name, class_name)) - modules.append(cls) + classes.append(cls) - return modules + return classes @memoized def sys_type(): diff --git a/lib/spack/spack/operating_systems/linux_distro.py b/lib/spack/spack/operating_systems/linux_distro.py index d0f24d842f..2e3c72719b 100644 --- a/lib/spack/spack/operating_systems/linux_distro.py +++ b/lib/spack/spack/operating_systems/linux_distro.py @@ -1,3 +1,4 @@ +import re import platform as py_platform from spack.architecture import OperatingSystem @@ -9,7 +10,13 @@ class LinuxDistro(OperatingSystem): platform.dist() """ def __init__(self): - name = py_platform.dist()[0] - version = py_platform.dist()[1].split(".")[0] # Grabs major version from tuple + distname, version, _ = py_platform.linux_distribution( + full_distribution_name=False) - super(LinuxDistro, self).__init__(name, version) + # Grabs major version from tuple on redhat; on other platforms + # grab the first legal identifier in the version field. On + # debian you get things like 'wheezy/sid'; sid means unstable. + # We just record 'wheezy' and don't get quite so detailed. + version = re.split(r'[^\w-]', version)[0] + + super(LinuxDistro, self).__init__(distname, version) |