<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"dist.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"dist.html" title='Distributing Python Modules'
/>
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"module-distutils.deputil.html" />
<link rel=
"prev" href=
"module-distutils.mwerkscompiler.html" />
<link rel=
"parent" href=
"api-reference.html" />
<link rel=
"next" href=
"module-distutils.deputil.html" />
<meta name='aesop' content='information'
/>
<title>10.9 distutils.archive_util -- Archiving utilities
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"10.8 distutils.mwerkscompiler "
href=
"module-distutils.mwerkscompiler.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"10. API Reference"
href=
"api-reference.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"10.10 distutils.dep_util "
href=
"module-distutils.deputil.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Distributing Python Modules
</td>
<td class='online-navigation'
><img src='../icons/blank.png'
border='
0' height='
32' alt='' width='
32'
/></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-distutils.mwerkscompiler.html">10.8 distutils.mwerkscompiler
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"api-reference.html">10. API Reference
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-distutils.deputil.html">10.10 distutils.dep_util
</A>
<!--End of Navigation Panel-->
<H1><A NAME=
"SECTION0010900000000000000000">
10.9 <tt class=
"module">distutils.archive_util
</tt> --
<A NAME=
"module-distutils.archiveutil"></A>
This module provides a few functions for creating archive files, such as
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
62' xml:id='l2h-
62'
class=
"function">make_archive
</tt></b>(
</nobr></td>
<td><var>base_name, format
</var><big>[
</big><var>, root_dir=
<code>None
</code>, base_dir=
<code>None
</code>, verbose=
<code>0</code>, dry_run=
<code>0</code></var><big>]
</big><var></var>)
</td></tr></table></dt>
Create an archive file (eg.
<code>zip
</code> or
<code>tar
</code>).
<var>base_name
</var>
is the name of the file to create, minus any format-specific extension;
<var>format
</var> is the archive format: one of
<code>zip
</code>,
<code>tar
</code>,
<code>ztar
</code>, or
<code>gztar
</code>.
<var>root_dir
</var> is a directory that will be the root directory of the
archive; ie. we typically
<code>chdir
</code> into
<var>root_dir
</var> before
creating the archive.
<var>base_dir
</var> is the directory where we start
archiving from; ie.
<var>base_dir
</var> will be the common prefix of all files and
directories in the archive.
<var>root_dir
</var> and
<var>base_dir
</var> both default
to the current directory. Returns the name of the archive file.
<span class=
"warning"><b class=
"label">Warning:
</b>
This should be changed to support bz2 files
</span>
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
63' xml:id='l2h-
63'
class=
"function">make_tarball
</tt></b>(
</nobr></td>
<td><var>base_name, base_dir
</var><big>[
</big><var>, compress=
<code>'gzip'
</code>, verbose=
<code>0</code>, dry_run=
<code>0</code></var><big>]
</big><var></var>)
</td></tr></table></dt>
<dd>'Create an (optional compressed) archive as a tar file from all files in and under
<var>base_dir
</var>.
<var>compress
</var> must be
<code>'gzip'
</code> (the default),
<code>'compress'
</code>,
<code>'bzip2'
</code>, or
<code>None
</code>. Both
<b class=
"program">tar
</b>
and the compression utility named by
<var>compress
</var> must be on the
default program search path, so this is probably
<span class=
"Unix">Unix
</span>-specific. The
output tar file will be named
<span class=
"file"><var>base_dir
</var>.tar
</span>, possibly plus
the appropriate compression extension (
<span class=
"file">.gz
</span>,
<span class=
"file">.bz2
</span> or
<span class=
"file">.Z
</span>). Return the output filename.
<span class=
"warning"><b class=
"label">Warning:
</b>
This should be replaced with calls to the
<tt class=
"module">tarfile
</tt> module.
</span>
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
64' xml:id='l2h-
64'
class=
"function">make_zipfile
</tt></b>(
</nobr></td>
<td><var>base_name, base_dir
</var><big>[
</big><var>, verbose=
<code>0</code>, dry_run=
<code>0</code></var><big>]
</big><var></var>)
</td></tr></table></dt>
Create a zip file from all files in and under
<var>base_dir
</var>. The output
zip file will be named
<var>base_dir
</var> +
<span class=
"file">.zip
</span>. Uses either the
<tt class=
"module">zipfile
</tt> Python module (if available) or the InfoZIP
<span class=
"file">zip
</span>
utility (if installed and found on the default search path). If neither
tool is available, raises
<tt class=
"exception">DistutilsExecError
</tt>.
Returns the name of the output zip file.
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"10.8 distutils.mwerkscompiler "
href=
"module-distutils.mwerkscompiler.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"10. API Reference"
href=
"api-reference.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"10.10 distutils.dep_util "
href=
"module-distutils.deputil.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Distributing Python Modules
</td>
<td class='online-navigation'
><img src='../icons/blank.png'
border='
0' height='
32' alt='' width='
32'
/></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-distutils.mwerkscompiler.html">10.8 distutils.mwerkscompiler
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"api-reference.html">10. API Reference
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-distutils.deputil.html">10.10 distutils.dep_util
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.