| 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="built-dist.html" /> |
| 12 | <link rel="prev" href="setup-config.html" /> |
| 13 | <link rel="parent" href="dist.html" /> |
| 14 | <link rel="next" href="manifest.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>4. Creating a Source Distribution</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="3. Writing the Setup" |
| 24 | href="setup-config.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="Distributing Python Modules" |
| 27 | href="dist.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="4.1 Specifying the files" |
| 30 | href="manifest.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="setup-config.html">3. Writing the Setup</A> |
| 44 | <b class="navlabel">Up:</b> |
| 45 | <a class="sectref" rel="parent" href="dist.html">Distributing Python Modules</A> |
| 46 | <b class="navlabel">Next:</b> |
| 47 | <a class="sectref" rel="next" href="manifest.html">4.1 Specifying the files</A> |
| 48 | </div> |
| 49 | <hr /></div> |
| 50 | </DIV> |
| 51 | <!--End of Navigation Panel--> |
| 52 | |
| 53 | <H1><A NAME="SECTION004000000000000000000"></A> |
| 54 | <A NAME="source-dist"></A> |
| 55 | <BR> |
| 56 | 4. Creating a Source Distribution |
| 57 | </H1> |
| 58 | |
| 59 | <P> |
| 60 | As shown in section <A href="simple-example.html#simple-example">1.2</A>, you use the |
| 61 | <code class="du-command">sdist</code> command to create a source distribution. In the |
| 62 | simplest case, |
| 63 | |
| 64 | <P> |
| 65 | <div class="verbatim"><pre> |
| 66 | python setup.py sdist |
| 67 | </pre></div> |
| 68 | |
| 69 | <P> |
| 70 | (assuming you haven't specified any <code class="du-command">sdist</code> options in the setup |
| 71 | script or config file), <code class="du-command">sdist</code> creates the archive of the |
| 72 | default format for the current platform. The default format is a gzip'ed |
| 73 | tar file (<span class="file">.tar.gz</span>) on <span class="Unix">Unix</span>, and ZIP file on Windows. |
| 74 | |
| 75 | <P> |
| 76 | You can specify as many formats as you like using the |
| 77 | <b class="programopt">--formats</b> option, for example: |
| 78 | |
| 79 | <P> |
| 80 | <div class="verbatim"><pre> |
| 81 | python setup.py sdist --formats=gztar,zip |
| 82 | </pre></div> |
| 83 | |
| 84 | <P> |
| 85 | to create a gzipped tarball and a zip file. The available formats are: |
| 86 | |
| 87 | <P> |
| 88 | <div class="center"><table class="realtable"> |
| 89 | <thead> |
| 90 | <tr> |
| 91 | <th class="left" >Format</th> |
| 92 | <th class="left" >Description</th> |
| 93 | <th class="center">Notes</th> |
| 94 | </tr> |
| 95 | </thead> |
| 96 | <tbody> |
| 97 | <tr><td class="left" valign="baseline"><code>zip</code></td> |
| 98 | <td class="left" >zip file (<span class="file">.zip</span>)</td> |
| 99 | <td class="center">(1),(3)</td></tr> |
| 100 | <tr><td class="left" valign="baseline"><code>gztar</code></td> |
| 101 | <td class="left" >gzip'ed tar file (<span class="file">.tar.gz</span>)</td> |
| 102 | <td class="center">(2),(4)</td></tr> |
| 103 | <tr><td class="left" valign="baseline"><code>bztar</code></td> |
| 104 | <td class="left" >bzip2'ed tar file (<span class="file">.tar.bz2</span>)</td> |
| 105 | <td class="center">(4)</td></tr> |
| 106 | <tr><td class="left" valign="baseline"><code>ztar</code></td> |
| 107 | <td class="left" >compressed tar file (<span class="file">.tar.Z</span>)</td> |
| 108 | <td class="center">(4)</td></tr> |
| 109 | <tr><td class="left" valign="baseline"><code>tar</code></td> |
| 110 | <td class="left" >tar file (<span class="file">.tar</span>)</td> |
| 111 | <td class="center">(4)</td></tr></tbody> |
| 112 | </table></div> |
| 113 | |
| 114 | <P> |
| 115 | Notes: |
| 116 | <DL> |
| 117 | <DT><STRONG>(1)</STRONG></DT> |
| 118 | <DD>default on Windows |
| 119 | </DD> |
| 120 | <DT><STRONG>(2)</STRONG></DT> |
| 121 | <DD>default on <span class="Unix">Unix</span> |
| 122 | </DD> |
| 123 | <DT><STRONG>(3)</STRONG></DT> |
| 124 | <DD>requires either external <b class="program">zip</b> utility or |
| 125 | <tt class="module">zipfile</tt> module (part of the standard Python library since |
| 126 | Python 1.6) |
| 127 | </DD> |
| 128 | <DT><STRONG>(4)</STRONG></DT> |
| 129 | <DD>requires external utilities: <b class="program">tar</b> and possibly one |
| 130 | of <b class="program">gzip</b>, <b class="program">bzip2</b>, or <b class="program">compress</b> |
| 131 | </DD> |
| 132 | </DL> |
| 133 | |
| 134 | <P> |
| 135 | |
| 136 | <p><br /></p><hr class='online-navigation' /> |
| 137 | <div class='online-navigation'> |
| 138 | <!--Table of Child-Links--> |
| 139 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 140 | |
| 141 | <UL CLASS="ChildLinks"> |
| 142 | <LI><A href="manifest.html">4.1 Specifying the files to distribute</a> |
| 143 | <LI><A href="manifest-options.html">4.2 Manifest-related options</a> |
| 144 | </ul> |
| 145 | <!--End of Table of Child-Links--> |
| 146 | </div> |
| 147 | |
| 148 | <DIV CLASS="navigation"> |
| 149 | <div class='online-navigation'> |
| 150 | <p></p><hr /> |
| 151 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 152 | <tr> |
| 153 | <td class='online-navigation'><a rel="prev" title="3. Writing the Setup" |
| 154 | href="setup-config.html"><img src='../icons/previous.png' |
| 155 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 156 | <td class='online-navigation'><a rel="parent" title="Distributing Python Modules" |
| 157 | href="dist.html"><img src='../icons/up.png' |
| 158 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 159 | <td class='online-navigation'><a rel="next" title="4.1 Specifying the files" |
| 160 | href="manifest.html"><img src='../icons/next.png' |
| 161 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 162 | <td align="center" width="100%">Distributing Python Modules</td> |
| 163 | <td class='online-navigation'><img src='../icons/blank.png' |
| 164 | border='0' height='32' alt='' width='32' /></td> |
| 165 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 166 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 167 | <td class='online-navigation'><a rel="index" title="Index" |
| 168 | href="genindex.html"><img src='../icons/index.png' |
| 169 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 170 | </tr></table> |
| 171 | <div class='online-navigation'> |
| 172 | <b class="navlabel">Previous:</b> |
| 173 | <a class="sectref" rel="prev" href="setup-config.html">3. Writing the Setup</A> |
| 174 | <b class="navlabel">Up:</b> |
| 175 | <a class="sectref" rel="parent" href="dist.html">Distributing Python Modules</A> |
| 176 | <b class="navlabel">Next:</b> |
| 177 | <a class="sectref" rel="next" href="manifest.html">4.1 Specifying the files</A> |
| 178 | </div> |
| 179 | </div> |
| 180 | <hr /> |
| 181 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 182 | </DIV> |
| 183 | <!--End of Navigation Panel--> |
| 184 | <ADDRESS> |
| 185 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 186 | </ADDRESS> |
| 187 | </BODY> |
| 188 | </HTML> |