MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/share/doc/python-docs-2.4.3/html/dist/source-dist.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<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="built-dist.html" />
<link rel="prev" href="setup-config.html" />
<link rel="parent" href="dist.html" />
<link rel="next" href="manifest.html" />
<meta name='aesop' content='information' />
<title>4. Creating a Source Distribution</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="3. Writing the Setup"
  href="setup-config.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="Distributing Python Modules"
  href="dist.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="4.1 Specifying the files"
  href="manifest.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>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="setup-config.html">3. Writing the Setup</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="dist.html">Distributing Python Modules</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="manifest.html">4.1 Specifying the files</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION004000000000000000000"></A>
<A NAME="source-dist"></A>
<BR>
4. Creating a Source Distribution
</H1>

<P>
As shown in section&nbsp;<A href="simple-example.html#simple-example">1.2</A>, you use the
<code class="du-command">sdist</code> command to create a source distribution.  In the
simplest case,

<P>
<div class="verbatim"><pre>
python setup.py sdist
</pre></div>

<P>
(assuming you haven't specified any <code class="du-command">sdist</code> options in the setup
script or config file), <code class="du-command">sdist</code> creates the archive of the
default format for the current platform.  The default format is a gzip'ed
tar file (<span class="file">.tar.gz</span>) on <span class="Unix">Unix</span>, and ZIP file on Windows.

<P>
You can specify as many formats as you like using the
<b class="programopt">--formats</b> option, for example:

<P>
<div class="verbatim"><pre>
python setup.py sdist --formats=gztar,zip
</pre></div>

<P>
to create a gzipped tarball and a zip file.  The available formats are:

<P>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Format</th>
      <th class="left"  >Description</th>
      <th class="center">Notes</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline"><code>zip</code></td>
        <td class="left"  >zip file (<span class="file">.zip</span>)</td>
        <td class="center">(1),(3)</td></tr>
    <tr><td class="left"   valign="baseline"><code>gztar</code></td>
        <td class="left"  >gzip'ed tar file (<span class="file">.tar.gz</span>)</td>
        <td class="center">(2),(4)</td></tr>
    <tr><td class="left"   valign="baseline"><code>bztar</code></td>
        <td class="left"  >bzip2'ed tar file (<span class="file">.tar.bz2</span>)</td>
        <td class="center">(4)</td></tr>
    <tr><td class="left"   valign="baseline"><code>ztar</code></td>
        <td class="left"  >compressed tar file (<span class="file">.tar.Z</span>)</td>
        <td class="center">(4)</td></tr>
    <tr><td class="left"   valign="baseline"><code>tar</code></td>
        <td class="left"  >tar file (<span class="file">.tar</span>)</td>
        <td class="center">(4)</td></tr></tbody>
</table></div>

<P>
Notes:
<DL>
<DT><STRONG>(1)</STRONG></DT>
<DD>default on Windows
</DD>
<DT><STRONG>(2)</STRONG></DT>
<DD>default on <span class="Unix">Unix</span>
</DD>
<DT><STRONG>(3)</STRONG></DT>
<DD>requires either external <b class="program">zip</b> utility or
  <tt class="module">zipfile</tt> module (part of the standard Python library since
  Python&nbsp;1.6)
</DD>
<DT><STRONG>(4)</STRONG></DT>
<DD>requires external utilities: <b class="program">tar</b> and possibly one
  of <b class="program">gzip</b>, <b class="program">bzip2</b>, or <b class="program">compress</b>
</DD>
</DL>

<P>

<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>

<UL CLASS="ChildLinks">
<LI><A href="manifest.html">4.1 Specifying the files to distribute</a>
<LI><A href="manifest-options.html">4.2 Manifest-related options</a>
</ul>
<!--End of Table of Child-Links-->
</div>

<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="3. Writing the Setup"
  href="setup-config.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="Distributing Python Modules"
  href="dist.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="4.1 Specifying the files"
  href="manifest.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>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="setup-config.html">3. Writing the Setup</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="dist.html">Distributing Python Modules</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="manifest.html">4.1 Specifying the files</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.3, documentation updated on 29 March 2006.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>