Package distutils :: Module archive_util
[hide private]
[frames] | no frames]

Module archive_util

distutils.archive_util

Utility functions for creating archive files (tarballs, zip files, that sort of thing).

Functions [hide private]
 
make_tarball(base_name, base_dir, compress='gzip', verbose=0, dry_run=0)
Create a (possibly compressed) tar file from all the files under 'base_dir'.
 
make_zipfile(base_name, base_dir, verbose=0, dry_run=0)
Create a zip file from all the files under 'base_dir'.
 
check_archive_formats(formats)
 
make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0)
Create an archive file (eg.
Variables [hide private]
  __revision__ = '$Id: archive_util.py 37828 2004-11-10 22:23:15...
  ARCHIVE_FORMATS = {'gztar':(make_tarball, [('compress', 'gzip'...

Imports: os, DistutilsExecError, spawn, mkpath, log


Function Details [hide private]

make_tarball(base_name, base_dir, compress='gzip', verbose=0, dry_run=0)

 

Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "compress", "bzip2", or None. Both "tar" and the compression utility named by 'compress' must be on the default program search path, so this is probably Unix-specific. The output tar file will be named 'base_dir' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2" or ".Z"). Return the output filename.

make_zipfile(base_name, base_dir, verbose=0, dry_run=0)

 

Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file.

make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0)

 

Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "ztar", or "gztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the archive. 'base_dir' is the directory where we start archiving from; ie. 'base_dir' will be the common prefix of all files and directories in the archive. 'root_dir' and 'base_dir' both default to the current directory. Returns the name of the archive file.


Variables Details [hide private]

__revision__

Value:
'$Id: archive_util.py 37828 2004-11-10 22:23:15Z loewis $'

ARCHIVE_FORMATS

Value:
{'bztar': (<function make_tarball at 0x4122880c>,
           [('compress', 'bzip2')],
           'bzip2\'ed tar-file'),
 'gztar': (<function make_tarball at 0x4122880c>,
           [('compress', 'gzip')],
           'gzip\'ed tar-file'),
 'tar': (<function make_tarball at 0x4122880c>,
         [('compress', None)],
...