added default compilers into spec and fixed constrain/concretize bug
This commit is contained in:
parent
cb5bc242db
commit
5a9394c65f
@ -104,18 +104,11 @@ def set_compiler_environment_variables(pkg):
|
|||||||
if compiler.fc:
|
if compiler.fc:
|
||||||
os.environ['SPACK_FC'] = 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_"
|
# Add every valid compiler flag to the environment, prefaced by "SPACK_"
|
||||||
for flag in Compiler.valid_compiler_flags():
|
for flag in Compiler.valid_compiler_flags():
|
||||||
#The previous block and concreteness guarantee key safety here
|
# Concreteness guarantees key safety here
|
||||||
if compiler.flags[flag] != "":
|
if flags[flag] != '':
|
||||||
os.environ['SPACK_'+flag.upper()] = compiler.flags[flag]
|
os.environ['SPACK_'+flag.upper()] = flags[flag]
|
||||||
|
|
||||||
os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler)
|
os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler)
|
||||||
|
|
||||||
|
@ -394,11 +394,14 @@ def constrain(self, other):
|
|||||||
Return whether the spec changed.
|
Return whether the spec changed.
|
||||||
"""
|
"""
|
||||||
changed = False
|
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]:
|
if self[k] != other[k]:
|
||||||
#This will not properly recognize incompatible flags
|
# This will not recognize incompatible flags, merely concatenates
|
||||||
self[k] += other[k]
|
self[k] += ' ' + other[k]
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
self[k] = other[k]
|
self[k] = other[k]
|
||||||
@ -912,7 +915,6 @@ def concretize(self):
|
|||||||
|
|
||||||
while changed:
|
while changed:
|
||||||
#debugging code
|
#debugging code
|
||||||
# print self, "raw"
|
|
||||||
a = self.normalize(force=force)
|
a = self.normalize(force=force)
|
||||||
# print self, "normal"
|
# print self, "normal"
|
||||||
b = self._expand_virtual_packages()
|
b = self._expand_virtual_packages()
|
||||||
@ -927,6 +929,16 @@ def concretize(self):
|
|||||||
changed = any(changes)
|
changed = any(changes)
|
||||||
force=True
|
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
|
self._concrete = True
|
||||||
|
|
||||||
|
|
||||||
@ -1116,12 +1128,6 @@ def _merge_dependency(self, dep, visited, spec_deps, provider_index):
|
|||||||
|
|
||||||
def _normalize_helper(self, visited, spec_deps, provider_index):
|
def _normalize_helper(self, visited, spec_deps, provider_index):
|
||||||
"""Recursive helper function for _normalize."""
|
"""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:
|
if self.name in visited:
|
||||||
return False
|
return False
|
||||||
visited.add(self.name)
|
visited.add(self.name)
|
||||||
@ -1186,10 +1192,6 @@ def normalize(self, force=False):
|
|||||||
visited = set()
|
visited = set()
|
||||||
any_change = self._normalize_helper(visited, spec_deps, index)
|
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
|
# If there are deps specified but not visited, they're not
|
||||||
# actually deps of this package. Raise an error.
|
# actually deps of this package. Raise an error.
|
||||||
extra = set(spec_deps.keys()).difference(visited)
|
extra = set(spec_deps.keys()).difference(visited)
|
||||||
|
Loading…
Reference in New Issue
Block a user