Fix namespace support in Repo.get_pkg_class()
This commit is contained in:
parent
ab049eca41
commit
1f5a21decf
@ -864,6 +864,12 @@ def get_pkg_class(self, pkg_name):
|
|||||||
package. Then extracts the package class from the module
|
package. Then extracts the package class from the module
|
||||||
according to Spack's naming convention.
|
according to Spack's naming convention.
|
||||||
"""
|
"""
|
||||||
|
fullname = pkg_name
|
||||||
|
namespace, _, pkg_name = pkg_name.rpartition('.')
|
||||||
|
if namespace and (namespace != self.namespace):
|
||||||
|
raise InvalidNamespaceError('Invalid namespace for %s repo: %s'
|
||||||
|
% (self.namespace, namespace))
|
||||||
|
|
||||||
class_name = mod_to_class(pkg_name)
|
class_name = mod_to_class(pkg_name)
|
||||||
module = self._get_pkg_module(pkg_name)
|
module = self._get_pkg_module(pkg_name)
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ def package_class(self):
|
|||||||
"""Internal package call gets only the class object for a package.
|
"""Internal package call gets only the class object for a package.
|
||||||
Use this to just get package metadata.
|
Use this to just get package metadata.
|
||||||
"""
|
"""
|
||||||
return spack.repo.get_pkg_class(self.name)
|
return spack.repo.get_pkg_class(self.fullname)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def virtual(self):
|
def virtual(self):
|
||||||
@ -1574,7 +1574,7 @@ 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.
|
# raise an UnknownPackageError if the spec's package isn't real.
|
||||||
if (not spec.virtual) and spec.name:
|
if (not spec.virtual) and spec.name:
|
||||||
spack.repo.get(spec.fullname)
|
spack.repo.get(spec.fullname)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user