From 468a6431f95e963fe97f3ee49b908566375674bd Mon Sep 17 00:00:00 2001 From: alalazo Date: Wed, 13 Jul 2016 11:08:19 +0200 Subject: package.py : workaround for a known bug that was not fixed in python 2.6 https://bugs.python.org/issue1515 --- lib/spack/spack/package.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 50f4e715b1..29d7e1dca7 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -120,6 +120,17 @@ class InstallPhase(object): if getattr(instance, 'last_phase', None) == self.name: raise StopIteration('Stopping at \'{0}\' phase'.format(self.name)) + def copy(self): + try: + return copy.deepcopy(self) + except TypeError: + # This bug-fix was not back-ported in Python 2.6 + # http://bugs.python.org/issue1515 + other = InstallPhase(self.name) + other.preconditions.extend(self.preconditions) + other.sanity_checks.extend(self.sanity_checks) + return other + class PackageMeta(type): """Conveniently transforms attributes to permit extensible phases @@ -156,7 +167,7 @@ class PackageMeta(type): # 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) + attr_dict[PackageMeta.phase_fmt.format(phase_name)] = phase.copy() phase = attr_dict[PackageMeta.phase_fmt.format(phase_name)] getattr(phase, check_name).extend(funcs) # Clear the attribute for the next class @@ -901,7 +912,6 @@ class PackageBase(object): self.stage.cache_local() - def do_stage(self, mirror_only=False): """Unpacks the fetched tarball, then changes into the expanded tarball directory.""" -- cgit v1.2.3-60-g2f50