diff --git a/doc/changelog.txt b/doc/changelog.txt index 3d873b0..0e9ac32 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -10,6 +10,7 @@ * Generate standalone Windows .exe and Linux .rpm installer. * Initialize the internal MIME database correct on all platforms. * Improved option compatibility for the ar, cpio and tar programs. +* Require and use Python >=2.5 0.16 "Game of thrones" (released 12.5.2012) diff --git a/doc/install.txt b/doc/install.txt index 2218a1f..cdfeab0 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -3,7 +3,7 @@ Installation First, install the required software. -1. Python >= 2.4 from http://www.python.org/ +1. Python >= 2.5 from http://www.python.org/ Be sure to also have installed the included distutils module. On most distributions, the distutils module is included in diff --git a/patool b/patool index 02d1f59..8120267 100755 --- a/patool +++ b/patool @@ -17,9 +17,6 @@ """ patool [extract|list|create|formats] [sub-command-options] """ -import sys -if not hasattr(sys, "version_info") or sys.version_info < (2, 4, 0, "final", 0): - raise SystemExit("This program requires Python 2.4 or later.") import os from patoolib import handle_archive, list_formats, baker diff --git a/patoolib/__init__.py b/patoolib/__init__.py index ad3d608..906c5f6 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -13,10 +13,13 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys +if not hasattr(sys, "version_info") or sys.version_info < (2, 5, 0, "final", 0): + raise SystemExit("This program requires Python 2.5 or later.") import os import shutil import stat -from patoolib import util +from . import util # Supported archive commands ArchiveCommands = ('list', 'extract', 'test', 'create') @@ -507,7 +510,7 @@ def get_archive_cmdlist_func (program, command, format): module = ProgramModules.get(key, key) # import archive handler function (eg. patoolib.programs.star.extract_tar) args = (module, command, format) - import_cmd = "from patoolib.programs.%s import %s_%s as func" % args + import_cmd = "from .programs.%s import %s_%s as func" % args try: exec import_cmd except ImportError: diff --git a/patoolib/programs/__init__.py b/patoolib/programs/__init__.py index b497d4d..96f004f 100644 --- a/patoolib/programs/__init__.py +++ b/patoolib/programs/__init__.py @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from patoolib import util +from .. import util def extract_singlefile_standard (archive, compression, cmd, **kwargs): """Standard routine to extract a singlefile archive (like gzip).""" diff --git a/patoolib/programs/bzip2.py b/patoolib/programs/bzip2.py index b8ec5ef..7ae8a32 100644 --- a/patoolib/programs/bzip2.py +++ b/patoolib/programs/bzip2.py @@ -14,9 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the bzip2 program.""" -from patoolib import util -from patoolib.programs import extract_singlefile_standard, \ - test_singlefile_standard +from .. import util +from . import extract_singlefile_standard, test_singlefile_standard extract_bzip2 = extract_singlefile_standard test_bzip2 = test_singlefile_standard diff --git a/patoolib/programs/clzip.py b/patoolib/programs/clzip.py index 554746f..a01fd5b 100644 --- a/patoolib/programs/clzip.py +++ b/patoolib/programs/clzip.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the clzip program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard diff --git a/patoolib/programs/compress.py b/patoolib/programs/compress.py index 7ea0d6f..f03abb8 100644 --- a/patoolib/programs/compress.py +++ b/patoolib/programs/compress.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the uncompress.real program.""" -from patoolib import util +from .. import util def create_compress (archive, compression, cmd, *args, **kwargs): diff --git a/patoolib/programs/cpio.py b/patoolib/programs/cpio.py index 382feef..84ece33 100644 --- a/patoolib/programs/cpio.py +++ b/patoolib/programs/cpio.py @@ -16,7 +16,7 @@ """Archive commands for the cpio program.""" import os import sys -from patoolib import util +from .. import util def extract_cpio (archive, compression, cmd, **kwargs): """Extract a CPIO archive.""" diff --git a/patoolib/programs/flac.py b/patoolib/programs/flac.py index fb08802..a7646f5 100644 --- a/patoolib/programs/flac.py +++ b/patoolib/programs/flac.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the flac program.""" -from patoolib import util +from .. import util def extract_flac (archive, compression, cmd, **kwargs): """Decompress a FLAC archive to a WAV file.""" diff --git a/patoolib/programs/gzip.py b/patoolib/programs/gzip.py index af910bf..cdf3306 100644 --- a/patoolib/programs/gzip.py +++ b/patoolib/programs/gzip.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the gzip program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard extract_gzip = extract_compress = extract_singlefile_standard diff --git a/patoolib/programs/lbzip2.py b/patoolib/programs/lbzip2.py index f1f3fd1..0a8f5e8 100644 --- a/patoolib/programs/lbzip2.py +++ b/patoolib/programs/lbzip2.py @@ -15,4 +15,4 @@ # along with this program. If not, see . """Archive commands for the pbzip2 program.""" # bzip2 and lbzip2 are compatible -from patoolib.programs.bzip2 import extract_bzip2, test_bzip2, create_bzip2 +from .bzip2 import extract_bzip2, test_bzip2, create_bzip2 diff --git a/patoolib/programs/lrzip.py b/patoolib/programs/lrzip.py index ba0cea4..586e172 100644 --- a/patoolib/programs/lrzip.py +++ b/patoolib/programs/lrzip.py @@ -15,7 +15,7 @@ # along with this program. If not, see . """Archive commands for the lrzip program.""" import os -from patoolib import util +from .. import util def extract_lrzip (archive, compression, cmd, **kwargs): """Extract a LRZIP archive.""" diff --git a/patoolib/programs/lzip.py b/patoolib/programs/lzip.py index 28fec36..2d08d48 100644 --- a/patoolib/programs/lzip.py +++ b/patoolib/programs/lzip.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the lzip program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard diff --git a/patoolib/programs/lzma.py b/patoolib/programs/lzma.py index fc4f008..1d39dec 100644 --- a/patoolib/programs/lzma.py +++ b/patoolib/programs/lzma.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the lzma program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard diff --git a/patoolib/programs/lzop.py b/patoolib/programs/lzop.py index ea16ebb..8018541 100644 --- a/patoolib/programs/lzop.py +++ b/patoolib/programs/lzop.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the lzop program.""" -from patoolib.programs import extract_singlefile_standard +from . import extract_singlefile_standard extract_lzop = extract_singlefile_standard diff --git a/patoolib/programs/mac.py b/patoolib/programs/mac.py index fe037b4..608b526 100644 --- a/patoolib/programs/mac.py +++ b/patoolib/programs/mac.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the MAC.exe program.""" -from patoolib import util +from .. import util def extract_ape (archive, compression, cmd, **kwargs): """Decompress an APE archive to a WAV file.""" diff --git a/patoolib/programs/pbzip2.py b/patoolib/programs/pbzip2.py index 876f95d..43cf57e 100644 --- a/patoolib/programs/pbzip2.py +++ b/patoolib/programs/pbzip2.py @@ -15,4 +15,4 @@ # along with this program. If not, see . """Archive commands for the pbzip2 program.""" # bzip2 and pbzip2 are compatible -from patoolib.programs.bzip2 import extract_bzip2, test_bzip2, create_bzip2 +from .bzip2 import extract_bzip2, test_bzip2, create_bzip2 diff --git a/patoolib/programs/pdlzip.py b/patoolib/programs/pdlzip.py index 554746f..a01fd5b 100644 --- a/patoolib/programs/pdlzip.py +++ b/patoolib/programs/pdlzip.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the clzip program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard diff --git a/patoolib/programs/pigz.py b/patoolib/programs/pigz.py index 9e66532..98cc75d 100644 --- a/patoolib/programs/pigz.py +++ b/patoolib/programs/pigz.py @@ -14,4 +14,4 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the pigz program.""" -from patoolib.programs.gzip import extract_gzip, test_gzip, create_gzip, list_gzip +from .gzip import extract_gzip, test_gzip, create_gzip, list_gzip diff --git a/patoolib/programs/plzip.py b/patoolib/programs/plzip.py index 47f60d0..99e1f9b 100644 --- a/patoolib/programs/plzip.py +++ b/patoolib/programs/plzip.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the plzip program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard diff --git a/patoolib/programs/py_bz2.py b/patoolib/programs/py_bz2.py index 606b75c..e84796d 100644 --- a/patoolib/programs/py_bz2.py +++ b/patoolib/programs/py_bz2.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the bz2 Python module.""" -from patoolib import util +from .. import util try: # try external bz2file module with multi-stream support import bz2file as bz2 diff --git a/patoolib/programs/py_echo.py b/patoolib/programs/py_echo.py index 7b73f8e..e5d0ed7 100644 --- a/patoolib/programs/py_echo.py +++ b/patoolib/programs/py_echo.py @@ -15,7 +15,7 @@ # along with this program. If not, see . """Archive commands echoing data, implemented by the Python print statement.""" -from patoolib import util +from .. import util def list_bzip2 (archive, compression, cmd, **kwargs): diff --git a/patoolib/programs/py_gzip.py b/patoolib/programs/py_gzip.py index 6b60e1b..debae30 100644 --- a/patoolib/programs/py_gzip.py +++ b/patoolib/programs/py_gzip.py @@ -17,7 +17,7 @@ from __future__ import absolute_import # now gzip refers to the Python standard module, not the local one import gzip -from patoolib import util +from .. import util READ_SIZE_BYTES = 1024*1024 diff --git a/patoolib/programs/py_tarfile.py b/patoolib/programs/py_tarfile.py index db6d9e1..e2b6e9b 100644 --- a/patoolib/programs/py_tarfile.py +++ b/patoolib/programs/py_tarfile.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the tarfile Python module.""" -from patoolib import util +from .. import util import tarfile READ_SIZE_BYTES = 1024*1024 diff --git a/patoolib/programs/py_zipfile.py b/patoolib/programs/py_zipfile.py index ec2862f..0b4f8d8 100644 --- a/patoolib/programs/py_zipfile.py +++ b/patoolib/programs/py_zipfile.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the zipfile Python module.""" -from patoolib import util +from .. import util import zipfile import os diff --git a/patoolib/programs/rpm2cpio.py b/patoolib/programs/rpm2cpio.py index f31521a..61ddf6b 100644 --- a/patoolib/programs/rpm2cpio.py +++ b/patoolib/programs/rpm2cpio.py @@ -15,7 +15,7 @@ # along with this program. If not, see . """Archive commands for the rpm2cpio program.""" import os -from patoolib import util +from .. import util def extract_rpm (archive, compression, cmd, **kwargs): """Extract a RPM archive.""" diff --git a/patoolib/programs/rzip.py b/patoolib/programs/rzip.py index d70ca5b..5f80a1a 100644 --- a/patoolib/programs/rzip.py +++ b/patoolib/programs/rzip.py @@ -15,7 +15,7 @@ # along with this program. If not, see . """Archive commands for the lrzip program.""" import os -from patoolib import util +from .. import util def extract_rzip (archive, compression, cmd, **kwargs): """Extract a RZIP archive.""" diff --git a/patoolib/programs/shar.py b/patoolib/programs/shar.py index d341404..f8033c4 100644 --- a/patoolib/programs/shar.py +++ b/patoolib/programs/shar.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the shar program.""" -from patoolib import util +from .. import util def create_shar (archive, compression, cmd, *args, **kwargs): """Create a SHAR archive.""" diff --git a/patoolib/programs/shorten.py b/patoolib/programs/shorten.py index 6b27f1c..ebfa254 100644 --- a/patoolib/programs/shorten.py +++ b/patoolib/programs/shorten.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the shorten program.""" -from patoolib import util +from .. import util def extract_shn (archive, compression, cmd, **kwargs): """Decompress a SHN archive to a WAV file.""" diff --git a/patoolib/programs/uncompress.py b/patoolib/programs/uncompress.py index 210a542..0981c60 100644 --- a/patoolib/programs/uncompress.py +++ b/patoolib/programs/uncompress.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the uncompress.real program.""" -from patoolib import util +from .. import util def extract_compress (archive, compression, cmd, **kwargs): diff --git a/patoolib/programs/xdms.py b/patoolib/programs/xdms.py index f3300ec..dfe659d 100644 --- a/patoolib/programs/xdms.py +++ b/patoolib/programs/xdms.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the xdms program.""" -from patoolib import util +from .. import util def extract_dms (archive, compression, cmd, **kwargs): diff --git a/patoolib/programs/xz.py b/patoolib/programs/xz.py index f90fb14..5023de7 100644 --- a/patoolib/programs/xz.py +++ b/patoolib/programs/xz.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the xz program.""" -from patoolib.programs import extract_singlefile_standard, \ +from . import extract_singlefile_standard, \ test_singlefile_standard, create_singlefile_standard diff --git a/patoolib/util.py b/patoolib/util.py index 0338db5..c6c64d1 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -169,7 +169,7 @@ def guess_mime_mimedb (filename): mime, encoding = None, None if mimedb is not None: mime, encoding = mimedb.guess_type(filename, strict=False) - from patoolib import ArchiveMimetypes, ArchiveCompressions + from . import ArchiveMimetypes, ArchiveCompressions if mime not in ArchiveMimetypes and encoding in ArchiveCompressions: # Files like 't.txt.gz' are recognized with encoding as format, and # an unsupported mime-type like 'text/plain'. Fix this. @@ -209,7 +209,7 @@ def guess_mime_file_mime (file_prog, filename): except OSError: # ignore errors, as file(1) is only a fallback return mime, encoding - from patoolib import ArchiveMimetypes + from . import ArchiveMimetypes if mime in Mime2Encoding: # try to look inside compressed archives cmd = [file_prog, "--brief", "--mime", "--uncompress", filename]