diff options
-rw-r--r-- | lib/spack/spack/build_environment.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/spec.py | 32 |
2 files changed, 20 insertions, 25 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 5ac921df22..43824d7388 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -104,18 +104,11 @@ def set_compiler_environment_variables(pkg): if compiler.fc: os.environ['SPACK_FC'] = compiler.fc - # Incorporate the compiler default flags into the set of flags - for flag in flags:#This is all valid flags as well because it's concrete - if flag in compiler.flags and compiler.flags[flag] != "": - compiler.flags[flag] += ' '+flags[flag] - else: - compiler.flags[flag] = flags[flag] - # Add every valid compiler flag to the environment, prefaced by "SPACK_" for flag in Compiler.valid_compiler_flags(): - #The previous block and concreteness guarantee key safety here - if compiler.flags[flag] != "": - os.environ['SPACK_'+flag.upper()] = compiler.flags[flag] + # Concreteness guarantees key safety here + if flags[flag] != '': + os.environ['SPACK_'+flag.upper()] = flags[flag] os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index ac0ddce10a..40a257489e 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -394,11 +394,14 @@ class FlagMap(HashableMap): Return whether the spec changed. """ changed = False - for k in other: - if k in self: + + # Others_set removes flags set to '' from the comparison + others_set = (k for k in other if other[k] != '') + for k in others_set: + if k in self and self[k] != '': if self[k] != other[k]: - #This will not properly recognize incompatible flags - self[k] += other[k] + # This will not recognize incompatible flags, merely concatenates + self[k] += ' ' + other[k] changed = True else: self[k] = other[k] @@ -912,7 +915,6 @@ class Spec(object): while changed: #debugging code -# print self, "raw" a = self.normalize(force=force) # print self, "normal" b = self._expand_virtual_packages() @@ -927,6 +929,16 @@ class Spec(object): changed = any(changes) force=True + # Include the compiler flag defaults from the config files + # This ensures that spack will detect conflicts that stemp from a change + # in default compiler flags. + pkg = spack.db.get(self) + for flag in pkg.compiler.flags: + if self.compiler_flags[flag] == '': + self.compiler_flags[flag] += pkg.compiler.flags[flag] + else: + self.compiler_flags[flag] += ' ' + pkg.compiler.flags[flag] + self._concrete = True @@ -1116,12 +1128,6 @@ class Spec(object): def _normalize_helper(self, visited, spec_deps, provider_index): """Recursive helper function for _normalize.""" - print self,"self help" -# print -# from spack.graph import graph_ascii -# graph_ascii(self) -# print - print spec_deps if self.name in visited: return False visited.add(self.name) @@ -1186,10 +1192,6 @@ class Spec(object): visited = set() any_change = self._normalize_helper(visited, spec_deps, index) - print self, "self norm" - print spec_deps - print visited - # If there are deps specified but not visited, they're not # actually deps of this package. Raise an error. extra = set(spec_deps.keys()).difference(visited) |