summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Becker <becker33@llnl.gov>2015-11-05 14:17:25 -0800
committerGregory Becker <becker33@llnl.gov>2015-11-10 15:45:22 -0800
commit6f339939c4481ac620a57b90bc3411e47baa35be (patch)
tree98aae2e2df2d0c681d28cec2c45c035310b885e1
parent6fa0bb991a16bf468e3ad88226b22faa5c290d00 (diff)
downloadspack-6f339939c4481ac620a57b90bc3411e47baa35be.tar.gz
spack-6f339939c4481ac620a57b90bc3411e47baa35be.tar.bz2
spack-6f339939c4481ac620a57b90bc3411e47baa35be.tar.xz
spack-6f339939c4481ac620a57b90bc3411e47baa35be.zip
Removed "any-pkg-name" and replaced it with empty string. Also changed cflag concretizer to concretize each flag individually, allowing us to have unconcretized FlagMap objects for find and uninstall. Now empty flags in find match any, whereas specifying +cflags=\'\' matches only those with empty strings for flags
-rw-r--r--lib/spack/spack/concretize.py35
-rw-r--r--lib/spack/spack/packages.py2
-rw-r--r--lib/spack/spack/spec.py22
-rw-r--r--lib/spack/spack/virtual.py4
4 files changed, 35 insertions, 28 deletions
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 946199bc6c..ae2f9716a6 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -38,7 +38,7 @@ import spack.compilers
import spack.architecture
import spack.error
from spack.version import *
-
+import spack.compiler as Compiler
class DefaultConcretizer(object):
@@ -181,20 +181,27 @@ class DefaultConcretizer(object):
compiler is used, defaulting to no compiler flags in the spec.
Default specs set at the compiler level will still be added later.
"""
- try:
- nearest = next(p for p in spec.traverse(direction='parents')
- if p.compiler == spec.compiler and p is not spec)
- if spec.compiler_flags == nearest.compiler_flags:
- return False
- spec.compiler_flags = nearest.compiler_flags.copy()
-
- except StopIteration:
- if spec.compiler_flags == spec.root.compiler_flags:
- return False
- spec.compiler_flags = spec.root.compiler_flags
-
- return True # things changed.
+ ret = False
+ for flag in Compiler.valid_compiler_flags():
+ print flag
+ try:
+ nearest = next(p for p in spec.traverse(direction='parents')
+ if p.compiler == spec.compiler and p is not spec
+ and flag in p.compiler_flags)
+ if ((not flag in spec.compiler_flags) or
+ spec.compiler_flags[flag] != p.compiler_flags[flag]):
+ spec.compiler_flags[flag] = p.compiler_flags[flag]
+ ret = True
+
+ except StopIteration:
+ if (flag in spec.root.compiler_flags and ((not flag in spec.compiler_flags) or
+ spec.compiler_flags[flag] != spec.root.compiler_flags[flag])):
+ spec.compiler_flags[flag] = spec.root.compiler_flags[flag]
+ ret = True
+ else:
+ spec.compiler_flags[flag] = ''
+ return ret
def choose_provider(self, spec, providers):
diff --git a/lib/spack/spack/packages.py b/lib/spack/spack/packages.py
index 78a69a737d..80b91f4ef1 100644
--- a/lib/spack/spack/packages.py
+++ b/lib/spack/spack/packages.py
@@ -153,7 +153,7 @@ class PackageDB(object):
@memoized
def exists(self, pkg_name):
"""Whether a package with the supplied name exists ."""
- if pkg_name == "any-pkg-name":
+ if pkg_name == "":
return True
return os.path.exists(self.filename_for_package_name(pkg_name))
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index b9dcd91e99..6335567e66 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -376,8 +376,6 @@ class FlagMap(HashableMap):
def __init__(self, spec):
super(FlagMap, self).__init__()
self.spec = spec
- for flag in Compiler.valid_compiler_flags():
- self[flag] = ""
def satisfies(self, other, strict=False):
@@ -386,7 +384,9 @@ class FlagMap(HashableMap):
return all(k in self and self[k] == other[k]
for k in other if other[k] != "")
else:
- return self == other
+ return all(k in self and self[k] == other[k]
+ for k in other)
+
def constrain(self, other):
"""Add all flags in other that aren't in self to self.
@@ -581,7 +581,7 @@ class Spec(object):
@staticmethod
def is_virtual(name):
"""Test if a name is virtual without requiring a Spec."""
- return name != "any-pkg-name" and not spack.db.exists(name)
+ return name != "" and not spack.db.exists(name)
@property
@@ -904,7 +904,7 @@ class Spec(object):
with requirements of its pacakges. See flatten() and normalize() for
more details on this.
"""
- if self.name == "any-pkg-name":
+ if self.name == "":
raise SpecError("Attempting to concretize anonymous spec")
if self._concrete:
@@ -1239,7 +1239,7 @@ class Spec(object):
"""
other = self._autospec(other)
- if not (self.name == other.name or self.name == "any-pkg-name" or other.name == "any-pkg-name"):
+ if not (self.name == other.name or self.name == "" or other.name == ""):
raise UnsatisfiableSpecNameError(self.name, other.name)
if not self.versions.overlaps(other.versions):
@@ -1332,7 +1332,7 @@ class Spec(object):
try:
spec = spack.spec.Spec(spec_like)
- if spec.name == "any-pkg-name":
+ if spec.name == "":
raise SpecError("anonymous package -- this will always be handled")
return spec
except SpecError:
@@ -1365,7 +1365,7 @@ class Spec(object):
return False
# Otherwise, first thing we care about is whether the name matches
- if self.name != other.name and self.name != "any-pkg-name" and other.name != "any-pkg-name":
+ if self.name != other.name and self.name != "" and other.name != "":
return False
if self.versions and other.versions:
@@ -1382,7 +1382,7 @@ class Spec(object):
return False
var_strict = strict
- if self.name == "any-pkg-name" or other.name == "any-pkg-name":
+ if self.name == "" or other.name == "":
var_strict = True
if not self.variants.satisfies(other.variants, strict=var_strict):
return False
@@ -1401,7 +1401,7 @@ class Spec(object):
# If we need to descend into dependencies, do it, otherwise we're done.
if deps:
deps_strict = strict
- if self.name == "any-pkg-name" or other.name == "any-pkg-name":
+ if self.name == "" or other.name == "":
deps_strict=True
return self.satisfies_dependencies(other, strict=deps_strict)
else:
@@ -1888,7 +1888,7 @@ class SpecParser(spack.parse.Parser):
def empty_spec(self):
"""Create a Null spec from which dependency constraints can be hung"""
spec = Spec.__new__(Spec)
- spec.name = "any-pkg-name"
+ spec.name = ""
spec.versions = VersionList(':')
spec.variants = VariantMap(spec)
spec.architecture = None
diff --git a/lib/spack/spack/virtual.py b/lib/spack/spack/virtual.py
index c988d14c49..8e51b87acd 100644
--- a/lib/spack/spack/virtual.py
+++ b/lib/spack/spack/virtual.py
@@ -67,8 +67,8 @@ class ProviderIndex(object):
if type(spec) != spack.spec.Spec:
spec = spack.spec.Spec(spec)
- if spec.name == "any-pkg-name":
- #The "any" name does not have a package
+ if spec.name == "":
+ # Empty specs do not have a package
return
assert(not spec.virtual)