<!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=
"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>
<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=
"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>
<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>
<!--End of Navigation Panel-->
<H1><A NAME=
"SECTION004000000000000000000"></A>
<A NAME=
"source-dist"></A>
4. Creating a Source Distribution
As shown in section
<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
<div class=
"verbatim"><pre>
(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.
You can specify as many formats as you like using the
<b class=
"programopt">--formats
</b> option, for example:
<div class=
"verbatim"><pre>
python setup.py sdist --formats=gztar,zip
to create a gzipped tarball and a zip file. The available formats are:
<div class=
"center"><table class=
"realtable">
<th class=
"left" >Format
</th>
<th class=
"left" >Description
</th>
<th class=
"center">Notes
</th>
<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>
<DT><STRONG>(
1)
</STRONG></DT>
<DT><STRONG>(
2)
</STRONG></DT>
<DD>default on
<span class=
"Unix">Unix
</span>
<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
<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>
<p><br /></p><hr class='online-navigation'
/>
<div class='online-navigation'
>
<!--Table of Child-Links-->
<A NAME=
"CHILD_LINKS"><STRONG>Subsections
</STRONG></a>
<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>
<!--End of Table of Child-Links-->
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<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>
<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>
<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.