diff options
author | Gregory Becker <becker33@llnl.gov> | 2016-01-12 16:25:54 -0800 |
---|---|---|
committer | Gregory Becker <becker33@llnl.gov> | 2016-01-12 16:25:54 -0800 |
commit | 5e3c883f2cb61b91dfb9bab3b436b07dd18f4a93 (patch) | |
tree | 65a38472cfbe0ed756dd3ccda961f79063da549b | |
parent | 528f9cd5830f6c825f6d309d369268b0211923ba (diff) | |
download | spack-5e3c883f2cb61b91dfb9bab3b436b07dd18f4a93.tar.gz spack-5e3c883f2cb61b91dfb9bab3b436b07dd18f4a93.tar.bz2 spack-5e3c883f2cb61b91dfb9bab3b436b07dd18f4a93.tar.xz spack-5e3c883f2cb61b91dfb9bab3b436b07dd18f4a93.zip |
Cleanup and proper flag satisfaction for partial specs
-rw-r--r-- | lib/spack/spack/build_environment.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/compiler.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/compilers/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/spec.py | 18 |
4 files changed, 17 insertions, 13 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 2a5ecde19f..f30a5b0702 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -105,7 +105,7 @@ def set_compiler_environment_variables(pkg): os.environ['SPACK_FC'] = compiler.fc # Add every valid compiler flag to the environment, prefaced by "SPACK_" - for flag in Compiler.valid_compiler_flags(): + for flag in spack.spec.FlagMap.valid_compiler_flags(): # Concreteness guarantees key safety here if flags[flag] != '': os.environ['SPACK_'+flag.upper()] = ' '.join(f for f in flags[flag]) diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 3b2f57f60e..9041c6f759 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -63,10 +63,6 @@ def dumpversion(compiler_path): """Simple default dumpversion method -- this is what gcc does.""" return get_compiler_version(compiler_path, '-dumpversion') -_valid_compiler_flags = ['cflags', 'cxxflags', 'fflags', 'ldflags', 'cppflags'] -def valid_compiler_flags(): - return _valid_compiler_flags - class Compiler(object): """This class encapsulates a Spack "compiler", which includes C, @@ -118,10 +114,10 @@ class Compiler(object): # in the same order they are returned by sorted(flags) # in compilers/__init__.py self.flags = {} - for flag in _valid_compiler_flags: + for flag in spack.spec.FlagMap.valid_compiler_flags(): value = kwargs.get(flag, None) if value is not None: - self.flags[flag] = value + self.flags[flag] = value.split() self.spec = cspec diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index 9d3d01b20d..895bf8bc95 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -191,7 +191,7 @@ def compilers_for_spec(compiler_spec): compiler_paths.append(None) flags = {} - for f in Comp.valid_compiler_flags(): + for f in spack.spec.FlagMap.valid_compiler_flags(): if f in items: flags[f] = items[f] return cls(cspec, *compiler_paths, **flags) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index f7cdcc128f..4a589d4cdf 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -372,6 +372,7 @@ class VariantMap(HashableMap): return ''.join(str(self[key]) for key in sorted_keys) +_valid_compiler_flags = ['cflags', 'cxxflags', 'fflags', 'ldflags', 'cppflags'] class FlagMap(HashableMap): def __init__(self, spec): super(FlagMap, self).__init__() @@ -384,8 +385,12 @@ class FlagMap(HashableMap): return all(f in self and set(self[f]) == set(other[f]) for f in other if other[f] != []) else: - return all(f in self and set(self[f]) >= set(other[f]) - for f in other) + if other.spec and other.spec.concrete: + return all(f in self and set(self[f]) == set(other[f]) + for f in other) + else: + return all(f in self and set(self[f]) >= set(other[f]) + for f in other) def constrain(self, other): @@ -406,10 +411,13 @@ class FlagMap(HashableMap): changed = True return changed + @staticmethod + def valid_compiler_flags(): + return _valid_compiler_flags @property def concrete(self): - return self.spec._concrete + return all(flag in self for flag in _valid_compiler_flags) def copy(self): @@ -509,7 +517,7 @@ class Spec(object): """Called by the parser to add a known flag. Known flags currently include "arch" """ - valid_flags = Compiler.valid_compiler_flags() + valid_flags = FlagMap.valid_compiler_flags() if name == 'arch': self._set_architecture(value) elif name in valid_flags: @@ -596,7 +604,7 @@ class Spec(object): and self.variants.concrete and self.architecture and self.compiler and self.compiler.concrete -# and self.compiler_flags.concrete + and self.compiler_flags.concrete and self.dependencies.concrete) return self._concrete |