Updated development docs.

[ci skip]
This commit is contained in:
Bastian Kleineidam 2013-02-28 21:58:37 +01:00
parent 9dd9267e49
commit 1caca14f2c
1 changed files with 28 additions and 29 deletions

View File

@ -6,15 +6,15 @@ To do this, install the patool program, import the library and
use one or more of the convenience functions. use one or more of the convenience functions.
import patoolib import patoolib
if patoolib.extract("myarchive.zip", verbose=True) == 0: try:
print "Success." patoolib.extract("myarchive.zip", verbose=True)
else: print("Success.")
print "Error." except patoolib.util.PatoolError as msg:
print("Error:", msg)
General rules for all convenience functions: General rules for all convenience functions:
* All convenience function return zero when no error occurred, else * All convenience functions raise PatoolError on errors.
an integer unequal zero.
* Error messages are printed on stderr, informative messages * Error messages are printed on stderr, informative messages
are printed on stdout. are printed on stdout.
@ -24,55 +24,54 @@ General rules for all convenience functions:
* Filenames can be relative or absolute. * Filenames can be relative or absolute.
* If verbosity is increased, additional output of the archive
program is shown.
* Usually the program to be executed is automatically determined
but it can be set manually with the program parameter.
The convenience functions are: The convenience functions are:
* ``def extract(archive, verbose=False, outdir=None)`` * ``def extract_archive(archive, verbosity=0, outdir=None, program=None)``
Extracts the given archive filename to the current working directory Extracts the given archive filename to the current working directory
or if specified to the given directory name in outdir. or if specified to the given directory name in outdir.
If verbose operation is set to True, additional output of the archive
program is shown.
Checks that the archive exists and is readable before extracting it. Checks that the archive exists and is readable before extracting it.
* ``def list(archive, verbose=False)`` * ``def list_archive(archive, verbosity=1, program=None)``
Lists the contents of the given archive filename on stdout. Lists the contents of the given archive filename on stdout.
If verbose operation is set to True, additional output of the archive
program is shown.
Checks that the archive exists and is readable before listing it. Checks that the archive exists and is readable before listing it.
* ``def test(archive, verbose=False)`` * ``def test_archive(archive, verbosity=0, program=None)``
Tests the given archive filename. Tests the given archive filename.
If verbose operation is set to True, additional output of the archive
program is shown.
Checks that the archive exists and is readable before testing it. Checks that the archive exists and is readable before testing it.
* ``def create(archive, *filenames, **kwargs)`` * ``def create_archive(archive, filenames, verbosity=0, program=None)``
Creates a new archive. The type of archive is determined Creates a new archive. The type of archive is determined
by the archive filename extension. by the archive filename extension.
If verbose operation is set to True, additional output of the archive
program is shown.
Checks that the archive is not already existing to avoid overwriting it. Checks that the archive is not already existing to avoid overwriting it.
Also checks that the filename list is not empty and that all files exist Also checks that the filename list is not empty and that all files exist
and are readable. and are readable.
* ``def diff(archive1, archive2, verbose=False)`` * ``diff_archives(archive1, archive2, verbosity=0)``
This function lists differences in the content of the two archives. This function lists differences in the content of the two archives.
Both archives are extracted and the contents are compared Both archives are extracted and the contents are compared
recursively with the diff(1) program. recursively with the diff(1) program.
If verbose operation is set to True, additional output of the archive
program is shown.
Checks that both archives exist and are readable. Checks that both archives exist and are readable.
* ``def repack(archive1, archive2, verbose=False)`` * ``def search_archive(pattern, archive, verbosity=0)``
This function extracts the contents of archive1 and packs them This function searches the given pattern in the archive file contents
into archive2. with grep(1).
If verbose operation is set to True, additional output of the archive Checks that archive exists and is readable.
program is shown.
Checks that archive1 exists and is readable. Also checks that
archive2 does not exist to avoid overwriting it.
* ``repack_archive (archive, archive_new, verbosity=0)``
This function extracts the contents of the archive and packs them
into archive_new.
Checks that archive exists and is readable. Also checks that
archive_new does not exist to avoid overwriting it.