diff options
| author | Michał Górny <mgorny@gentoo.org> | 2022-05-08 13:30:59 +0200 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2022-05-09 22:31:51 +0200 |
| commit | 9fb77f35a048dfcea2cc44486382c9de765befc7 (patch) | |
| tree | ac784e88c18287da25e513b12748295fe9d04455 /eclass | |
| parent | 837f9b31d24790130a3c1fa605fe512a96863d28 (diff) | |
| download | gentoo-9fb77f35a048dfcea2cc44486382c9de765befc7.tar.gz gentoo-9fb77f35a048dfcea2cc44486382c9de765befc7.tar.bz2 gentoo-9fb77f35a048dfcea2cc44486382c9de765befc7.zip | |
distutils-r1.eclass: Support DISTUTILS_ARGS in PEP517 mode
Use gpep517 --config-json support to pass DISTUTILS_ARGS in PEP517 mode.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
| -rw-r--r-- | eclass/distutils-r1.eclass | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 1573d803f3f6..e9a28056e9cc 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1091,12 +1091,38 @@ distutils_pep517_install() { local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel mkdir -p "${WHEEL_BUILD_DIR}" || die + if [[ -n ${mydistutilsargs[@]} ]]; then + die "mydistutilsargs are banned in PEP517 mode (use DISTUTILS_ARGS)" + fi + + local config_settings= + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then + case ${DISTUTILS_USE_PEP517} in + setuptools) + config_settings=$( + "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die + import json + import sys + print(json.dumps({"--global-option": sys.argv[1:]})) + EOF + ) + ;; + *) + die "DISTUTILS_ARGS are not supported by ${DISTUTILS_USE_PEP517}" + ;; + esac + fi + local build_backend=$(_distutils-r1_get_backend) einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}" + local config_args=() + [[ -n ${config_settings} ]] && + config_args+=( --config-json "${config_settings}" ) local wheel=$( gpep517 build-wheel --backend "${build_backend}" \ --output-fd 3 \ - --wheel-dir "${WHEEL_BUILD_DIR}" 3>&1 >&2 || + --wheel-dir "${WHEEL_BUILD_DIR}" \ + "${config_args[@]}" 3>&1 >&2 || die "Wheel build failed" ) [[ -n ${wheel} ]] || die "No wheel name returned" @@ -1181,10 +1207,6 @@ distutils-r1_python_compile() { esac if [[ ${DISTUTILS_USE_PEP517} ]]; then - if [[ -n ${DISTUTILS_ARGS[@]} || -n ${mydistutilsargs[@]} ]]; then - die "DISTUTILS_ARGS are not supported in PEP-517 mode" - fi - # python likes to compile any module it sees, which triggers sandbox # failures if some packages haven't compiled their modules yet. addpredict "${EPREFIX}/usr/lib/${EPYTHON}" |
