PEP 517: Add sdist and build preparation hooks

Bring PEP 517 up to date with latest distutils-sig discussion:

- sdist export hook
- build preparation hook for out-of-tree builds
This commit is contained in:
Thomas Kluyver 2017-06-05 10:44:47 +01:00 committed by Nick Coghlan
parent 7b4193d056
commit 64442c8201
1 changed files with 37 additions and 1 deletions

View File

@ -220,9 +220,45 @@ including any unrecognized files it created.
Mandatory.
::
def build_sdist(sdist_directory, config_settings):
...
Must build an unpacked source distribution in the specified
``sdist_directory``.
An unpacked source distribution (sdist) consists of a directory called
``{name}-{version}`` (e.g. ``foo-1.0``), containing the source files of the
package. This directory must also contain the
``pyproject.toml`` from the build directory, and a PKG-INFO file containing
metadata in the format described in
`PEP 345 <https://www.python.org/dev/peps/pep-0345/>`_.
Mandatory, but it may not succeed in all situations: for instance, some tools
can only build an sdist from a VCS checkout.
::
def prepare_build_files(build_directory, config_settings):
...
Must copy or create any files needed to build a wheel of this package into
``build_directory``. For instance, it is expected that ``pyproject.toml`` will
exist in the root of this directory after this hook runs. For tools such as
`setuptools_scm <https://github.com/pypa/setuptools_scm>`_, this may include
extracting some information from a version control system.
The ``build_wheel`` hook will subsequently be run from the ``build_directory``
populated by this hook.
Optional. If this hook is not defined, frontends may call ``build_sdist`` and
extract the resulting tarball to use as a build directory. Backends in which
building an sdist has additional requirements should define
``prepare_build_files``.
.. note:: Editable installs
This PEP originally specified a fourth hook, ``install_editable``, to do an
This PEP originally specified another hook, ``install_editable``, to do an
editable install (as with ``pip install -e``). It was removed due to the
complexity of the topic, but may be specified in a later PEP.