Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c5d1a26f
Commit
c5d1a26f
authored
Sep 06, 2000
by
Greg Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General overhaul of the "Creating a Source Distribution" section --
better explanation of manifest files, in particular.
parent
9f544bf3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
51 deletions
+80
-51
Doc/dist/dist.tex
Doc/dist/dist.tex
+80
-51
No files found.
Doc/dist/dist.tex
View file @
c5d1a26f
...
@@ -691,12 +691,10 @@ python setup.py sdist
...
@@ -691,12 +691,10 @@ python setup.py sdist
\end{verbatim}
\end{verbatim}
(assuming you haven't specified any
\command
{
sdist
}
options in the setup
(assuming you haven't specified any
\command
{
sdist
}
options in the setup
script or config file),
\command
{
sdist
}
creates the archive of the
script or config file),
\command
{
sdist
}
creates the archive of the
default format for the current platform. The default formats are:
default format for the current platform. The default format is gzip'ed
\begin{tableii}
{
ll
}{
textrm
}
%
tar file (
\file
{
.tar.gz
}
) on Unix, and ZIP file on Windows.
\XXX
{
no Mac
{
Platform
}{
Default archive format for source distributions
}
OS support here
}
\lineii
{
Unix
}{
gzipped tar file (
\file
{
.tar.gz
}
)
}
\lineii
{
Windows
}{
zip file
}
\end{tableii}
You can specify as many formats as you like using the
You can specify as many formats as you like using the
\longprogramopt
{
formats
}
option, for example:
\longprogramopt
{
formats
}
option, for example:
\begin{verbatim}
\begin{verbatim}
...
@@ -705,29 +703,31 @@ python setup.py sdist --formats=gztar,zip
...
@@ -705,29 +703,31 @@ python setup.py sdist --formats=gztar,zip
to create a gzipped tarball and a zip file. The available formats are:
to create a gzipped tarball and a zip file. The available formats are:
\begin{tableiii}
{
l|l|c
}{
code
}
%
\begin{tableiii}
{
l|l|c
}{
code
}
%
{
Format
}{
Description
}{
Notes
}
{
Format
}{
Description
}{
Notes
}
\lineiii
{
zip
}{
zip file (
\file
{
.zip
}
)
}{
(1),(
2
)
}
\lineiii
{
zip
}{
zip file (
\file
{
.zip
}
)
}{
(1),(
3
)
}
\lineiii
{
gztar
}{
gzip'ed tar file (
\file
{
.tar.gz
}
)
}{
(
3
),(4)
}
\lineiii
{
gztar
}{
gzip'ed tar file (
\file
{
.tar.gz
}
)
}{
(
2
),(4)
}
\lineiii
{
bztar
}{
bzip2'ed tar file (
\file
{
.tar.gz
}
)
}{
(4)
}
\lineiii
{
bztar
}{
bzip2'ed tar file (
\file
{
.tar.gz
}
)
}{
(4)
}
\lineiii
{
ztar
}{
compressed tar file (
\file
{
.tar.Z
}
)
}{
(4)
}
\lineiii
{
ztar
}{
compressed tar file (
\file
{
.tar.Z
}
)
}{
(4)
}
\lineiii
{
tar
}{
tar file (
\file
{
.tar
}
)
}{}
\lineiii
{
tar
}{
tar file (
\file
{
.tar
}
)
}{
(4)
}
\end{tableiii}
\end{tableiii}
\noindent
Notes:
\noindent
Notes:
\begin{description}
\begin{description}
\item
[(1)]
default on Windows
\item
[(1)]
default on Windows
\item
[(2)]
under both Unix and Windows, requires either external
\item
[(2)]
default on Unix
\item
[(3)]
under both Unix and Windows, requires either external
Info-ZIP utility
\emph
{
or
}
the
\module
{
zipfile
}
module
Info-ZIP utility
\emph
{
or
}
the
\module
{
zipfile
}
module
\item
[(3)]
default on Unix
\item
[(4)]
requires external utilities:
\program
{
tar
}
and possibly one
\item
[(4)]
requires external utilities:
\program
{
tar
}
and possibly one
of
\program
{
gzip
}
,
\program
{
bzip2
}
, or
\program
{
compress
}
of
\program
{
gzip
}
,
\program
{
bzip2
}
, or
\program
{
compress
}
\end{description}
\end{description}
\subsection
{
The manifest and manifest template
}
\subsection
{
Specifying the files to distribute
}
\label
{
manifest
}
\label
{
manifest
}
Without any additional information, the
\command
{
sdist
}
command puts a
If you don't supply an explicit list of files (or instructions on how to
minimal set of files into the source distribution:
generate one), the
\command
{
sdist
}
command puts a minimal default set
into the source distribution:
\begin{itemize}
\begin{itemize}
\item
all Python source files implied by the
\option
{
py
\_
modules
}
and
\item
all Python source files implied by the
\option
{
py
\_
modules
}
and
\option
{
packages
}
options
\option
{
packages
}
options
...
@@ -738,15 +738,22 @@ minimal set of files into the source distribution:
...
@@ -738,15 +738,22 @@ minimal set of files into the source distribution:
(currently, the Distutils don't do anything with test scripts except
(currently, the Distutils don't do anything with test scripts except
include them in source distributions, but in the future there will be
include them in source distributions, but in the future there will be
a standard for testing Python module distributions)
a standard for testing Python module distributions)
\item
\file
{
README.txt
}
(or
\file
{
README
}
) and
\file
{
setup.py
}
\item
\file
{
README.txt
}
(or
\file
{
README
}
),
\file
{
setup.py
}
(or whatever
you called your setup script), and
\file
{
setup.cfg
}
\end{itemize}
\end{itemize}
Sometimes this is enough, but usually you will want to specify
Sometimes this is enough, but usually you will want to specify
additional files to distribute. The typical way to do this is to write
additional files to distribute. The typical way to do this is to write
a
\emph
{
manifest template
}
, called
\file
{
MANIFEST.in
}
by default. The
a
\emph
{
manifest template
}
, called
\file
{
MANIFEST.in
}
by default. The
\command
{
sdist
}
command processes this template and generates a manifest
manifest template is just a list of instructions for how to generate
file,
\file
{
MANIFEST
}
. (If you prefer, you can skip the manifest
your manifest file,
\file
{
MANIFEST
}
, which is the exact list of files to
template and generate the manifest yourself: it just lists one file per
include in your source distribution. The
\command
{
sdist
}
command
line.)
processes this template and generates a manifest based on its
instructions and what it finds in the filesystem.
If you prefer to roll your own manifest file, the format is simple: one
filename per line, regular files (or symlinks to them) only. If you do
supply your own
\file
{
MANIFEST
}
, you must specify everything: the
default set of files described above does not apply in this case.
The manifest template has one command per line, where each command
The manifest template has one command per line, where each command
specifies a set of files to include or exclude from the source
specifies a set of files to include or exclude from the source
...
@@ -760,16 +767,30 @@ prune examples/sample?/build
...
@@ -760,16 +767,30 @@ prune examples/sample?/build
The meanings should be fairly clear: include all files in the
The meanings should be fairly clear: include all files in the
distribution root matching
\code
{
*.txt
}
, all files anywhere under the
distribution root matching
\code
{
*.txt
}
, all files anywhere under the
\file
{
examples
}
directory matching
\code
{
*.txt
}
or
\code
{
*.py
}
, and
\file
{
examples
}
directory matching
\code
{
*.txt
}
or
\code
{
*.py
}
, and
exclude all directories matching
\code
{
examples/sample?/build
}
. There
exclude all directories matching
\code
{
examples/sample?/build
}
. All of
are several other commands available in the manifest template
this is done
\emph
{
after
}
the standard include set, so you can exclude
mini-language; see section~
\ref
{
sdist-cmd
}
.
files from the standard set with explicit instructions in the manifest
template. (Or, you can use the
\longprogramopt
{
no-defaults
}
option to
disable the standard set entirely.) There are several other commands
available in the manifest template mini-language; see
section~
\ref
{
sdist-cmd
}
.
The order of commands in the manifest template matters: initially, we
have the list of default files as described above, and each command in
the template adds to or removes from that list of files. Once we have
fully processed the manifest template, we remove files that should not
be included in the source distribution:
\begin{itemize}
\item
all files in the Distutils ``build'' tree (default
\file
{
build/
}
)
\item
all files in directories named
\file
{
RCS
}
or
\file
{
CVS
}
\end{itemize}
Now we have our complete list of files, which is written to the manifest
for future reference, and then used to build the source distribution
archive(s).
The order of commands in the manifest template very much matters:
You can disable the default set of included files with the
initially, we have the list of default files as described above, and
\longprogramopt
{
no-defaults
}
option, and you can disable the standard
each command in the template adds to or removes from that list of files.
exclude set with
\longprogramopt
{
no-prune
}
.
When we have fully processed the manifest template, we have our complete
list of files. This list is written to the manifest for future
reference, and then used to build the source distribution archive(s).
Following the Distutils' own manifest template, let's trace how the
Following the Distutils' own manifest template, let's trace how the
\command
{
sdist
}
command builds the list of files to include in the
\command
{
sdist
}
command builds the list of files to include in the
...
@@ -778,23 +799,24 @@ Distutils source distribution:
...
@@ -778,23 +799,24 @@ Distutils source distribution:
\item
include all Python source files in the
\file
{
distutils
}
and
\item
include all Python source files in the
\file
{
distutils
}
and
\file
{
distutils/command
}
subdirectories (because packages
\file
{
distutils/command
}
subdirectories (because packages
corresponding to those two directories were mentioned in the
corresponding to those two directories were mentioned in the
\option
{
packages
}
option in the setup script)
\option
{
packages
}
option in the setup script---see
\item
include
\file
{
test/test*.py
}
(always included)
section~
\ref
{
setup-script
}
)
\item
include
\file
{
README.txt
}
and
\file
{
setup.py
}
(always included)
\item
include
\file
{
README.txt
}
,
\file
{
setup.py
}
, and
\file
{
setup.cfg
}
(standard files)
\item
include
\file
{
test/test*.py
}
(standard files)
\item
include
\file
{
*.txt
}
in the distribution root (this will find
\item
include
\file
{
*.txt
}
in the distribution root (this will find
\file
{
README.txt
}
a second time, but such redundancies are weeded out
\file
{
README.txt
}
a second time, but such redundancies are weeded out
later)
later)
\item
in
the sub-tree under
\file
{
examples
}
, include anything matching
\item
in
clude anything matching
\file
{
*.txt
}
or
\file
{
*.py
}
in the
\file
{
*.txt
}
sub-tree under
\file
{
examples
}
,
\item
in the sub-tree under
\file
{
examples
}
, include anything matching
\item
exclude all files in the sub-trees starting at directories
\file
{
*.py
}
matching
\file
{
examples/sample?/build
}
---this may exclude files
\item
remove all files in the sub-trees starting at directories matching
included by the previous two steps, so it's important that the
\
file
{
examples/sample?/build
}
---this may exclude files included by
the
\
code
{
prune
}
command in the manifest template comes after
the
previous two steps, so it's important that the
\code
{
prune
}
command in
\code
{
recursive-include
}
command
the manifest template comes after the two
\code
{
recursive-include
}
\item
exclude the entire
\file
{
build
}
tree, and any
\file
{
RCS
}
or
command
s
\file
{
CVS
}
directorie
s
\end{enumerate}
\end{enumerate}
Just like in the setup script, file and directory names in the manifest
Just like in the setup script, file and directory names in the manifest
template should always be slash-separated; the Distutils will take care
template should always be slash-separated; the Distutils will take care
of converting them to the standard representation on your platform.
of converting them to the standard representation on your platform.
...
@@ -809,15 +831,26 @@ follows:
...
@@ -809,15 +831,26 @@ follows:
\begin{itemize}
\begin{itemize}
\item
if the manifest file,
\file
{
MANIFEST
}
doesn't exist, read
\item
if the manifest file,
\file
{
MANIFEST
}
doesn't exist, read
\file
{
MANIFEST.in
}
and create the manifest
\file
{
MANIFEST.in
}
and create the manifest
\item
if neither
\file
{
MANIFEST
}
nor
\file
{
MANIFEST.in
}
exist, create a
manifest with just the default file set
\footnote
{
In versions of the
Distutils up to and including 0.9.2 (Python 2.0b1), this feature was
broken; use the
\programopt
{
-f
}
(
\longprogramopt
{
force-manifest
}
)
option to work around the bug.
}
\item
if either
\file
{
MANIFEST.in
}
or the setup script (
\file
{
setup.py
}
)
\item
if either
\file
{
MANIFEST.in
}
or the setup script (
\file
{
setup.py
}
)
are more recent than
\file
{
MANIFEST
}
, recreate
\file
{
MANIFEST
}
by
are more recent than
\file
{
MANIFEST
}
, recreate
\file
{
MANIFEST
}
by
reading
\file
{
MANIFEST.in
}
reading
\file
{
MANIFEST.in
}
\item
use the list of files now in
\file
{
MANIFEST
}
(either just
\item
use the list of files now in
\file
{
MANIFEST
}
(either just
generated or read in) to create the source distribution archive(s)
generated or read in) to create the source distribution archive(s)
\end{itemize}
\end{itemize}
There are a couple of options that modify this behaviour.
There are a couple of options that modify this behaviour. First, use
the
\longprogramopt
{
no-defaults
}
and
\longprogramopt
{
no-prune
}
to
First, you might want to force the manifest to be regenerated---for
disable the standard ``include'' and ``exclude'' sets.
\footnote
{
Note
that if you have no manifest template, no manifest, and use the
\longprogramopt
{
no-defaults
}
, you will get an empty manifest. Another
bug in Distutils 0.9.2 and earlier causes an uncaught exception in
this case. The workaround is: Don't Do That.
}
Second, you might want to force the manifest to be regenerated---for
example, if you have added or removed files or directories that match an
example, if you have added or removed files or directories that match an
existing pattern in the manifest template, you should regenerate the
existing pattern in the manifest template, you should regenerate the
manifest:
manifest:
...
@@ -830,13 +863,9 @@ source distribution:
...
@@ -830,13 +863,9 @@ source distribution:
\begin{verbatim}
\begin{verbatim}
python setup.py sdist --manifest-only
python setup.py sdist --manifest-only
\end{verbatim}
\end{verbatim}
(
\longprogramopt
{
manifest-only
}
implies
\longprogramopt
{
force-manifest
}
.)
\longprogramopt
{
manifest-only
}
implies
\longprogramopt
{
force-manifest
}
.
\programopt
{
-o
}
is a shortcut for
\longprogramopt
{
manifest-only
}
, and
If you don't want to use the default file set, you can supply the
\programopt
{
-f
}
for
\longprogramopt
{
force-manifest
}
.
\longprogramopt
{
no-defaults
}
option. If you use
\longprogramopt
{
no-defaults
}
and don't supply a manifest template (or
it's empty, or nothing matches the patterns in it), then your source
distribution will be empty.
\section
{
Creating Built Distributions
}
\section
{
Creating Built Distributions
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment