diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-06-07 17:42:15 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-06-08 09:53:50 +0200 |
commit | f541cfa41807694f1dd9493e72601a961615ac27 (patch) | |
tree | 3e497caab7cdd831d6b62c50f7365a0862d87775 /eclass/distutils-r1.eclass | |
parent | distutils-r1.eclass: Move python_optimize call to post-install (diff) | |
download | gentoo-f541cfa41807694f1dd9493e72601a961615ac27.tar.gz gentoo-f541cfa41807694f1dd9493e72601a961615ac27.tar.bz2 gentoo-f541cfa41807694f1dd9493e72601a961615ac27.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 PEP 517-specific dependencies
and the default python_compile() is a no-op. 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/distutils-r1.eclass')
-rw-r--r-- | eclass/distutils-r1.eclass | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 9293f744c7c2..f3d224a51224 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}]' @@ -792,7 +809,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 @@ -915,6 +932,9 @@ _distutils-r1_print_package_versions() { dev-util/maturin ) ;; + no) + return + ;; pbr) packages+=( dev-python/pbr @@ -1216,6 +1236,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 @@ -1360,6 +1384,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 |