summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-05-30 00:26:49 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-08-08 21:04:23 -0700
commit1f5a21decf5aa97897692501337e700c572a25f6 (patch)
tree97eb6e65cc7b904e407039192aee514dd415b855
parentab049eca4129b389e7dab53d6dd475b24f8099ed (diff)
downloadspack-1f5a21decf5aa97897692501337e700c572a25f6.tar.gz
spack-1f5a21decf5aa97897692501337e700c572a25f6.tar.bz2
spack-1f5a21decf5aa97897692501337e700c572a25f6.tar.xz
spack-1f5a21decf5aa97897692501337e700c572a25f6.zip
Fix namespace support in Repo.get_pkg_class()
-rw-r--r--lib/spack/spack/repository.py6
-rw-r--r--lib/spack/spack/spec.py4
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/spack/spack/repository.py b/lib/spack/spack/repository.py
index 63ae999ce1..6aa9b8dd2f 100644
--- a/lib/spack/spack/repository.py
+++ b/lib/spack/spack/repository.py
@@ -864,6 +864,12 @@ class Repo(object):
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)
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index b9d9d3e0a4..24459fd3b3 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -714,7 +714,7 @@ class Spec(object):
"""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 @@ class Spec(object):
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)