@@ -691,12 +691,10 @@ \section{Creating a Source Distribution}
691691\end {verbatim }
692692(assuming you haven't specified any \command {sdist} options in the setup
693693script or config file), \command {sdist} creates the archive of the
694- default format for the current platform. The default formats are:
695- \begin {tableii }{ll}{textrm}%
696- {Platform}{Default archive format for source distributions}
697- \lineii {Unix}{gzipped tar file (\file {.tar.gz})}
698- \lineii {Windows}{zip file}
699- \end {tableii }
694+ default format for the current platform. The default format is gzip'ed
695+ tar file (\file {.tar.gz}) on Unix, and ZIP file on Windows. \XXX {no Mac
696+ OS support here}
697+
700698You can specify as many formats as you like using the
701699\longprogramopt {formats} option, for example:
702700\begin {verbatim }
@@ -705,29 +703,31 @@ \section{Creating a Source Distribution}
705703to create a gzipped tarball and a zip file. The available formats are:
706704\begin {tableiii }{l|l|c}{code}%
707705 {Format}{Description}{Notes}
708- \lineiii {zip}{zip file (\file {.zip})}{(1),(2 )}
709- \lineiii {gztar}{gzip'ed tar file (\file {.tar.gz})}{(3 ),(4)}
706+ \lineiii {zip}{zip file (\file {.zip})}{(1),(3 )}
707+ \lineiii {gztar}{gzip'ed tar file (\file {.tar.gz})}{(2 ),(4)}
710708 \lineiii {bztar}{bzip2'ed tar file (\file {.tar.gz})}{(4)}
711709 \lineiii {ztar}{compressed tar file (\file {.tar.Z})}{(4)}
712- \lineiii {tar}{tar file (\file {.tar})}{}
710+ \lineiii {tar}{tar file (\file {.tar})}{(4) }
713711\end {tableiii }
714712
715713\noindent Notes:
716714\begin {description }
717715\item [(1)] default on Windows
718- \item [(2)] under both Unix and Windows, requires either external
716+ \item [(2)] default on Unix
717+ \item [(3)] under both Unix and Windows, requires either external
719718 Info-ZIP utility \emph {or } the \module {zipfile} module
720- \item [(3)] default on Unix
721719\item [(4)] requires external utilities: \program {tar} and possibly one
722720 of \program {gzip}, \program {bzip2}, or \program {compress}
723721\end {description }
724722
725723
726- \subsection {The manifest and manifest template }
724+
725+ \subsection {Specifying the files to distribute }
727726\label {manifest }
728727
729- Without any additional information, the \command {sdist} command puts a
730- minimal set of files into the source distribution:
728+ If you don't supply an explicit list of files (or instructions on how to
729+ generate one), the \command {sdist} command puts a minimal default set
730+ into the source distribution:
731731\begin {itemize }
732732\item all Python source files implied by the \option {py\_ modules} and
733733 \option {packages} options
@@ -738,15 +738,22 @@ \subsection{The manifest and manifest template}
738738 (currently, the Distutils don't do anything with test scripts except
739739 include them in source distributions, but in the future there will be
740740 a standard for testing Python module distributions)
741- \item \file {README.txt} (or \file {README}) and \file {setup.py}
741+ \item \file {README.txt} (or \file {README}), \file {setup.py} (or whatever
742+ you called your setup script), and \file {setup.cfg}
742743\end {itemize }
743744Sometimes this is enough, but usually you will want to specify
744745additional files to distribute. The typical way to do this is to write
745746a \emph {manifest template }, called \file {MANIFEST.in} by default. The
746- \command {sdist} command processes this template and generates a manifest
747- file, \file {MANIFEST}. (If you prefer, you can skip the manifest
748- template and generate the manifest yourself: it just lists one file per
749- line.)
747+ manifest template is just a list of instructions for how to generate
748+ your manifest file, \file {MANIFEST}, which is the exact list of files to
749+ include in your source distribution. The \command {sdist} command
750+ processes this template and generates a manifest based on its
751+ instructions and what it finds in the filesystem.
752+
753+ If you prefer to roll your own manifest file, the format is simple: one
754+ filename per line, regular files (or symlinks to them) only. If you do
755+ supply your own \file {MANIFEST}, you must specify everything: the
756+ default set of files described above does not apply in this case.
750757
751758The manifest template has one command per line, where each command
752759specifies a set of files to include or exclude from the source
@@ -760,16 +767,30 @@ \subsection{The manifest and manifest template}
760767The meanings should be fairly clear: include all files in the
761768distribution root matching \code {*.txt}, all files anywhere under the
762769\file {examples} directory matching \code {*.txt} or \code {*.py}, and
763- exclude all directories matching \code {examples/sample?/build}. There
764- are several other commands available in the manifest template
765- mini-language; see section~\ref {sdist-cmd }.
770+ exclude all directories matching \code {examples/sample?/build}. All of
771+ this is done \emph {after } the standard include set, so you can exclude
772+ files from the standard set with explicit instructions in the manifest
773+ template. (Or, you can use the \longprogramopt {no-defaults} option to
774+ disable the standard set entirely.) There are several other commands
775+ available in the manifest template mini-language; see
776+ section~\ref {sdist-cmd }.
777+
778+ The order of commands in the manifest template matters: initially, we
779+ have the list of default files as described above, and each command in
780+ the template adds to or removes from that list of files. Once we have
781+ fully processed the manifest template, we remove files that should not
782+ be included in the source distribution:
783+ \begin {itemize }
784+ \item all files in the Distutils `` build'' tree (default \file {build/})
785+ \item all files in directories named \file {RCS} or \file {CVS}
786+ \end {itemize }
787+ Now we have our complete list of files, which is written to the manifest
788+ for future reference, and then used to build the source distribution
789+ archive(s).
766790
767- The order of commands in the manifest template very much matters:
768- initially, we have the list of default files as described above, and
769- each command in the template adds to or removes from that list of files.
770- When we have fully processed the manifest template, we have our complete
771- list of files. This list is written to the manifest for future
772- reference, and then used to build the source distribution archive(s).
791+ You can disable the default set of included files with the
792+ \longprogramopt {no-defaults} option, and you can disable the standard
793+ exclude set with \longprogramopt {no-prune}.
773794
774795Following the Distutils' own manifest template, let's trace how the
775796\command {sdist} command builds the list of files to include in the
@@ -778,23 +799,24 @@ \subsection{The manifest and manifest template}
778799\item include all Python source files in the \file {distutils} and
779800 \file {distutils/command} subdirectories (because packages
780801 corresponding to those two directories were mentioned in the
781- \option {packages} option in the setup script)
782- \item include \file {test/test*.py} (always included)
783- \item include \file {README.txt} and \file {setup.py} (always included)
802+ \option {packages} option in the setup script---see
803+ section~\ref {setup-script })
804+ \item include \file {README.txt}, \file {setup.py}, and \file {setup.cfg}
805+ (standard files)
806+ \item include \file {test/test*.py} (standard files)
784807\item include \file {*.txt} in the distribution root (this will find
785808 \file {README.txt} a second time, but such redundancies are weeded out
786809 later)
787- \item in the sub-tree under \file {examples}, include anything matching
788- \file {*.txt}
789- \item in the sub-tree under \file {examples}, include anything matching
790- \file {*.py}
791- \item remove all files in the sub-trees starting at directories matching
792- \file {examples/sample?/build}---this may exclude files included by the
793- previous two steps, so it's important that the \code {prune } command in
794- the manifest template comes after the two \code {recursive-include}
795- commands
810+ \item include anything matching \file {*.txt} or \file {*.py} in the
811+ sub-tree under \file {examples},
812+ \item exclude all files in the sub-trees starting at directories
813+ matching \file {examples/sample?/build}---this may exclude files
814+ included by the previous two steps, so it's important that the
815+ \code {prune} command in the manifest template comes after the
816+ \code {recursive-include } command
817+ \item exclude the entire \file {build} tree, and any \file {RCS} or
818+ \file {CVS} directories
796819\end {enumerate }
797-
798820Just like in the setup script, file and directory names in the manifest
799821template should always be slash-separated; the Distutils will take care
800822of converting them to the standard representation on your platform.
@@ -809,15 +831,26 @@ \subsection{Manifest-related options}
809831\begin {itemize }
810832\item if the manifest file, \file {MANIFEST} doesn't exist, read
811833 \file {MANIFEST.in} and create the manifest
834+ \item if neither \file {MANIFEST} nor \file {MANIFEST.in} exist, create a
835+ manifest with just the default file set\footnote {In versions of the
836+ Distutils up to and including 0.9.2 (Python 2.0b1), this feature was
837+ broken; use the \programopt {-f} (\longprogramopt {force-manifest})
838+ option to work around the bug.}
812839\item if either \file {MANIFEST.in} or the setup script (\file {setup.py})
813840 are more recent than \file {MANIFEST}, recreate \file {MANIFEST} by
814841 reading \file {MANIFEST.in}
815842\item use the list of files now in \file {MANIFEST} (either just
816843 generated or read in) to create the source distribution archive(s)
817844\end {itemize }
818- There are a couple of options that modify this behaviour.
819-
820- First, you might want to force the manifest to be regenerated---for
845+ There are a couple of options that modify this behaviour. First, use
846+ the \longprogramopt {no-defaults} and \longprogramopt {no-prune} to
847+ disable the standard `` include'' and `` exclude'' sets.\footnote {Note
848+ that if you have no manifest template, no manifest, and use the
849+ \longprogramopt {no-defaults}, you will get an empty manifest. Another
850+ bug in Distutils 0.9.2 and earlier causes an uncaught exception in
851+ this case. The workaround is: Don't Do That.}
852+
853+ Second, you might want to force the manifest to be regenerated---for
821854example, if you have added or removed files or directories that match an
822855existing pattern in the manifest template, you should regenerate the
823856manifest:
@@ -830,13 +863,9 @@ \subsection{Manifest-related options}
830863\begin {verbatim }
831864python setup.py sdist --manifest-only
832865\end {verbatim }
833- (\longprogramopt {manifest-only} implies \longprogramopt {force-manifest}.)
834-
835- If you don't want to use the default file set, you can supply the
836- \longprogramopt {no-defaults} option. If you use
837- \longprogramopt {no-defaults} and don't supply a manifest template (or
838- it's empty, or nothing matches the patterns in it), then your source
839- distribution will be empty.
866+ \longprogramopt {manifest-only} implies \longprogramopt {force-manifest}.
867+ \programopt {-o} is a shortcut for \longprogramopt {manifest-only}, and
868+ \programopt {-f} for \longprogramopt {force-manifest}.
840869
841870
842871\section {Creating Built Distributions }
0 commit comments