Merge pull request #105 from a1346054/master

Minor cleanup
This commit is contained in:
Yaroslav Halchenko 2022-02-09 21:27:10 -05:00 committed by GitHub
commit 9dc8fab254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 82 additions and 87 deletions

22
COPYING
View File

@ -1,12 +1,11 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
GNU GENERAL PUBLIC LICENSE Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The GNU General Public License is a free, copyleft license for The GNU General Public License is a free, copyleft license for
software and other kinds of works. software and other kinds of works.
@ -69,7 +68,7 @@ patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
TERMS AND CONDITIONS TERMS AND CONDITIONS
0. Definitions. 0. Definitions.
@ -619,9 +618,9 @@ an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee. copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it possible use to the public, the best way to achieve this is to make it
@ -646,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
@ -665,12 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school, You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>. <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -45,7 +45,7 @@ update_webmeta:
git cm "Updated web meta data." git cm "Updated web meta data."
homepage: update_webmeta homepage: update_webmeta
# relase website # release website
$(MAKE) -C doc/web release $(MAKE) -C doc/web release
tag: tag:

View File

@ -8,15 +8,15 @@ searched, repacked and compared with patool. The advantage of patool is
its simplicity in handling archive files without having to remember a its simplicity in handling archive files without having to remember a
myriad of programs and options. myriad of programs and options.
The archive format is determined by the file(1) program and as The archive format is determined by the file(1) program and as
a fallback by the archive file extension. a fallback by the archive file extension.
patool supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf), ALZIP (.alz), patool supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf), ALZIP (.alz),
APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2),
CAB (.cab), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), CAB (.cab), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms),
FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh), FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh),
LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar, .cbr), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar, .cbr),
RZIP (.rz), SHN (.shn), TAR (.tar, .cbt), XZ (.xz), RZIP (.rz), SHN (.shn), TAR (.tar, .cbt), XZ (.xz),
ZIP (.zip, .jar, .cbz) and ZOO (.zoo) archive formats. ZIP (.zip, .jar, .cbz) and ZOO (.zoo) archive formats.
It relies on helper applications to handle those archive formats It relies on helper applications to handle those archive formats
(for example bzip2 for BZIP2 archives). (for example bzip2 for BZIP2 archives).
@ -57,7 +57,7 @@ patool repack linux-2.6.33.tar.gz linux-2.6.33.tar.bz2
Website Website
-------- --------
See http://wummel.github.io/patool/ for more info and downloads. See https://wummel.github.io/patool/ for more info and downloads.
API API
---- ----

View File

@ -3,7 +3,7 @@ Installation
First, install the required software. First, install the required software.
1. Python >= 2.7 from http://www.python.org/ 1. Python >= 2.7 from https://www.python.org/
Now install the application. Now install the application.
@ -21,7 +21,7 @@ Now install the application.
b) Installation as a normal user b) Installation as a normal user
Run ``python setup.py install --home $HOME``. Note that you have Run ``python setup.py install --home $HOME``. Note that you have
to adjust your PATH and PYTHONPATH environment variables, eg. by to adjust your PATH and PYTHONPATH environment variables, e.g. by
adding the commands ``export PYTHONPATH=$HOME/lib/python`` and adding the commands ``export PYTHONPATH=$HOME/lib/python`` and
``export PATH=$PATH:$HOME/bin`` to your shell configuration ``export PATH=$PATH:$HOME/bin`` to your shell configuration
file. file.

View File

@ -56,7 +56,7 @@ of helper applications. Can be given multiple times to increase
the output even more. the output even more.
.TP .TP
\fB\-\-non\-interactive\fP \fB\-\-non\-interactive\fP
Try to prevent any interactive user input (ie. prompting for passwords Try to prevent any interactive user input (i.e. prompting for passwords
or for overwriting duplicate files). Use this option with care since or for overwriting duplicate files). Use this option with care since
overwriting files or ignoring password prompts could lead to unintended overwriting files or ignoring password prompts could lead to unintended
consequences. consequences.
@ -72,7 +72,7 @@ The original archive will never be removed.
.IP "\(bu" 4 .IP "\(bu" 4
Files outside the output directory will never be created. This relies on Files outside the output directory will never be created. This relies on
archive program options to prevent unpacking of files with an absolute archive program options to prevent unpacking of files with an absolute
path name (eg. \fB\-\-no\-absolute\-filenames\fP for \fBcpio(1)\fP). path name (e.g. \fB\-\-no\-absolute\-filenames\fP for \fBcpio(1)\fP).
.PP .PP
The following commands are available. The following commands are available.
.SS extract .SS extract
@ -138,7 +138,7 @@ not smaller, the archive is left unchanged.
.SS formats .SS formats
\fBpatool\fP \fBformats\fP \fBpatool\fP \fBformats\fP
.PP .PP
Show all supported archive formats (ie. which helper applications Show all supported archive formats (i.e. which helper applications
are available). are available).
.SH HELP OPTION .SH HELP OPTION
Specifying the help option displays help for patool itself, or a Specifying the help option displays help for patool itself, or a

View File

@ -4,7 +4,7 @@ slug: index
--- ---
Introduction Introduction
------------- -------------
[![XKCD Tar comic](http://imgs.xkcd.com/comics/tar.png)](http://xkcd.com/1168/) [![XKCD Tar comic](https://imgs.xkcd.com/comics/tar.png)](https://xkcd.com/1168/)
I could never remember the correct options for all those different compression I could never remember the correct options for all those different compression
programs. Tar, unzip, gzip - you name it and I forgot it. programs. Tar, unzip, gzip - you name it and I forgot it.

2
patool
View File

@ -159,7 +159,7 @@ def create_argparser():
epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter) epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('--verbose', '-v', action='count', default=0, dest='verbosity', help="verbose operation; can be given multiple times") parser.add_argument('--verbose', '-v', action='count', default=0, dest='verbosity', help="verbose operation; can be given multiple times")
parser.add_argument('--non-interactive', dest='interactive', default=True, action='store_false', parser.add_argument('--non-interactive', dest='interactive', default=True, action='store_false',
help="don't query for user input (ie. passwords or when overwriting duplicate files); use with care since overwriting files or ignoring passwords could be unintended") help="don't query for user input (i.e. passwords or when overwriting duplicate files); use with care since overwriting files or ignoring passwords could be unintended")
subparsers = parser.add_subparsers(help='the archive command; type "patool COMMAND -h" for command-specific help', dest='command') subparsers = parser.add_subparsers(help='the archive command; type "patool COMMAND -h" for command-specific help', dest='command')
# extract # extract
parser_extract = subparsers.add_parser('extract', help='extract one or more archives') parser_extract = subparsers.add_parser('extract', help='extract one or more archives')

View File

@ -361,7 +361,7 @@ def check_archive_format (format, compression):
if format not in ArchiveFormats: if format not in ArchiveFormats:
raise util.PatoolError("unknown archive format `%s'" % format) raise util.PatoolError("unknown archive format `%s'" % format)
if compression is not None and compression not in ArchiveCompressions: if compression is not None and compression not in ArchiveCompressions:
raise util.PatoolError("unkonwn archive compression `%s'" % compression) raise util.PatoolError("unknown archive compression `%s'" % compression)
def find_archive_program (format, command, program=None, password=None): def find_archive_program (format, command, program=None, password=None):
@ -546,7 +546,7 @@ def _extract_archive(archive, verbosity=0, interactive=True, outdir=None,
cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, outdir, password=password) cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, outdir, password=password)
if cmdlist: if cmdlist:
# an empty command list means the get_archive_cmdlist() function # an empty command list means the get_archive_cmdlist() function
# already handled the command (eg. when it's a builtin Python # already handled the command (e.g. when it's a builtin Python
# function) # function)
run_archive_cmdlist(cmdlist, verbosity=verbosity) run_archive_cmdlist(cmdlist, verbosity=verbosity)
if do_cleanup_outdir: if do_cleanup_outdir:
@ -583,7 +583,7 @@ def _create_archive(archive, filenames, verbosity=0, interactive=True,
cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, filenames, password=password) cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, filenames, password=password)
if cmdlist: if cmdlist:
# an empty command list means the get_archive_cmdlist() function # an empty command list means the get_archive_cmdlist() function
# already handled the command (eg. when it's a builtin Python # already handled the command (e.g. when it's a builtin Python
# function) # function)
run_archive_cmdlist(cmdlist, verbosity=verbosity) run_archive_cmdlist(cmdlist, verbosity=verbosity)
if origarchive: if origarchive:
@ -605,7 +605,7 @@ def _handle_archive(archive, command, verbosity=0, interactive=True,
cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, password=password) cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, password=password)
if cmdlist: if cmdlist:
# an empty command list means the get_archive_cmdlist() function # an empty command list means the get_archive_cmdlist() function
# already handled the command (eg. when it's a builtin Python # already handled the command (e.g. when it's a builtin Python
# function) # function)
run_archive_cmdlist(cmdlist, verbosity=verbosity) run_archive_cmdlist(cmdlist, verbosity=verbosity)
@ -620,7 +620,7 @@ def get_archive_cmdlist_func (program, command, format):
module = importlib.import_module(modulename, __name__) module = importlib.import_module(modulename, __name__)
except ImportError as msg: except ImportError as msg:
raise util.PatoolError(msg) raise util.PatoolError(msg)
# get archive handler function (eg. patoolib.programs.star.extract_tar) # get archive handler function (e.g. patoolib.programs.star.extract_tar)
try: try:
archive_cmdlist_func = getattr(module, '%s_%s' % (command, format)) archive_cmdlist_func = getattr(module, '%s_%s' % (command, format))
def check_for_password_before_cmdlist_func_call(*args, **kwargs): def check_for_password_before_cmdlist_func_call(*args, **kwargs):
@ -723,7 +723,7 @@ def _recompress_archive(archive, verbosity=0, interactive=True, password=None):
"""Try to recompress an archive to smaller size.""" """Try to recompress an archive to smaller size."""
format, compression = get_archive_format(archive) format, compression = get_archive_format(archive)
if compression: if compression:
# only recompress the compression itself (eg. for .tar.xz) # only recompress the compression itself (e.g. for .tar.xz)
format = compression format = compression
tmpdir = util.tmpdir() tmpdir = util.tmpdir()
tmpdir2 = util.tmpdir() tmpdir2 = util.tmpdir()

View File

@ -15,4 +15,3 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the bsdcpio program.""" """Archive commands for the bsdcpio program."""
from .cpio import extract_cpio, list_cpio, test_cpio, create_cpio from .cpio import extract_cpio, list_cpio, test_cpio, create_cpio

View File

@ -15,4 +15,3 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the lhasa program.""" """Archive commands for the lhasa program."""
from .lha import extract_lzh from .lha import extract_lzh

View File

@ -29,7 +29,7 @@ def extract_7z(archive, compression, cmd, verbosity, interactive, outdir, passwo
return cmdlist return cmdlist
def extract_7z_singlefile(archive, compression, cmd, verbosity, interactive, outdir, password=None): def extract_7z_singlefile(archive, compression, cmd, verbosity, interactive, outdir, password=None):
"""Extract a singlefile archive (eg. gzip or bzip2) with '7z e'. """Extract a singlefile archive (e.g. gzip or bzip2) with '7z e'.
This makes sure a single file and no subdirectories are created, This makes sure a single file and no subdirectories are created,
which would cause errors with patool repack.""" which would cause errors with patool repack."""
cmdlist = [cmd, 'e'] cmdlist = [cmd, 'e']

View File

@ -36,4 +36,3 @@ def create_zpaq(archive, compression, cmd, verbosity, interactive, filenames):
# zpaq has no separate test mode, so use listing instead # zpaq has no separate test mode, so use listing instead
test_zpaq = list_zpaq test_zpaq = list_zpaq

View File

@ -477,7 +477,7 @@ def tmpfile (dir=None, prefix="temp", suffix=None):
def shell_quote (value): def shell_quote (value):
"""Quote all shell metacharacters in given string value with strong """Quote all shell metacharacters in given string value with strong
(ie. single) quotes, handling the single quote especially.""" (i.e. single) quotes, handling the single quote especially."""
if os.name == 'nt': if os.name == 'nt':
return shell_quote_nt(value) return shell_quote_nt(value)
return "'%s'" % value.replace("'", r"'\''") return "'%s'" % value.replace("'", r"'\''")
@ -670,7 +670,7 @@ def strlist_with_or (alist):
def is_same_file (filename1, filename2): def is_same_file (filename1, filename2):
"""Check if filename1 and filename2 point to the same file object. """Check if filename1 and filename2 point to the same file object.
There can be false negatives, ie. the result is False, but it is There can be false negatives, i.e. the result is False, but it is
the same file anyway. Reason is that network filesystems can create the same file anyway. Reason is that network filesystems can create
different paths to the same physical file. different paths to the same physical file.
""" """

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
# -*- coding: iso-8859-1 -*- # -*- coding: iso-8859-1 -*-
# Copyright (C) 2010-2016 Bastian Kleineidam # Copyright (C) 2010-2016 Bastian Kleineidam
# #
@ -53,7 +53,7 @@ def cnormpath (path):
release_ro = re.compile(r"\(released (.+)\)") release_ro = re.compile(r"\(released (.+)\)")
def get_release_date (): def get_release_date ():
"""Parse and return relase date as string from doc/changelog.txt.""" """Parse and return release date as string from doc/changelog.txt."""
fname = os.path.join("doc", "changelog.txt") fname = os.path.join("doc", "changelog.txt")
release_date = "unknown" release_date = "unknown"
with open(fname) as fd: with open(fname) as fd:
@ -209,7 +209,7 @@ installed.
maintainer = MyName, maintainer = MyName,
maintainer_email = MyEmail, maintainer_email = MyEmail,
license = "GPL", license = "GPL",
url = "http://wummel.github.io/patool/", url = "https://wummel.github.io/patool/",
packages = ['patoolib', 'patoolib.programs'], packages = ['patoolib', 'patoolib.programs'],
data_files = data_files, data_files = data_files,
scripts = ['patool'], scripts = ['patool'],

View File

@ -46,7 +46,7 @@ class TestTar (ArchiveTest):
self.archive_commands('t.tar.lzma') self.archive_commands('t.tar.lzma')
# even though clzip would support extracting .lz files, the # even though clzip would support extracting .lz files, the
# file(1) --uncompress command does not use it for achive detection # file(1) --uncompress command does not use it for archive detection
@needs_program(program) @needs_program(program)
@needs_program('lzip') @needs_program('lzip')
def test_tar_lzip (self): def test_tar_lzip (self):
@ -88,7 +88,7 @@ class TestTar (ArchiveTest):
# self.archive_commands('t.tar.lzma.foo', format="tar", compression="lzma") # self.archive_commands('t.tar.lzma.foo', format="tar", compression="lzma")
# even though clzip would support extracting .lz files, the # even though clzip would support extracting .lz files, the
# file(1) --uncompress command does not use it for achive detection # file(1) --uncompress command does not use it for archive detection
@needs_program('lzip') @needs_program('lzip')
@needs_program('file') @needs_program('file')
@needs_codec(program, 'lzip') @needs_codec(program, 'lzip')