Fixed bug that spack.db.exists() returned True for anonymous specs
This commit is contained in:
parent
6f339939c4
commit
5e75a5c81c
3 changed files with 10 additions and 5 deletions
|
@ -79,7 +79,6 @@ def gray_hash(spec, length):
|
||||||
def display_specs(specs, **kwargs):
|
def display_specs(specs, **kwargs):
|
||||||
mode = kwargs.get('mode', 'short')
|
mode = kwargs.get('mode', 'short')
|
||||||
hashes = kwargs.get('long', False)
|
hashes = kwargs.get('long', False)
|
||||||
print hashes
|
|
||||||
|
|
||||||
hlen = 7
|
hlen = 7
|
||||||
if kwargs.get('very_long', False):
|
if kwargs.get('very_long', False):
|
||||||
|
@ -154,7 +153,7 @@ def find(parser, args):
|
||||||
# Filter out specs that don't exist.
|
# Filter out specs that don't exist.
|
||||||
query_specs = spack.cmd.parse_specs(args.query_specs)
|
query_specs = spack.cmd.parse_specs(args.query_specs)
|
||||||
query_specs, nonexisting = partition_list(
|
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:
|
if nonexisting:
|
||||||
msg = "No such package%s: " % ('s' if len(nonexisting) > 1 else '')
|
msg = "No such package%s: " % ('s' if len(nonexisting) > 1 else '')
|
||||||
|
|
|
@ -154,7 +154,7 @@ def all_packages(self):
|
||||||
def exists(self, pkg_name):
|
def exists(self, pkg_name):
|
||||||
"""Whether a package with the supplied name exists ."""
|
"""Whether a package with the supplied name exists ."""
|
||||||
if pkg_name == "":
|
if pkg_name == "":
|
||||||
return True
|
return False
|
||||||
return os.path.exists(self.filename_for_package_name(pkg_name))
|
return os.path.exists(self.filename_for_package_name(pkg_name))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1175,6 +1175,9 @@ def normalize(self, force=False):
|
||||||
TODO: normalize should probably implement some form of cycle detection,
|
TODO: normalize should probably implement some form of cycle detection,
|
||||||
to ensure that the spec is actually a DAG.
|
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:
|
if self._normal and not force:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1217,8 +1220,8 @@ def validate_names(self):
|
||||||
UnsupportedCompilerError.
|
UnsupportedCompilerError.
|
||||||
"""
|
"""
|
||||||
for spec in self.traverse():
|
for spec in self.traverse():
|
||||||
# Don't get a package for a virtual name.
|
# Don't get a package for a virtual name or an anonymous name
|
||||||
if not spec.virtual:
|
if (not spec.virtual) and spack.db.exists(spec.name):
|
||||||
spack.db.get(spec.name)
|
spack.db.get(spec.name)
|
||||||
|
|
||||||
# validate compiler in addition to the package name.
|
# validate compiler in addition to the package name.
|
||||||
|
@ -1897,6 +1900,9 @@ def empty_spec(self):
|
||||||
spec.dependents = DependencyMap()
|
spec.dependents = DependencyMap()
|
||||||
spec.dependencies = DependencyMap()
|
spec.dependencies = DependencyMap()
|
||||||
|
|
||||||
|
spec._normal = False
|
||||||
|
spec._concrete = False
|
||||||
|
|
||||||
#Should we be able to add cflags eventually?
|
#Should we be able to add cflags eventually?
|
||||||
while self.next:
|
while self.next:
|
||||||
if self.accept(ON):
|
if self.accept(ON):
|
||||||
|
|
Loading…
Reference in a new issue