summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-07-13 11:08:19 +0200
committeralalazo <massimiliano.culpo@googlemail.com>2016-07-13 11:08:19 +0200
commit468a6431f95e963fe97f3ee49b908566375674bd (patch)
treecb3241adbf0c5c1fe14ba25e536ac49281790225 /lib
parent5cc59507f724950f8671803bb9ff616b17f255f7 (diff)
downloadspack-468a6431f95e963fe97f3ee49b908566375674bd.tar.gz
spack-468a6431f95e963fe97f3ee49b908566375674bd.tar.bz2
spack-468a6431f95e963fe97f3ee49b908566375674bd.tar.xz
spack-468a6431f95e963fe97f3ee49b908566375674bd.zip
package.py : workaround for a known bug that was not fixed in python 2.6
https://bugs.python.org/issue1515
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py14
1 files changed, 12 insertions, 2 deletions
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."""