Changeset 391 for python/trunk/Doc/distutils/sourcedist.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/distutils/sourcedist.rst
r2 r391 27 27 | ``zip`` | zip file (:file:`.zip`) | (1),(3) | 28 28 +-----------+-------------------------+---------+ 29 | ``gztar`` | gzip'ed tar file | (2),(4)|29 | ``gztar`` | gzip'ed tar file | \(2) | 30 30 | | (:file:`.tar.gz`) | | 31 31 +-----------+-------------------------+---------+ 32 | ``bztar`` | bzip2'ed tar file | \(4)|32 | ``bztar`` | bzip2'ed tar file | | 33 33 | | (:file:`.tar.bz2`) | | 34 34 +-----------+-------------------------+---------+ … … 36 36 | | (:file:`.tar.Z`) | | 37 37 +-----------+-------------------------+---------+ 38 | ``tar`` | tar file (:file:`.tar`) | \(4)|38 | ``tar`` | tar file (:file:`.tar`) | | 39 39 +-----------+-------------------------+---------+ 40 40 … … 52 52 53 53 (4) 54 requires external utilities: :program:`tar` and possibly one of :program:`gzip`, 55 :program:`bzip2`, or :program:`compress` 54 requires the :program:`compress` program. 55 56 When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or 57 ``tar``) under Unix, you can specify the ``owner`` and ``group`` names 58 that will be set for each member of the archive. 59 60 For example, if you want all files of the archive to be owned by root:: 61 62 python setup.py sdist --owner=root --group=root 56 63 57 64 … … 69 76 70 77 * all C source files mentioned in the :option:`ext_modules` or 71 :option:`libraries` options (72 73 **\*\*** getting C library sources currently broken---no74 :meth:`get_source_files` method in :file:`build_clib.py`! **\*\***)78 :option:`libraries` options 79 80 .. XXX Getting C library sources is currently broken -- no 81 :meth:`get_source_files` method in :file:`build_clib.py`! 75 82 76 83 * scripts identified by the :option:`scripts` option 84 See :ref:`distutils-installing-scripts`. 77 85 78 86 * anything that looks like a test script: :file:`test/test\*.py` (currently, the … … 83 91 * :file:`README.txt` (or :file:`README`), :file:`setup.py` (or whatever you 84 92 called your setup script), and :file:`setup.cfg` 93 94 * all files that matches the ``package_data`` metadata. 95 See :ref:`distutils-installing-package-data`. 96 97 * all files that matches the ``data_files`` metadata. 98 See :ref:`distutils-additional-files`. 85 99 86 100 Sometimes this is enough, but usually you will want to specify additional files … … 97 111 described above does not apply in this case. 98 112 113 .. versionchanged:: 2.7 114 An existing generated :file:`MANIFEST` will be regenerated without 115 :command:`sdist` comparing its modification time to the one of 116 :file:`MANIFEST.in` or :file:`setup.py`. 117 118 .. versionchanged:: 2.7.1 119 :file:`MANIFEST` files start with a comment indicating they are generated. 120 Files without this comment are not overwritten or removed. 121 122 .. versionchanged:: 2.7.3 123 :command:`sdist` will read a :file:`MANIFEST` file if no :file:`MANIFEST.in` 124 exists, like it did before 2.7. 125 126 See :ref:`manifest_template` section for a syntax reference. 127 128 129 .. _manifest-options: 130 131 Manifest-related options 132 ======================== 133 134 The normal course of operations for the :command:`sdist` command is as follows: 135 136 * if the manifest file (:file:`MANIFEST` by default) exists and the first line 137 does not have a comment indicating it is generated from :file:`MANIFEST.in`, 138 then it is used as is, unaltered 139 140 * if the manifest file doesn't exist or has been previously automatically 141 generated, read :file:`MANIFEST.in` and create the manifest 142 143 * if neither :file:`MANIFEST` nor :file:`MANIFEST.in` exist, create a manifest 144 with just the default file set 145 146 * use the list of files now in :file:`MANIFEST` (either just generated or read 147 in) to create the source distribution archive(s) 148 149 There are a couple of options that modify this behaviour. First, use the 150 :option:`--no-defaults` and :option:`--no-prune` to disable the standard 151 "include" and "exclude" sets. 152 153 Second, you might just want to (re)generate the manifest, but not create a 154 source distribution:: 155 156 python setup.py sdist --manifest-only 157 158 :option:`-o` is a shortcut for :option:`--manifest-only`. 159 160 .. _manifest_template: 161 162 The MANIFEST.in template 163 ======================== 164 165 A :file:`MANIFEST.in` file can be added in a project to define the list of 166 files to include in the distribution built by the :command:`sdist` command. 167 168 When :command:`sdist` is run, it will look for the :file:`MANIFEST.in` file 169 and interpret it to generate the :file:`MANIFEST` file that contains the 170 list of files that will be included in the package. 171 172 This mechanism can be used when the default list of files is not enough. 173 (See :ref:`manifest`). 174 175 Principle 176 --------- 177 99 178 The manifest template has one command per line, where each command specifies a 100 179 set of files to include or exclude from the source distribution. For an 101 example, again we turn tothe Distutils' own manifest template::180 example, let's look at the Distutils' own manifest template:: 102 181 103 182 include *.txt … … 111 190 include set, so you can exclude files from the standard set with explicit 112 191 instructions in the manifest template. (Or, you can use the 113 :option:`--no-defaults` option to disable the standard set entirely.) There are 114 several other commands available in the manifest template mini-language; see 115 section :ref:`sdist-cmd`. 192 :option:`--no-defaults` option to disable the standard set entirely.) 116 193 117 194 The order of commands in the manifest template matters: initially, we have the … … 167 244 template is portable across operating systems. 168 245 169 170 .. _manifest-options: 171 172 Manifest-related options 173 ======================== 174 175 The normal course of operations for the :command:`sdist` command is as follows: 176 177 * if the manifest file, :file:`MANIFEST` doesn't exist, read :file:`MANIFEST.in` 178 and create the manifest 179 180 * if neither :file:`MANIFEST` nor :file:`MANIFEST.in` exist, create a manifest 181 with just the default file set 182 183 * if either :file:`MANIFEST.in` or the setup script (:file:`setup.py`) are more 184 recent than :file:`MANIFEST`, recreate :file:`MANIFEST` by reading 185 :file:`MANIFEST.in` 186 187 * use the list of files now in :file:`MANIFEST` (either just generated or read 188 in) to create the source distribution archive(s) 189 190 There are a couple of options that modify this behaviour. First, use the 191 :option:`--no-defaults` and :option:`--no-prune` to disable the standard 192 "include" and "exclude" sets. 193 194 Second, you might want to force the manifest to be regenerated---for example, if 195 you have added or removed files or directories that match an existing pattern in 196 the manifest template, you should regenerate the manifest:: 197 198 python setup.py sdist --force-manifest 199 200 Or, you might just want to (re)generate the manifest, but not create a source 201 distribution:: 202 203 python setup.py sdist --manifest-only 204 205 :option:`--manifest-only` implies :option:`--force-manifest`. :option:`-o` is a 206 shortcut for :option:`--manifest-only`, and :option:`-f` for 207 :option:`--force-manifest`. 208 209 246 Commands 247 -------- 248 249 The manifest template commands are: 250 251 +-------------------------------------------+-----------------------------------------------+ 252 | Command | Description | 253 +===========================================+===============================================+ 254 | :command:`include pat1 pat2 ...` | include all files matching any of the listed | 255 | | patterns | 256 +-------------------------------------------+-----------------------------------------------+ 257 | :command:`exclude pat1 pat2 ...` | exclude all files matching any of the listed | 258 | | patterns | 259 +-------------------------------------------+-----------------------------------------------+ 260 | :command:`recursive-include dir pat1 pat2 | include all files under *dir* matching any of | 261 | ...` | the listed patterns | 262 +-------------------------------------------+-----------------------------------------------+ 263 | :command:`recursive-exclude dir pat1 pat2 | exclude all files under *dir* matching any of | 264 | ...` | the listed patterns | 265 +-------------------------------------------+-----------------------------------------------+ 266 | :command:`global-include pat1 pat2 ...` | include all files anywhere in the source tree | 267 | | matching --- & any of the listed patterns | 268 +-------------------------------------------+-----------------------------------------------+ 269 | :command:`global-exclude pat1 pat2 ...` | exclude all files anywhere in the source tree | 270 | | matching --- & any of the listed patterns | 271 +-------------------------------------------+-----------------------------------------------+ 272 | :command:`prune dir` | exclude all files under *dir* | 273 +-------------------------------------------+-----------------------------------------------+ 274 | :command:`graft dir` | include all files under *dir* | 275 +-------------------------------------------+-----------------------------------------------+ 276 277 The patterns here are Unix-style "glob" patterns: ``*`` matches any sequence of 278 regular filename characters, ``?`` matches any single regular filename 279 character, and ``[range]`` matches any of the characters in *range* (e.g., 280 ``a-z``, ``a-zA-Z``, ``a-f0-9_.``). The definition of "regular filename 281 character" is platform-specific: on Unix it is anything except slash; on Windows 282 anything except backslash or colon.
Note:
See TracChangeset
for help on using the changeset viewer.