diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-05-26 11:40:58 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-06-07 08:53:49 +0200 |
commit | e897148019dc484622c8c6a44153dd45694d8a99 (patch) | |
tree | 915b0e4997721d105ef680439ef91264d864f67e /eclass | |
parent | distutils-r1.eclass: Move venv/merge-root logic to post-phases (diff) | |
download | gentoo-e897148019dc484622c8c6a44153dd45694d8a99.tar.gz gentoo-e897148019dc484622c8c6a44153dd45694d8a99.tar.bz2 gentoo-e897148019dc484622c8c6a44153dd45694d8a99.zip |
distutils-r1.eclass: Introduce DISTUTILS_USE_PEP517=no mode
Introduce a new DISTUTILS_USE_PEP517 value "no" that stands for
"no build system". This is primarily meant to replace the legacy
distutils-r1 logic used for bootstrapping baseline PEP 517 packages.
At the same time, it provides a convenient replacement for some
of the uses of python-r1.
In this mode, the eclass does not add PEP517-specific dependencies
and does not export default python_compile() and python_install()
implementations. However, it does set dependencies, REQUIRED_USE
and enables sub-phase usage (with respect to DISTUTILS_OPTIONAL).
It also permits using distutils_enable_{sphinx,tests}.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/distutils-r1.eclass | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 208bd2718cb8..30f7d941f0d4 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -106,6 +106,8 @@ esac # # - maturin - maturin backend # +# - no - no PEP517 build system (see below) +# # - pbr - pbr backend # # - pdm - pdm.pep517 backend @@ -121,6 +123,17 @@ esac # # The variable needs to be set before the inherit line. The eclass # adds appropriate build-time dependencies and verifies the value. +# +# The special value "no" indicates that the package has no build system. +# This is not equivalent to unset DISTUTILS_USE_PEP517 (legacy mode). +# It causes the eclass not to include any build system dependencies +# and to disable default python_compile() and python_install() +# implementations. Baseline Python deps and phase functions will still +# be set (depending on the value of DISTUTILS_OPTIONAL). Most of +# the other eclass functions will work. Testing venv will be provided +# in ${BUILD_DIR}/install after python_compile(), and if any (other) +# files are found in ${BUILD_DIR}/install after python_install(), they +# will be merged into ${D}. # @ECLASS_VARIABLE: DISTUTILS_USE_SETUPTOOLS # @DEFAULT_UNSET @@ -212,6 +225,10 @@ _distutils_set_globals() { bdep+=' >=dev-util/maturin-0.12.7[${PYTHON_USEDEP}]' ;; + no) + # undo the generic deps added above + bdep= + ;; pbr) bdep+=' >=dev-python/pbr-5.8.0-r1[${PYTHON_USEDEP}]' @@ -789,7 +806,7 @@ distutils_install_for_testing() { distutils_write_namespace() { debug-print-function ${FUNCNAME} "${@}" - if [[ ! ${DISTUTILS_USE_PEP517} ]]; then + if [[ ! ${DISTUTILS_USE_PEP517:-no} != no ]]; then die "${FUNCNAME} is available only in PEP517 mode" fi if [[ ${EBUILD_PHASE} != test || ! ${BUILD_DIR} ]]; then @@ -912,6 +929,9 @@ _distutils-r1_print_package_versions() { dev-util/maturin ) ;; + no) + return + ;; pbr) packages+=( dev-python/pbr @@ -1207,6 +1227,10 @@ distutils_pep517_install() { debug-print-function ${FUNCNAME} "${@}" [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: root" + if [[ ! ${DISTUTILS_USE_PEP517:-no} != no ]]; then + die "${FUNCNAME} is available only in PEP517 mode" + fi + local root=${1} local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel mkdir -p "${WHEEL_BUILD_DIR}" || die @@ -1351,6 +1375,9 @@ distutils-r1_python_compile() { in_iuse debug && use debug && MATURIN_PEP517_ARGS+=" --cargo-extra-args=--profile=dev" ;; + no) + return + ;; esac if [[ ${DISTUTILS_USE_PEP517} ]]; then @@ -1472,6 +1499,7 @@ distutils-r1_python_test() { distutils-r1_python_install() { debug-print-function ${FUNCNAME} "${@}" + [[ ${DISTUTILS_USE_PEP517} == no ]] && return _python_check_EPYTHON local scriptdir=${EPREFIX}/usr/bin |