Changed flag default to "". Updated printing and other logic to match. Seems to have solved error in normalize.
This commit is contained in:
parent
2d77173dfa
commit
cb5bc242db
@ -105,15 +105,16 @@ def set_compiler_environment_variables(pkg):
|
|||||||
os.environ['SPACK_FC'] = compiler.fc
|
os.environ['SPACK_FC'] = compiler.fc
|
||||||
|
|
||||||
# Incorporate the compiler default flags into the set of flags
|
# Incorporate the compiler default flags into the set of flags
|
||||||
for flag in flags:
|
for flag in flags:#This is all valid flags as well because it's concrete
|
||||||
if flag in compiler.flags:
|
if flag in compiler.flags and compiler.flags[flag] != "":
|
||||||
compiler.flags[flag] += ' '+flags[flag]
|
compiler.flags[flag] += ' '+flags[flag]
|
||||||
else:
|
else:
|
||||||
compiler.flags[flag] = flags[flag]
|
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():
|
||||||
if flag in compiler.flags:
|
#The previous block and concreteness guarantee key safety here
|
||||||
|
if compiler.flags[flag] != "":
|
||||||
os.environ['SPACK_'+flag.upper()] = compiler.flags[flag]
|
os.environ['SPACK_'+flag.upper()] = compiler.flags[flag]
|
||||||
|
|
||||||
os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler)
|
os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler)
|
||||||
|
@ -114,8 +114,9 @@ def check(exe):
|
|||||||
self.f77 = check(f77)
|
self.f77 = check(f77)
|
||||||
self.fc = check(fc)
|
self.fc = check(fc)
|
||||||
|
|
||||||
#Unfortunately have to make sure these params are accepted in the same order the are returned
|
# Unfortunately have to make sure these params are accepted
|
||||||
#by sorted(flags) in compilers/__init__.py
|
# in the same order they are returned by sorted(flags)
|
||||||
|
# in compilers/__init__.py
|
||||||
self.flags = {}
|
self.flags = {}
|
||||||
for flag in _valid_compiler_flags:
|
for flag in _valid_compiler_flags:
|
||||||
value = kwargs.get(flag, None)
|
value = kwargs.get(flag, None)
|
||||||
|
@ -192,12 +192,10 @@ def __init__(self, *args):
|
|||||||
c = SpecParser().parse_compiler(arg)
|
c = SpecParser().parse_compiler(arg)
|
||||||
self.name = c.name
|
self.name = c.name
|
||||||
self.versions = c.versions
|
self.versions = c.versions
|
||||||
# self.flags = c.flags
|
|
||||||
|
|
||||||
elif isinstance(arg, CompilerSpec):
|
elif isinstance(arg, CompilerSpec):
|
||||||
self.name = arg.name
|
self.name = arg.name
|
||||||
self.versions = arg.versions.copy()
|
self.versions = arg.versions.copy()
|
||||||
# self.flags = arg.flags.copy()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
@ -209,14 +207,6 @@ def __init__(self, *args):
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.versions = VersionList()
|
self.versions = VersionList()
|
||||||
self.versions.add(ver(version))
|
self.versions.add(ver(version))
|
||||||
# self.flags = {'cflags':None,'cxxflags':None,'fflags':None,'ldflags':None}
|
|
||||||
|
|
||||||
# elif nargs == 3:
|
|
||||||
# name, version, flags = args
|
|
||||||
# self.name = name
|
|
||||||
# self.versions = VersionList()
|
|
||||||
# self.versions.add(ver(version))
|
|
||||||
# self.flags = flags
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
@ -236,21 +226,9 @@ def _autospec(self, compiler_spec_like):
|
|||||||
def satisfies(self, other, strict=False):
|
def satisfies(self, other, strict=False):
|
||||||
other = self._autospec(other)
|
other = self._autospec(other)
|
||||||
return (self.name == other.name and
|
return (self.name == other.name and
|
||||||
self.versions.satisfies(other.versions, strict=strict))# and
|
self.versions.satisfies(other.versions, strict=strict))
|
||||||
# self.flags_satisfy(other, strict=strict))
|
|
||||||
|
|
||||||
|
|
||||||
# def flags_satisfy(self,other,strict = False):
|
|
||||||
# if strict:
|
|
||||||
# for flag in self.flags:
|
|
||||||
# if not self.flags[flag] == other.flags[flag]:
|
|
||||||
# return False
|
|
||||||
# else:
|
|
||||||
# for flag in self.flags:
|
|
||||||
# if other.flags[flag] and (not self.flags[flag] or other.flags[flag] not in self.flags[flag]):
|
|
||||||
# return False
|
|
||||||
# return True
|
|
||||||
|
|
||||||
def constrain(self, other):
|
def constrain(self, other):
|
||||||
"""Intersect self's versions with other.
|
"""Intersect self's versions with other.
|
||||||
|
|
||||||
@ -283,25 +261,23 @@ def copy(self):
|
|||||||
clone = CompilerSpec.__new__(CompilerSpec)
|
clone = CompilerSpec.__new__(CompilerSpec)
|
||||||
clone.name = self.name
|
clone.name = self.name
|
||||||
clone.versions = self.versions.copy()
|
clone.versions = self.versions.copy()
|
||||||
# clone.flags = self.flags.copy()
|
|
||||||
return clone
|
return clone
|
||||||
|
|
||||||
|
|
||||||
def _cmp_key(self):
|
def _cmp_key(self):
|
||||||
return (self.name, self.versions)#, str(sorted(self.flags.items())))
|
return (self.name, self.versions)
|
||||||
|
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
d = {'name' : self.name}
|
d = {'name' : self.name}
|
||||||
d.update(self.versions.to_dict())
|
d.update(self.versions.to_dict())
|
||||||
# d['flags'] = self.flags
|
|
||||||
return { 'compiler' : d }
|
return { 'compiler' : d }
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_dict(d):
|
def from_dict(d):
|
||||||
d = d['compiler']
|
d = d['compiler']
|
||||||
return CompilerSpec(d['name'], VersionList.from_dict(d))#, d['flags'])
|
return CompilerSpec(d['name'], VersionList.from_dict(d))
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@ -309,11 +285,6 @@ def __str__(self):
|
|||||||
if self.versions and self.versions != _any_version:
|
if self.versions and self.versions != _any_version:
|
||||||
vlist = ",".join(str(v) for v in self.versions)
|
vlist = ",".join(str(v) for v in self.versions)
|
||||||
out += "@%s" % vlist
|
out += "@%s" % vlist
|
||||||
# if self.flags:
|
|
||||||
# for flag, value in self.flags.items():
|
|
||||||
# if value is not None:
|
|
||||||
# out += "+" + flag + "=" + value
|
|
||||||
# print "outing"
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@ -405,13 +376,15 @@ class FlagMap(HashableMap):
|
|||||||
def __init__(self, spec):
|
def __init__(self, spec):
|
||||||
super(FlagMap, self).__init__()
|
super(FlagMap, self).__init__()
|
||||||
self.spec = spec
|
self.spec = spec
|
||||||
|
for flag in Compiler.valid_compiler_flags():
|
||||||
|
self[flag] = ""
|
||||||
|
|
||||||
|
|
||||||
def satisfies(self, other, strict=False):
|
def satisfies(self, other, strict=False):
|
||||||
#"strict" makes no sense if this works, but it matches how we need it. Maybe
|
#"strict" makes no sense if this works, but it matches how we need it. Maybe
|
||||||
if strict:
|
if strict:
|
||||||
return all(k in self and self[k] == other[k]
|
return all(k in self and self[k] == other[k]
|
||||||
for k in other)
|
for k in other if other[k] != "")
|
||||||
else:
|
else:
|
||||||
return self == other
|
return self == other
|
||||||
|
|
||||||
@ -450,8 +423,9 @@ def _cmp_key(self):
|
|||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
sorted_keys = sorted(self.keys())
|
sorted_keys = filter(lambda flag: self[flag] != "", sorted(self.keys()))
|
||||||
return '+' + '+'.join(str(key) + '=\"' + str(self[key]) + '\"' for key in sorted_keys)
|
cond_symbol = '+' if len(sorted_keys)>0 else ''
|
||||||
|
return cond_symbol + '+'.join(str(key) + '=\"' + str(self[key]) + '\"' for key in sorted_keys)
|
||||||
|
|
||||||
|
|
||||||
class DependencyMap(HashableMap):
|
class DependencyMap(HashableMap):
|
||||||
|
Loading…
Reference in New Issue
Block a user