@@ -111,9 +111,68 @@ per line, regular files (or symlinks to them) only. If you do supply your own
111111:file: `MANIFEST `, you must specify everything: the default set of files
112112described above does not apply in this case.
113113
114+ See :ref: `manifest_template ` section for a syntax reference.
115+
116+ .. _manifest-options :
117+
118+ Manifest-related options
119+ ========================
120+
121+ The normal course of operations for the :command: `sdist ` command is as follows:
122+
123+ * if the manifest file, :file: `MANIFEST ` doesn't exist, read :file: `MANIFEST.in `
124+ and create the manifest
125+
126+ * if neither :file: `MANIFEST ` nor :file: `MANIFEST.in ` exist, create a manifest
127+ with just the default file set
128+
129+ * if either :file: `MANIFEST.in ` or the setup script (:file: `setup.py `) are more
130+ recent than :file: `MANIFEST `, recreate :file: `MANIFEST ` by reading
131+ :file: `MANIFEST.in `
132+
133+ * use the list of files now in :file: `MANIFEST ` (either just generated or read
134+ in) to create the source distribution archive(s)
135+
136+ There are a couple of options that modify this behaviour. First, use the
137+ :option: `--no-defaults ` and :option: `--no-prune ` to disable the standard
138+ "include" and "exclude" sets.
139+
140+ Second, you might want to force the manifest to be regenerated---for example, if
141+ you have added or removed files or directories that match an existing pattern in
142+ the manifest template, you should regenerate the manifest::
143+
144+ python setup.py sdist --force-manifest
145+
146+ Or, you might just want to (re)generate the manifest, but not create a source
147+ distribution::
148+
149+ python setup.py sdist --manifest-only
150+
151+ :option: `--manifest-only ` implies :option: `--force-manifest `. :option: `-o ` is a
152+ shortcut for :option: `--manifest-only `, and :option: `-f ` for
153+ :option: `--force-manifest `.
154+
155+ .. _manifest_template :
156+
157+ The MANIFEST.in template
158+ ========================
159+
160+ A :file: `MANIFEST.in ` file can be added in a project to define the list of
161+ files to include in the distribution built by the :command: `sdist ` command.
162+
163+ When :command: `sdist ` is run, it will look for the :file: `MANIFEST.in ` file
164+ and interpret it to generate the :file: `MANIFEST ` file that contains the
165+ list of files that will be included in the package.
166+
167+ This mechanism can be used when the default list of files is not enough.
168+ (See :ref: `manifest `).
169+
170+ Principle
171+ ---------
172+
114173The manifest template has one command per line, where each command specifies a
115174set of files to include or exclude from the source distribution. For an
116- example, again we turn to the Distutils' own manifest template::
175+ example, let's look at the Distutils' own manifest template::
117176
118177 include *.txt
119178 recursive-include examples *.txt *.py
@@ -125,9 +184,7 @@ matching :file:`\*.txt` or :file:`\*.py`, and exclude all directories matching
125184:file: `examples/sample?/build `. All of this is done *after * the standard
126185include set, so you can exclude files from the standard set with explicit
127186instructions in the manifest template. (Or, you can use the
128- :option: `--no-defaults ` option to disable the standard set entirely.) There are
129- several other commands available in the manifest template mini-language; see
130- section :ref: `sdist-cmd `.
187+ :option: `--no-defaults ` option to disable the standard set entirely.)
131188
132189The order of commands in the manifest template matters: initially, we have the
133190list of default files as described above, and each command in the template adds
@@ -181,44 +238,41 @@ should always be slash-separated; the Distutils will take care of converting
181238them to the standard representation on your platform. That way, the manifest
182239template is portable across operating systems.
183240
184-
185- .. _manifest-options :
186-
187- Manifest-related options
188- ========================
189-
190- The normal course of operations for the :command: `sdist ` command is as follows:
191-
192- * if the manifest file, :file: `MANIFEST ` doesn't exist, read :file: `MANIFEST.in `
193- and create the manifest
194-
195- * if neither :file: `MANIFEST ` nor :file: `MANIFEST.in ` exist, create a manifest
196- with just the default file set
197-
198- * if either :file: `MANIFEST.in ` or the setup script (:file: `setup.py `) are more
199- recent than :file: `MANIFEST `, recreate :file: `MANIFEST ` by reading
200- :file: `MANIFEST.in `
201-
202- * use the list of files now in :file: `MANIFEST ` (either just generated or read
203- in) to create the source distribution archive(s)
204-
205- There are a couple of options that modify this behaviour. First, use the
206- :option: `--no-defaults ` and :option: `--no-prune ` to disable the standard
207- "include" and "exclude" sets.
208-
209- Second, you might want to force the manifest to be regenerated---for example, if
210- you have added or removed files or directories that match an existing pattern in
211- the manifest template, you should regenerate the manifest::
212-
213- python setup.py sdist --force-manifest
214-
215- Or, you might just want to (re)generate the manifest, but not create a source
216- distribution::
217-
218- python setup.py sdist --manifest-only
219-
220- :option: `--manifest-only ` implies :option: `--force-manifest `. :option: `-o ` is a
221- shortcut for :option: `--manifest-only `, and :option: `-f ` for
222- :option: `--force-manifest `.
223-
241+ Commands
242+ --------
243+
244+ The manifest template commands are:
245+
246+ +-------------------------------------------+-----------------------------------------------+
247+ | Command | Description |
248+ +===========================================+===============================================+
249+ | :command: `include pat1 pat2 ... ` | include all files matching any of the listed |
250+ | | patterns |
251+ +-------------------------------------------+-----------------------------------------------+
252+ | :command: `exclude pat1 pat2 ... ` | exclude all files matching any of the listed |
253+ | | patterns |
254+ +-------------------------------------------+-----------------------------------------------+
255+ | :command: `recursive-include dir pat1 pat2 | include all files under *dir * matching any of |
256+ | ...` | the listed patterns |
257+ +-------------------------------------------+-----------------------------------------------+
258+ | :command: `recursive-exclude dir pat1 pat2 | exclude all files under *dir * matching any of |
259+ | ...` | the listed patterns |
260+ +-------------------------------------------+-----------------------------------------------+
261+ | :command: `global-include pat1 pat2 ... ` | include all files anywhere in the source tree |
262+ | | matching --- & any of the listed patterns |
263+ +-------------------------------------------+-----------------------------------------------+
264+ | :command: `global-exclude pat1 pat2 ... ` | exclude all files anywhere in the source tree |
265+ | | matching --- & any of the listed patterns |
266+ +-------------------------------------------+-----------------------------------------------+
267+ | :command: `prune dir ` | exclude all files under *dir * |
268+ +-------------------------------------------+-----------------------------------------------+
269+ | :command: `graft dir ` | include all files under *dir * |
270+ +-------------------------------------------+-----------------------------------------------+
271+
272+ The patterns here are Unix-style "glob" patterns: ``* `` matches any sequence of
273+ regular filename characters, ``? `` matches any single regular filename
274+ character, and ``[range] `` matches any of the characters in *range * (e.g.,
275+ ``a-z ``, ``a-zA-Z ``, ``a-f0-9_. ``). The definition of "regular filename
276+ character" is platform-specific: on Unix it is anything except slash; on Windows
277+ anything except backslash or colon.
224278
0 commit comments