Fix namespace support in Repo.get_pkg_class()

This commit is contained in:
Todd Gamblin 2016-05-30 00:26:49 -07:00
parent ab049eca41
commit 1f5a21decf
2 changed files with 8 additions and 2 deletions

View File

@ -864,6 +864,12 @@ def get_pkg_class(self, pkg_name):
package. Then extracts the package class from the module
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)
module = self._get_pkg_module(pkg_name)

View File

@ -714,7 +714,7 @@ def package_class(self):
"""Internal package call gets only the class object for a package.
Use this to just get package metadata.
"""
return spack.repo.get_pkg_class(self.name)
return spack.repo.get_pkg_class(self.fullname)
@property
def virtual(self):
@ -1574,7 +1574,7 @@ def validate_names(self):
UnsupportedCompilerError.
"""
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:
spack.repo.get(spec.fullname)