diff options
author | alalazo <massimiliano.culpo@googlemail.com> | 2016-07-12 21:28:09 +0200 |
---|---|---|
committer | alalazo <massimiliano.culpo@googlemail.com> | 2016-07-13 09:27:09 +0200 |
commit | 97c2224cd6445c0e5395b4ae30a9f4d3bf5670e0 (patch) | |
tree | 505191f67b42f27d0f7c0610faf359e10d1f509b /lib | |
parent | 813cb032c47b7b8507fba28a3629bec0d2b244cd (diff) | |
download | spack-97c2224cd6445c0e5395b4ae30a9f4d3bf5670e0.tar.gz spack-97c2224cd6445c0e5395b4ae30a9f4d3bf5670e0.tar.bz2 spack-97c2224cd6445c0e5395b4ae30a9f4d3bf5670e0.tar.xz spack-97c2224cd6445c0e5395b4ae30a9f4d3bf5670e0.zip |
package.py : extra arguments, fixed inheritance issue
- added attribute to hold extra arguments in PackageBase instances
- fixed registration from within packages
- examples : hdf5, lzo
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/package.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 5ceb1ce2a2..c61f8262f7 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -40,6 +40,8 @@ import textwrap import time import functools import inspect +import copy + from StringIO import StringIO from urlparse import urlparse @@ -135,7 +137,17 @@ class PackageMeta(type): checks = getattr(meta, attr_name) if checks: for phase_name, funcs in checks.items(): - phase = attr_dict.get(PackageMeta.phase_fmt.format(phase_name)) + try: + # Search for the phase in the attribute dictionary + phase = attr_dict[PackageMeta.phase_fmt.format(phase_name)] + except KeyError: + # If it is not there it's in the bases + # and we added a check. We need to copy + # and extend + for base in bases: + phase = getattr(base, PackageMeta.phase_fmt.format(phase_name), None) + attr_dict[PackageMeta.phase_fmt.format(phase_name)] = copy.deepcopy(phase) + phase = attr_dict[PackageMeta.phase_fmt.format(phase_name)] getattr(phase, check_name).extend(funcs) # Clear the attribute for the next class setattr(meta, attr_name, {}) @@ -511,6 +523,8 @@ class PackageBase(object): if self.is_extension: spack.repo.get(self.extendee_spec)._check_extendable() + self.extra_args = {} + @property def package_dir(self): """Return the directory where the package.py file lives.""" |