diff options
author | Matt Belhorn <belhornmp@ornl.gov> | 2016-08-01 12:05:29 -0400 |
---|---|---|
committer | Matt Belhorn <belhornmp@ornl.gov> | 2016-08-01 12:05:29 -0400 |
commit | aaa5c9e8a473cccbe3b5e7258bc5f9b7ff4d8c6c (patch) | |
tree | 52da7a4e39542273b947b3a2a6fbfe048d7ee443 /lib | |
parent | dc7e0899a05cf4464552f4b3d41005e79571a15a (diff) | |
download | spack-aaa5c9e8a473cccbe3b5e7258bc5f9b7ff4d8c6c.tar.gz spack-aaa5c9e8a473cccbe3b5e7258bc5f9b7ff4d8c6c.tar.bz2 spack-aaa5c9e8a473cccbe3b5e7258bc5f9b7ff4d8c6c.tar.xz spack-aaa5c9e8a473cccbe3b5e7258bc5f9b7ff4d8c6c.zip |
Writes default module list to terminal when debugging.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/platforms/cray.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py index fd58915c57..d43580df06 100644 --- a/lib/spack/spack/platforms/cray.py +++ b/lib/spack/spack/platforms/cray.py @@ -1,6 +1,7 @@ import os import re import spack.config +import llnl.util.tty as tty from spack.util.executable import which from spack.architecture import Platform, Target, NoPlatformError from spack.operating_systems.linux_distro import LinuxDistro @@ -19,7 +20,6 @@ def _target_from_clean_env(name): ''' # Based on the incantation: # echo "$(env - USER=$USER /bin/bash -l -c 'module list -lt')" - default_modules = [] targets = [] if name != 'front_end': env = which('env') @@ -30,16 +30,14 @@ def _target_from_clean_env(name): '/bin/sh', '--noprofile', '-c', 'source /etc/profile; module list -lt', output=str, error=str) + default_modules = [i for i in output.splitlines() + if len(i.split()) == 1] + tty.debug("Found default modules:", + *[" " + mod for mod in default_modules]) pattern = 'craype-(?!{0})(\S*)'.format('|'.join(NON_TARGETS)) - for line in output.splitlines(): - if 'craype-' in line: - targets.extend(re.findall(pattern, line)) - if len(line.split()) == 1: - default_modules.append(line) - # if default_modules: - # print 'Found default modules:' - # for defmod in default_modules: - # print ' ', defmod + for mod in default_modules: + if 'craype-' in mod: + targets.extend(re.findall(pattern, mod)) return targets[0] if targets else None |