| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="dist.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="dist.html" title='Distributing Python Modules' /> |
| 8 | <link rel='index' href='genindex.html' title='Index' /> |
| 9 | <link rel='last' href='about.html' title='About this document...' /> |
| 10 | <link rel='help' href='about.html' title='About this document...' /> |
| 11 | <link rel="next" href="module-distutils.deputil.html" /> |
| 12 | <link rel="prev" href="module-distutils.mwerkscompiler.html" /> |
| 13 | <link rel="parent" href="api-reference.html" /> |
| 14 | <link rel="next" href="module-distutils.deputil.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>10.9 distutils.archive_util -- Archiving utilities</title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="10.8 distutils.mwerkscompiler " |
| 24 | href="module-distutils.mwerkscompiler.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="10. API Reference" |
| 27 | href="api-reference.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="10.10 distutils.dep_util " |
| 30 | href="module-distutils.deputil.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Distributing Python Modules</td> |
| 33 | <td class='online-navigation'><img src='../icons/blank.png' |
| 34 | border='0' height='32' alt='' width='32' /></td> |
| 35 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 36 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 37 | <td class='online-navigation'><a rel="index" title="Index" |
| 38 | href="genindex.html"><img src='../icons/index.png' |
| 39 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 40 | </tr></table> |
| 41 | <div class='online-navigation'> |
| 42 | <b class="navlabel">Previous:</b> |
| 43 | <a class="sectref" rel="prev" href="module-distutils.mwerkscompiler.html">10.8 distutils.mwerkscompiler </A> |
| 44 | <b class="navlabel">Up:</b> |
| 45 | <a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A> |
| 46 | <b class="navlabel">Next:</b> |
| 47 | <a class="sectref" rel="next" href="module-distutils.deputil.html">10.10 distutils.dep_util </A> |
| 48 | </div> |
| 49 | <hr /></div> |
| 50 | </DIV> |
| 51 | <!--End of Navigation Panel--> |
| 52 | |
| 53 | <H1><A NAME="SECTION0010900000000000000000"> |
| 54 | 10.9 <tt class="module">distutils.archive_util</tt> -- |
| 55 | Archiving utilities</A> |
| 56 | </H1> |
| 57 | <A NAME="module-distutils.archiveutil"></A> |
| 58 | |
| 59 | <P> |
| 60 | This module provides a few functions for creating archive files, such as |
| 61 | tarballs or zipfiles. |
| 62 | |
| 63 | <P> |
| 64 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 65 | <td><nobr><b><tt id='l2h-62' xml:id='l2h-62' class="function">make_archive</tt></b>(</nobr></td> |
| 66 | <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> |
| 67 | <dd> |
| 68 | Create an archive file (eg. <code>zip</code> or <code>tar</code>). <var>base_name</var> |
| 69 | is the name of the file to create, minus any format-specific extension; |
| 70 | <var>format</var> is the archive format: one of <code>zip</code>, <code>tar</code>, |
| 71 | <code>ztar</code>, or <code>gztar</code>. |
| 72 | <var>root_dir</var> is a directory that will be the root directory of the |
| 73 | archive; ie. we typically <code>chdir</code> into <var>root_dir</var> before |
| 74 | creating the archive. <var>base_dir</var> is the directory where we start |
| 75 | archiving from; ie. <var>base_dir</var> will be the common prefix of all files and |
| 76 | directories in the archive. <var>root_dir</var> and <var>base_dir</var> both default |
| 77 | to the current directory. Returns the name of the archive file. |
| 78 | |
| 79 | <P> |
| 80 | <span class="warning"><b class="label">Warning:</b> |
| 81 | This should be changed to support bz2 files</span> |
| 82 | </dl> |
| 83 | |
| 84 | <P> |
| 85 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 86 | <td><nobr><b><tt id='l2h-63' xml:id='l2h-63' class="function">make_tarball</tt></b>(</nobr></td> |
| 87 | <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> |
| 88 | <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), |
| 89 | <code>'compress'</code>, <code>'bzip2'</code>, or <code>None</code>. Both <b class="program">tar</b> |
| 90 | and the compression utility named by <var>compress</var> must be on the |
| 91 | default program search path, so this is probably <span class="Unix">Unix</span>-specific. The |
| 92 | output tar file will be named <span class="file"><var>base_dir</var>.tar</span>, possibly plus |
| 93 | the appropriate compression extension (<span class="file">.gz</span>, <span class="file">.bz2</span> or |
| 94 | <span class="file">.Z</span>). Return the output filename. |
| 95 | |
| 96 | <P> |
| 97 | <span class="warning"><b class="label">Warning:</b> |
| 98 | This should be replaced with calls to the <tt class="module">tarfile</tt> module.</span> |
| 99 | </dl> |
| 100 | |
| 101 | <P> |
| 102 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 103 | <td><nobr><b><tt id='l2h-64' xml:id='l2h-64' class="function">make_zipfile</tt></b>(</nobr></td> |
| 104 | <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> |
| 105 | <dd> |
| 106 | Create a zip file from all files in and under <var>base_dir</var>. The output |
| 107 | zip file will be named <var>base_dir</var> + <span class="file">.zip</span>. Uses either the |
| 108 | <tt class="module">zipfile</tt> Python module (if available) or the InfoZIP <span class="file">zip</span> |
| 109 | utility (if installed and found on the default search path). If neither |
| 110 | tool is available, raises <tt class="exception">DistutilsExecError</tt>. |
| 111 | Returns the name of the output zip file. |
| 112 | </dl> |
| 113 | |
| 114 | <P> |
| 115 | |
| 116 | <DIV CLASS="navigation"> |
| 117 | <div class='online-navigation'> |
| 118 | <p></p><hr /> |
| 119 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 120 | <tr> |
| 121 | <td class='online-navigation'><a rel="prev" title="10.8 distutils.mwerkscompiler " |
| 122 | href="module-distutils.mwerkscompiler.html"><img src='../icons/previous.png' |
| 123 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 124 | <td class='online-navigation'><a rel="parent" title="10. API Reference" |
| 125 | href="api-reference.html"><img src='../icons/up.png' |
| 126 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 127 | <td class='online-navigation'><a rel="next" title="10.10 distutils.dep_util " |
| 128 | href="module-distutils.deputil.html"><img src='../icons/next.png' |
| 129 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 130 | <td align="center" width="100%">Distributing Python Modules</td> |
| 131 | <td class='online-navigation'><img src='../icons/blank.png' |
| 132 | border='0' height='32' alt='' width='32' /></td> |
| 133 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 134 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 135 | <td class='online-navigation'><a rel="index" title="Index" |
| 136 | href="genindex.html"><img src='../icons/index.png' |
| 137 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 138 | </tr></table> |
| 139 | <div class='online-navigation'> |
| 140 | <b class="navlabel">Previous:</b> |
| 141 | <a class="sectref" rel="prev" href="module-distutils.mwerkscompiler.html">10.8 distutils.mwerkscompiler </A> |
| 142 | <b class="navlabel">Up:</b> |
| 143 | <a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A> |
| 144 | <b class="navlabel">Next:</b> |
| 145 | <a class="sectref" rel="next" href="module-distutils.deputil.html">10.10 distutils.dep_util </A> |
| 146 | </div> |
| 147 | </div> |
| 148 | <hr /> |
| 149 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 150 | </DIV> |
| 151 | <!--End of Navigation Panel--> |
| 152 | <ADDRESS> |
| 153 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 154 | </ADDRESS> |
| 155 | </BODY> |
| 156 | </HTML> |