Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/distutils/sourcedist.rst

    r2 r391  
    2727| ``zip``   | zip file (:file:`.zip`) | (1),(3) |
    2828+-----------+-------------------------+---------+
    29 | ``gztar`` | gzip'ed tar file        | (2),(4) |
     29| ``gztar`` | gzip'ed tar file        | \(2)    |
    3030|           | (:file:`.tar.gz`)       |         |
    3131+-----------+-------------------------+---------+
    32 | ``bztar`` | bzip2'ed tar file       | \(4)    |
     32| ``bztar`` | bzip2'ed tar file       |         |
    3333|           | (:file:`.tar.bz2`)      |         |
    3434+-----------+-------------------------+---------+
     
    3636|           | (:file:`.tar.Z`)        |         |
    3737+-----------+-------------------------+---------+
    38 | ``tar``   | tar file (:file:`.tar`) | \(4)    |
     38| ``tar``   | tar file (:file:`.tar`) |         |
    3939+-----------+-------------------------+---------+
    4040
     
    5252
    5353(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
     56When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or
     57``tar``) under Unix, you can specify the ``owner`` and ``group`` names
     58that will be set for each member of the archive.
     59
     60For example, if you want all files of the archive to be owned by root::
     61
     62    python setup.py sdist --owner=root --group=root
    5663
    5764
     
    6976
    7077* all C source files mentioned in the :option:`ext_modules` or
    71   :option:`libraries` options (
    72 
    73   **\*\*** getting C library sources currently broken---no
    74   :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`!
    7582
    7683* scripts identified by the :option:`scripts` option
     84  See :ref:`distutils-installing-scripts`.
    7785
    7886* anything that looks like a test script: :file:`test/test\*.py` (currently, the
     
    8391* :file:`README.txt` (or :file:`README`), :file:`setup.py` (or whatever  you
    8492  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`.
    8599
    86100Sometimes this is enough, but usually you will want to specify additional files
     
    97111described above does not apply in this case.
    98112
     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
     126See :ref:`manifest_template` section for a syntax reference.
     127
     128
     129.. _manifest-options:
     130
     131Manifest-related options
     132========================
     133
     134The 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
     149There 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
     153Second, you might just want to (re)generate the manifest, but not create a
     154source 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
     162The MANIFEST.in template
     163========================
     164
     165A :file:`MANIFEST.in` file can be added in a project to define the list of
     166files to include in the distribution built by the :command:`sdist` command.
     167
     168When :command:`sdist` is run, it will look for the :file:`MANIFEST.in` file
     169and interpret it to generate the :file:`MANIFEST` file that contains the
     170list of files that will be included in the package.
     171
     172This mechanism can be used when the default list of files is not enough.
     173(See :ref:`manifest`).
     174
     175Principle
     176---------
     177
    99178The manifest template has one command per line, where each command specifies a
    100179set of files to include or exclude from the source distribution.  For an
    101 example, again we turn to the Distutils' own manifest template::
     180example, let's look at the Distutils' own manifest template::
    102181
    103182   include *.txt
     
    111190include set, so you can exclude files from the standard set with explicit
    112191instructions 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.)
    116193
    117194The order of commands in the manifest template matters: initially, we have the
     
    167244template is portable across operating systems.
    168245
    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 
     246Commands
     247--------
     248
     249The 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
     277The patterns here are Unix-style "glob" patterns: ``*`` matches any sequence of
     278regular filename characters, ``?`` matches any single regular filename
     279character, 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
     281character" is platform-specific: on Unix it is anything except slash; on Windows
     282anything except backslash or colon.
Note: See TracChangeset for help on using the changeset viewer.