Fixed bug that spack.db.exists() returned True for anonymous specs
This commit is contained in:
		| @@ -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 '') | ||||
|   | ||||
| @@ -154,7 +154,7 @@ def all_packages(self): | ||||
|     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)) | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1175,6 +1175,9 @@ def normalize(self, force=False): | ||||
|            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 @@ def validate_names(self): | ||||
|            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 @@ def empty_spec(self): | ||||
|         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): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Gregory Becker
					Gregory Becker