Require and use Python >= 2.5
This commit is contained in:
parent
14cfeb9607
commit
e65fff3f7f
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
3
patool
3
patool
|
@ -17,9 +17,6 @@
|
|||
"""
|
||||
patool [extract|list|create|formats] [sub-command-options] <command-args>
|
||||
"""
|
||||
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
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
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:
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
|
||||
def extract_singlefile_standard (archive, compression, cmd, **kwargs):
|
||||
"""Standard routine to extract a singlefile archive (like gzip)."""
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the clzip program."""
|
||||
from patoolib.programs import extract_singlefile_standard, \
|
||||
from . import extract_singlefile_standard, \
|
||||
test_singlefile_standard, create_singlefile_standard
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the uncompress.real program."""
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
|
||||
|
||||
def create_compress (archive, compression, cmd, *args, **kwargs):
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the lzip program."""
|
||||
from patoolib.programs import extract_singlefile_standard, \
|
||||
from . import extract_singlefile_standard, \
|
||||
test_singlefile_standard, create_singlefile_standard
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the lzma program."""
|
||||
from patoolib.programs import extract_singlefile_standard, \
|
||||
from . import extract_singlefile_standard, \
|
||||
test_singlefile_standard, create_singlefile_standard
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the lzop program."""
|
||||
from patoolib.programs import extract_singlefile_standard
|
||||
from . import extract_singlefile_standard
|
||||
|
||||
|
||||
extract_lzop = extract_singlefile_standard
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the clzip program."""
|
||||
from patoolib.programs import extract_singlefile_standard, \
|
||||
from . import extract_singlefile_standard, \
|
||||
test_singlefile_standard, create_singlefile_standard
|
||||
|
||||
|
||||
|
|
|
@ -14,4 +14,4 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the plzip program."""
|
||||
from patoolib.programs import extract_singlefile_standard, \
|
||||
from . import extract_singlefile_standard, \
|
||||
test_singlefile_standard, create_singlefile_standard
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands echoing data, implemented by the Python print
|
||||
statement."""
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
|
||||
|
||||
def list_bzip2 (archive, compression, cmd, **kwargs):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the tarfile Python module."""
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
import tarfile
|
||||
|
||||
READ_SIZE_BYTES = 1024*1024
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the zipfile Python module."""
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
import zipfile
|
||||
import os
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""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."""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the uncompress.real program."""
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
|
||||
|
||||
def extract_compress (archive, compression, cmd, **kwargs):
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the xdms program."""
|
||||
from patoolib import util
|
||||
from .. import util
|
||||
|
||||
|
||||
def extract_dms (archive, compression, cmd, **kwargs):
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the xz program."""
|
||||
from patoolib.programs import extract_singlefile_standard, \
|
||||
from . import extract_singlefile_standard, \
|
||||
test_singlefile_standard, create_singlefile_standard
|
||||
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue