diff --git a/ChangeLog b/ChangeLog index 00dbd2e8..0917111d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2009-02-13 Bahadır Kandemir + * Merged Python 2.6 patch + 2009-02-13 Faik Uygur * pisi-2.1.2 diff --git a/pisi/archive.py b/pisi/archive.py index 3607fba9..086dc4df 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -20,6 +20,8 @@ import tarfile import zipfile import gzip import struct +import sys +import distutils.version import gettext __trans = gettext.translation('pisi', fallback=True) @@ -187,7 +189,7 @@ class ArchiveTar(ArchiveBase): def close(self): self.tar.close() - if self.tar.mode == 'wb' and self.type == 'tarlzma': + if 'w' in str(self.tar.mode) and self.type == 'tarlzma': batch = None if ctx.config.values.build.compressionlevel: batch = "lzma -%s -z %s" % (ctx.config.values.build.compressionlevel, self.file_path) @@ -414,7 +416,12 @@ class ArchiveZip(ArchiveBase): perm &= 0x08FF0000 perm >>= 16 perm |= 0x00000100 - zip_obj.decompressToFile(info.filename, ofile) + + version = sys.version.split()[0] + if distutils.version.StrictVersion(version) < distutils.version.StrictVersion("2.6.0"): + zip_obj.decompressToFile(info.filename, ofile) + else: + zip_obj.extract(info.filename, target_dir) os.chmod(ofile, perm) def unpack_files(self, paths, target_dir): diff --git a/python-2.6.patch b/python-2.6.patch deleted file mode 100644 index 5e03823f..00000000 --- a/python-2.6.patch +++ /dev/null @@ -1,36 +0,0 @@ -Index: pisi/archive.py -=================================================================== ---- pisi/archive.py (revision 21417) -+++ pisi/archive.py (working copy) -@@ -20,6 +20,8 @@ - import zipfile - import gzip - import struct -+import sys -+import distutils.version - - import gettext - __trans = gettext.translation('pisi', fallback=True) -@@ -187,7 +189,7 @@ - def close(self): - self.tar.close() - -- if self.tar.mode == 'wb' and self.type == 'tarlzma': -+ if 'w' in str(self.tar.mode) and self.type == 'tarlzma': - batch = None - if ctx.config.values.build.compressionlevel: - batch = "lzma -%s -z %s" % (ctx.config.values.build.compressionlevel, self.file_path) -@@ -414,7 +416,12 @@ - perm &= 0x08FF0000 - perm >>= 16 - perm |= 0x00000100 -- zip_obj.decompressToFile(info.filename, ofile) -+ -+ version = sys.version.split()[0] -+ if distutils.version.StrictVersion(version) < distutils.version.StrictVersion("2.6.0"): -+ zip_obj.decompressToFile(info.filename, ofile) -+ else: -+ zip_obj.extract(info.filename, target_dir) - os.chmod(ofile, perm) - - def unpack_files(self, paths, target_dir):