10.9 distutils.archive_util -- Archiving utilities
This module provides a few functions for creating archive files, such as tarballs or zipfiles.
-
Create an archive file (eg.
zip
ortar
). base_name is the name of the file to create, minus any format-specific extension; format is the archive format: one ofzip
,tar
,ztar
, orgztar
. root_dir is a directory that will be the root directory of the archive; ie. we typicallychdir
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.Warning: This should be changed to support bz2 files
- 'Create an (optional compressed) archive as a tar file from all files in and under base_dir. compress must be
'gzip'
(the default),'compress'
,'bzip2'
, orNone
. 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.Warning: This should be replaced with calls to the tarfile module.
- Create a zip file from all files in and 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.
See About this document... for information on suggesting changes.