summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/package.py19
-rw-r--r--lib/spack/spack/patch.py8
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 453623d97a..69d2de41b7 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -374,6 +374,21 @@ class PackageMeta(
return '%s.%s' % (self.namespace, self.name)
@property
+ def fullnames(self):
+ """
+ Fullnames for this package and any packages from which it inherits.
+ """
+ fullnames = []
+ for cls in inspect.getmro(self):
+ namespace = getattr(cls, 'namespace', None)
+ if namespace:
+ fullnames.append('%s.%s' % (namespace, self.name))
+ if namespace == 'builtin':
+ # builtin packages cannot inherit from other repos
+ break
+ return fullnames
+
+ @property
def name(self):
"""The name of this package.
@@ -864,6 +879,10 @@ class PackageBase(six.with_metaclass(PackageMeta, PackageViewMixin, object)):
return type(self).fullname
@property
+ def fullnames(self):
+ return type(self).fullnames
+
+ @property
def name(self):
"""Name of this package (the module without parent modules)."""
return type(self).name
diff --git a/lib/spack/spack/patch.py b/lib/spack/spack/patch.py
index a273514636..5bfd7722d6 100644
--- a/lib/spack/spack/patch.py
+++ b/lib/spack/spack/patch.py
@@ -348,8 +348,12 @@ class PatchCache(object):
"Couldn't find patch for package %s with sha256: %s"
% (pkg.fullname, sha256))
- patch_dict = sha_index.get(pkg.fullname)
- if not patch_dict:
+ # Find patches for this class or any class it inherits from
+ for fullname in pkg.fullnames:
+ patch_dict = sha_index.get(fullname)
+ if patch_dict:
+ break
+ else:
raise NoSuchPatchError(
"Couldn't find patch for package %s with sha256: %s"
% (pkg.fullname, sha256))