package.py : workaround for a known bug that was not fixed in python 2.6
https://bugs.python.org/issue1515
This commit is contained in:
parent
5cc59507f7
commit
468a6431f9
@ -120,6 +120,17 @@ def _on_phase_exit(self, instance):
|
||||
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 @@ def _append_checks(check_name):
|
||||
# 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 @@ def do_fetch(self, mirror_only=False):
|
||||
|
||||
self.stage.cache_local()
|
||||
|
||||
|
||||
def do_stage(self, mirror_only=False):
|
||||
"""Unpacks the fetched tarball, then changes into the expanded tarball
|
||||
directory."""
|
||||
|
Loading…
Reference in New Issue
Block a user