diff options
author | Gregory Becker <becker33@llnl.gov> | 2015-11-05 14:55:24 -0800 |
---|---|---|
committer | Gregory Becker <becker33@llnl.gov> | 2015-11-10 15:45:22 -0800 |
commit | 5e75a5c81ca4be5622e755723a4573640b8109e9 (patch) | |
tree | 00a37631de8b3ff838b179a0dd4a89b608a4a660 | |
parent | 6f339939c4481ac620a57b90bc3411e47baa35be (diff) | |
download | spack-5e75a5c81ca4be5622e755723a4573640b8109e9.tar.gz spack-5e75a5c81ca4be5622e755723a4573640b8109e9.tar.bz2 spack-5e75a5c81ca4be5622e755723a4573640b8109e9.tar.xz spack-5e75a5c81ca4be5622e755723a4573640b8109e9.zip |
Fixed bug that spack.db.exists() returned True for anonymous specs
-rw-r--r-- | lib/spack/spack/cmd/find.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/packages.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/spec.py | 10 |
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py index 0728f3f1b2..6697e52de2 100644 --- a/lib/spack/spack/cmd/find.py +++ b/lib/spack/spack/cmd/find.py @@ -79,7 +79,6 @@ def gray_hash(spec, length): def display_specs(specs, **kwargs): mode = kwargs.get('mode', 'short') hashes = kwargs.get('long', False) - print hashes hlen = 7 if kwargs.get('very_long', False): @@ -154,7 +153,7 @@ def find(parser, args): # Filter out specs that don't exist. query_specs = spack.cmd.parse_specs(args.query_specs) query_specs, nonexisting = partition_list( - query_specs, lambda s: spack.db.exists(s.name)) + query_specs, lambda s: spack.db.exists(s.name) or s.name == "") if nonexisting: msg = "No such package%s: " % ('s' if len(nonexisting) > 1 else '') diff --git a/lib/spack/spack/packages.py b/lib/spack/spack/packages.py index 80b91f4ef1..2e90e22c29 100644 --- a/lib/spack/spack/packages.py +++ b/lib/spack/spack/packages.py @@ -154,7 +154,7 @@ class PackageDB(object): def exists(self, pkg_name): """Whether a package with the supplied name exists .""" if pkg_name == "": - return True + return False 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 6335567e66..5aac669871 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -1175,6 +1175,9 @@ class Spec(object): TODO: normalize should probably implement some form of cycle detection, to ensure that the spec is actually a DAG. """ + if self.name == "": + raise SpecError("Attempting to normalize anonymous spec") + if self._normal and not force: return False @@ -1217,8 +1220,8 @@ class Spec(object): UnsupportedCompilerError. """ for spec in self.traverse(): - # Don't get a package for a virtual name. - if not spec.virtual: + # Don't get a package for a virtual name or an anonymous name + if (not spec.virtual) and spack.db.exists(spec.name): spack.db.get(spec.name) # validate compiler in addition to the package name. @@ -1897,6 +1900,9 @@ class SpecParser(spack.parse.Parser): spec.dependents = DependencyMap() spec.dependencies = DependencyMap() + spec._normal = False + spec._concrete = False + #Should we be able to add cflags eventually? while self.next: if self.accept(ON): |