patch cache: fix bug finding inherited packages (#29574)
This commit is contained in:
parent
d13c1cfa9f
commit
58a32b04d9
@ -400,6 +400,21 @@ def fullname(self):
|
|||||||
"""Name of this package, including the namespace"""
|
"""Name of this package, including the namespace"""
|
||||||
return '%s.%s' % (self.namespace, self.name)
|
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
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""The name of this package.
|
"""The name of this package.
|
||||||
@ -911,6 +926,10 @@ def fullname(self):
|
|||||||
"""Name of this package, including namespace: namespace.name."""
|
"""Name of this package, including namespace: namespace.name."""
|
||||||
return type(self).fullname
|
return type(self).fullname
|
||||||
|
|
||||||
|
@property
|
||||||
|
def fullnames(self):
|
||||||
|
return type(self).fullnames
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Name of this package (the module without parent modules)."""
|
"""Name of this package (the module without parent modules)."""
|
||||||
|
@ -368,8 +368,12 @@ def patch_for_package(self, sha256, pkg):
|
|||||||
"Couldn't find patch for package %s with sha256: %s"
|
"Couldn't find patch for package %s with sha256: %s"
|
||||||
% (pkg.fullname, sha256))
|
% (pkg.fullname, sha256))
|
||||||
|
|
||||||
patch_dict = sha_index.get(pkg.fullname)
|
# Find patches for this class or any class it inherits from
|
||||||
if not patch_dict:
|
for fullname in pkg.fullnames:
|
||||||
|
patch_dict = sha_index.get(fullname)
|
||||||
|
if patch_dict:
|
||||||
|
break
|
||||||
|
else:
|
||||||
raise NoSuchPatchError(
|
raise NoSuchPatchError(
|
||||||
"Couldn't find patch for package %s with sha256: %s"
|
"Couldn't find patch for package %s with sha256: %s"
|
||||||
% (pkg.fullname, sha256))
|
% (pkg.fullname, sha256))
|
||||||
|
Loading…
Reference in New Issue
Block a user