specs: remove "or ''" from Spec comparisons
Since `lazy_lexicographic_ordering` handles `None` comparison for us, we don't need to adjust the spec comparators to return empty strings or other type-specific empty types. We can just leverage the None-awareness of `lazy_lexicographic_ordering`. - [x] remove "or ''" from `_cmp_iter` in `Spec` - [x] remove setting of `self.namespace` to `''` in `MockPackage`
This commit is contained in:
		 Todd Gamblin
					Todd Gamblin
				
			
				
					committed by
					
						 Greg Becker
						Greg Becker
					
				
			
			
				
	
			
			
			 Greg Becker
						Greg Becker
					
				
			
						parent
						
							01a6adb5f7
						
					
				
				
					commit
					a1d9a56a43
				
			| @@ -3617,8 +3617,8 @@ def eq_dag(self, other, deptypes=True, vs=None, vo=None): | ||||
| 
 | ||||
|     def _cmp_node(self): | ||||
|         """Yield comparable elements of just *this node* and not its deps.""" | ||||
|         yield self.name or '' | ||||
|         yield self.namespace or '' | ||||
|         yield self.name | ||||
|         yield self.namespace | ||||
|         yield self.versions | ||||
|         yield self.variants | ||||
|         yield self.compiler | ||||
|   | ||||
| @@ -81,8 +81,8 @@ class MockPackageMultiRepo(object): | ||||
| 
 | ||||
|     def __init__(self): | ||||
|         self.spec_to_pkg = {} | ||||
|         self.namespace = '' | ||||
|         self.full_namespace = 'spack.pkg.mock' | ||||
|         self.namespace = 'mock'                 # repo namespace | ||||
|         self.full_namespace = 'spack.pkg.mock'  # python import namespace | ||||
| 
 | ||||
|     def get(self, spec): | ||||
|         if not isinstance(spec, spack.spec.Spec): | ||||
| @@ -92,6 +92,10 @@ def get(self, spec): | ||||
|         return self.spec_to_pkg[spec.name] | ||||
| 
 | ||||
|     def get_pkg_class(self, name): | ||||
|         namespace, _, name = name.rpartition(".") | ||||
|         if namespace and namespace != self.namespace: | ||||
|             raise spack.repo.InvalidNamespaceError( | ||||
|                 "bad namespace: %s" % self.namespace) | ||||
|         return self.spec_to_pkg[name] | ||||
| 
 | ||||
|     def exists(self, name): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user