From 87c87ff767c49ff2c369f26bc91300ee4745a0ca Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 22 Oct 2020 10:37:22 +0200 Subject: Compute the correct package name for hierarchies that change class names --- lib/spack/spack/package.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 11e64e9061..b8dca6e55a 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -306,6 +306,10 @@ class PackageMeta( _flush_callbacks('run_before') _flush_callbacks('run_after') + # Reset names for packages that inherit from another + # package with a different name + attr_dict['_name'] = None + return super(PackageMeta, cls).__new__(cls, name, bases, attr_dict) @staticmethod @@ -355,7 +359,7 @@ class PackageMeta( The name of a package is the name of its Python module, without the containing module names. """ - if not hasattr(self, '_name'): + if self._name is None: self._name = self.module.__name__ if '.' in self._name: self._name = self._name[self._name.rindex('.') + 1:] -- cgit v1.2.3-70-g09d2