build-style/python3-pep517: new style for PEP517 Python packages
This commit is contained in:
parent
53afef855f
commit
2dff49c420
3 changed files with 52 additions and 8 deletions
27
Manual.md
27
Manual.md
|
@ -561,17 +561,22 @@ phase if `${build_style}` is set to `configure`, `gnu-configure` or
|
|||
`gnu-makefile` build methods. By default set to
|
||||
`PREFIX=/usr DESTDIR=${DESTDIR}`.
|
||||
|
||||
- `make_build_target` The target to be passed in to `${make_cmd}` at the build phase if
|
||||
`${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
|
||||
build methods. Unset by default (`all` target).
|
||||
- `make_build_target` The build target. If `${build_style}` is set to `configure`, `gnu-configure`
|
||||
or `gnu-makefile`, this is the target passed to `${make_cmd}` in the build phase; when unset, it
|
||||
defaults to `all`. If `${build_style}` is `python3-pep517`, this is the path of the package
|
||||
directory that should be built as a Python wheel; when unset, defaults to `.` (the current
|
||||
directory with respect to the build).
|
||||
|
||||
- `make_check_target` The target to be passed in to `${make_cmd}` at the check phase if
|
||||
`${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
|
||||
build methods. By default set to `check`.
|
||||
|
||||
- `make_install_target` The target to be passed in to `${make_cmd}` at the `install-destdir` phase
|
||||
if `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
|
||||
build methods. By default set to `install`.
|
||||
- `make_install_target` The installation target. When `${build_style}` is set to `configure`,
|
||||
`gnu-configure` or `gnu-makefile`, this is the target passed to `${make_command}` in the install
|
||||
phase; when unset, it defaults to `install`. If `${build_style}` is `python-pep517`, this is the
|
||||
path of the Python wheel produced by the build phase that will be installed; when unset, the
|
||||
`python-pep517` build style will look for a wheel matching the package name and version in the
|
||||
current directory with respect to the install.
|
||||
|
||||
- `patch_args` The arguments to be passed in to the `patch(1)` command when applying
|
||||
patches to the package sources during `do_patch()`. Patches are stored in
|
||||
|
@ -952,8 +957,8 @@ via `make_install_target`.
|
|||
via `configure_args`, the meson command can be overridden by `meson_cmd` and the location of
|
||||
the out of source build by `meson_builddir`
|
||||
|
||||
For packages that use the Python module build method (`setup.py`), you
|
||||
can choose one of the following:
|
||||
For packages that use the Python module build method (`setup.py` or
|
||||
[PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
|
||||
|
||||
- `python-module` to build *both* Python 2.x and 3.x modules
|
||||
|
||||
|
@ -961,6 +966,9 @@ can choose one of the following:
|
|||
|
||||
- `python3-module` to build Python 3.x only modules
|
||||
|
||||
- `python3-pep517` to build Python 3.x only modules that provide a PEP 517 build description without
|
||||
a `setup.py` script
|
||||
|
||||
Environment variables for a specific `build_style` can be declared in a filename
|
||||
matching the `build_style` name, Example:
|
||||
|
||||
|
@ -1482,6 +1490,9 @@ be your guidance to decide whether or not to split off a `-doc` subpackage.
|
|||
Python packages should be built with the `python{,2,3}-module` build style, if possible.
|
||||
This sets some environment variables required to allow cross compilation. Support to allow
|
||||
building a python module for multiple versions from a single template is also possible.
|
||||
The `python3-pep517` build style provides means to build python packages that provide a build-system
|
||||
definition compliant with [PEP 517](https://www.python.org/dev/peps/pep-0517/) without a traditional
|
||||
`setup.py` script.
|
||||
|
||||
Python packages that rely on `python3-setuptools` should generally map `setup_requires`
|
||||
dependencies in `setup.py` to `hostmakedepends` in the template and `install_requires`
|
||||
|
|
31
common/build-style/python3-pep517.sh
Normal file
31
common/build-style/python3-pep517.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# This style is for templates installing python3 modules adhering to PEP517
|
||||
#
|
||||
|
||||
do_build() {
|
||||
# No PEP517 build tool currently supports compiled extensions
|
||||
# Thus, there is no need to accommodate cross compilation here
|
||||
: ${make_build_target:=.}
|
||||
|
||||
mkdir -p build
|
||||
TMPDIR=build python3 -m pip wheel --no-deps --use-pep517 --no-clean \
|
||||
--no-build-isolation ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
if python3 -m pytest --help >/dev/null 2>&1; then
|
||||
python3 -m pytest ${make_check_args} ${make_check_target}
|
||||
else
|
||||
msg_warn "Unable to determine tests for PEP517 Python templates"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
# As with do_build, no need to accommodate cross compilation here
|
||||
: ${make_install_target:=${pkgname#python3-}-${version}-*-*-*.whl}
|
||||
|
||||
TMPDIR=build python3 -m pip install --use-pep517 --prefix /usr \
|
||||
--root ${DESTDIR} --no-deps --no-build-isolation \
|
||||
--no-clean ${make_install_args} ${make_install_target}
|
||||
}
|
2
common/environment/build-style/python3-pep517.sh
Normal file
2
common/environment/build-style/python3-pep517.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
hostmakedepends+=" python3-pip"
|
||||
lib32disabled=yes
|
Loading…
Reference in a new issue