* [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support
@ 2025-03-25 20:16 Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 01/11] distutils-r1.eclass: Bump build system lower bounds Michał Górny
` (12 more replies)
0 siblings, 13 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Hi,
Here's another batch of patches to distutils-r1. Aside from some
refactoring, it includes the following changes:
1. Lower bounds for most of the build systems were bumped to the lowest
stable versions in ::gentoo. This should match upstream requirements
better, especially that a few backends have recently added support
for license expressions, and poetry-core gained PEP 621 metadata
support.
2. FLIT_ALLOW_INVALID is now set to avoid breakage when license
validation fails.
3. Support for uv-build backend is added. We hack the package a fair
bit, because we don't want to waste time building another uv-build
executable that's roughly 50% of dev-python/uv.
4. We use unique build directories for each setuptools invocation now.
This avoids issues when a single package is building more than one
wheel, and they'd end up all copying files to the same build
directory, and setuptools will just keep copying modules from one
package to the next...
5. We now make it easier to override the PEP517 backend used. You set
DISTUTILS_UPSTREAM_PEP517 to the backend used upstream, and
DISTUTILS_USE_PEP517 to the backend you want to use -- and you don't
have to edit build-backend in pyproject.toml anymore. Most packages
won't need it, and should just continue setting DISTUTILS_USE_PEP517.
--
Best regards,
Michał Górny
Michał Górny (11):
distutils-r1.eclass: Bump build system lower bounds
distutils-r1.eclass: Set FLIT_ALLOW_INVALID
dev-python/uv-build: New package, v0.6.9
distutils-r1.eclass: Support uv-build backend
distutils-r1.eclass: Support the legacy "uv" backend too
distutils-r1.eclass: Use unique setuptools build directories
distutils-r1.eclass: Reflow _distutils-r1_backend_to_key()
distutils-r1.eclass: Invert DISTUTILS_USE_PEP517 - backend mapping
distutils-r1.eclass: Support overriding PEP517 build backend
dev-python/uv-build: Use DISTUTILS_UPSTREAM_PEP517
distutils-r1.eclass: Reflow distutils-r1_python_compile()
dev-python/uv-build/Manifest | 1 +
.../files/uv-build-0.6.9-use-uv.patch | 18 ++
dev-python/uv-build/metadata.xml | 11 +
dev-python/uv-build/uv-build-0.6.9.ebuild | 41 +++
eclass/distutils-r1.eclass | 304 ++++++++++--------
5 files changed, 236 insertions(+), 139 deletions(-)
create mode 100644 dev-python/uv-build/Manifest
create mode 100644 dev-python/uv-build/files/uv-build-0.6.9-use-uv.patch
create mode 100644 dev-python/uv-build/metadata.xml
create mode 100644 dev-python/uv-build/uv-build-0.6.9.ebuild
^ permalink raw reply [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 01/11] distutils-r1.eclass: Bump build system lower bounds
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 02/11] distutils-r1.eclass: Set FLIT_ALLOW_INVALID Michał Górny
` (11 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
This includes some important new features that packages are already
relying on -- PEP 639 licenses, PEP 621 metadata support in poetry-core.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index a65dd3ef2a8f..ef5f85349299 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -246,22 +246,23 @@ _distutils_set_globals() {
fi
bdep='
- >=dev-python/gpep517-15[${PYTHON_USEDEP}]
+ >=dev-python/gpep517-16[${PYTHON_USEDEP}]
'
case ${DISTUTILS_USE_PEP517} in
flit)
bdep+='
- >=dev-python/flit-core-3.9.0[${PYTHON_USEDEP}]
+ >=dev-python/flit-core-3.11.0[${PYTHON_USEDEP}]
'
;;
flit_scm)
bdep+='
+ >=dev-python/flit-core-3.11.0[${PYTHON_USEDEP}]
>=dev-python/flit-scm-1.7.0[${PYTHON_USEDEP}]
'
;;
hatchling)
bdep+='
- >=dev-python/hatchling-1.21.1[${PYTHON_USEDEP}]
+ >=dev-python/hatchling-1.27.0[${PYTHON_USEDEP}]
'
;;
jupyter)
@@ -271,7 +272,7 @@ _distutils_set_globals() {
;;
maturin)
bdep+='
- >=dev-util/maturin-1.7.4[${PYTHON_USEDEP}]
+ >=dev-util/maturin-1.8.2[${PYTHON_USEDEP}]
'
;;
no)
@@ -280,37 +281,37 @@ _distutils_set_globals() {
;;
meson-python)
bdep+='
- >=dev-python/meson-python-0.15.0[${PYTHON_USEDEP}]
+ >=dev-python/meson-python-0.17.1[${PYTHON_USEDEP}]
'
;;
pbr)
bdep+='
- >=dev-python/pbr-6.0.0[${PYTHON_USEDEP}]
+ >=dev-python/pbr-6.1.1[${PYTHON_USEDEP}]
'
;;
pdm-backend)
bdep+='
- >=dev-python/pdm-backend-2.1.8[${PYTHON_USEDEP}]
+ >=dev-python/pdm-backend-2.4.3[${PYTHON_USEDEP}]
'
;;
poetry)
bdep+='
- >=dev-python/poetry-core-1.9.0[${PYTHON_USEDEP}]
+ >=dev-python/poetry-core-2.1.1[${PYTHON_USEDEP}]
'
;;
scikit-build-core)
bdep+='
- >=dev-python/scikit-build-core-0.9.4[${PYTHON_USEDEP}]
+ >=dev-python/scikit-build-core-0.10.7[${PYTHON_USEDEP}]
'
;;
setuptools)
bdep+='
- >=dev-python/setuptools-69.0.3[${PYTHON_USEDEP}]
+ >=dev-python/setuptools-75.8.2[${PYTHON_USEDEP}]
'
;;
sip)
bdep+='
- >=dev-python/sip-6.8.3[${PYTHON_USEDEP}]
+ >=dev-python/sip-6.10.0[${PYTHON_USEDEP}]
'
;;
standalone)
@@ -325,7 +326,7 @@ _distutils_set_globals() {
eqawarn "is enabled."
fi
else
- local setuptools_dep='>=dev-python/setuptools-69.0.3[${PYTHON_USEDEP}]'
+ local setuptools_dep='>=dev-python/setuptools-75.8.2[${PYTHON_USEDEP}]'
case ${DISTUTILS_USE_SETUPTOOLS:-bdepend} in
no|manual)
@@ -501,7 +502,7 @@ distutils_enable_sphinx() {
_DISTUTILS_SPHINX_PLUGINS=( "${@}" )
local deps autodoc=1 d
- deps=">=dev-python/sphinx-7.2.6[\${PYTHON_USEDEP}]"
+ deps=">=dev-python/sphinx-8.1.3[\${PYTHON_USEDEP}]"
for d; do
if [[ ${d} == --no-autodoc ]]; then
autodoc=
@@ -525,7 +526,7 @@ distutils_enable_sphinx() {
use doc || return 0
local p
- for p in ">=dev-python/sphinx-7.2.6" \
+ for p in ">=dev-python/sphinx-8.1.3" \
"${_DISTUTILS_SPHINX_PLUGINS[@]}"
do
python_has_version "${p}[${PYTHON_USEDEP}]" ||
@@ -533,7 +534,7 @@ distutils_enable_sphinx() {
done
}
else
- deps=">=dev-python/sphinx-7.2.6"
+ deps=">=dev-python/sphinx-8.1.3"
fi
sphinx_compile_all() {
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 02/11] distutils-r1.eclass: Set FLIT_ALLOW_INVALID
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 01/11] distutils-r1.eclass: Bump build system lower bounds Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 03/11] dev-python/uv-build: New package, v0.6.9 Michał Górny
` (10 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Set `FLIT_ALLOW_INVALID` to prevent license validation from breaking
builds.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index ef5f85349299..21a2c79c1f71 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1259,6 +1259,7 @@ distutils_pep517_install() {
fi
# set it globally in case we were using "standalone" wrapper
+ local -x FLIT_ALLOW_INVALID=1
local -x HATCH_METADATA_CLASSIFIERS_NO_VERIFY=1
local -x VALIDATE_PYPROJECT_NO_NETWORK=1
local -x VALIDATE_PYPROJECT_NO_TROVE_CLASSIFIERS=1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 03/11] dev-python/uv-build: New package, v0.6.9
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 01/11] distutils-r1.eclass: Bump build system lower bounds Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 02/11] distutils-r1.eclass: Set FLIT_ALLOW_INVALID Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 04/11] distutils-r1.eclass: Support uv-build backend Michał Górny
` (9 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Add a hacky patched uv-build package that installs the upstream Python
modules without building another copy of uv.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
dev-python/uv-build/Manifest | 1 +
.../files/uv-build-0.6.9-use-uv.patch | 18 ++++++++
dev-python/uv-build/metadata.xml | 11 +++++
dev-python/uv-build/uv-build-0.6.9.ebuild | 45 +++++++++++++++++++
4 files changed, 75 insertions(+)
create mode 100644 dev-python/uv-build/Manifest
create mode 100644 dev-python/uv-build/files/uv-build-0.6.9-use-uv.patch
create mode 100644 dev-python/uv-build/metadata.xml
create mode 100644 dev-python/uv-build/uv-build-0.6.9.ebuild
diff --git a/dev-python/uv-build/Manifest b/dev-python/uv-build/Manifest
new file mode 100644
index 000000000000..9adf1c6044c9
--- /dev/null
+++ b/dev-python/uv-build/Manifest
@@ -0,0 +1 @@
+DIST uv_build-0.6.9.tar.gz 298105 BLAKE2B 49b1a71820b26281b5f70ba4ae76d122ff48a5660c5402c355aa18f61c132b857c4cc1b457b6126c2c507239c0679b9288635b0788be4f87a342666e639f2d6f SHA512 36d9e0e22e969feef7fbc6177868c95110a3abca7c8a657d2f8973009a6fa947087c9a6f0378fd71830db0704c48fd0e849aa83cbb83fbc4757c08b48351ce64
diff --git a/dev-python/uv-build/files/uv-build-0.6.9-use-uv.patch b/dev-python/uv-build/files/uv-build-0.6.9-use-uv.patch
new file mode 100644
index 000000000000..6e0f96d46ec3
--- /dev/null
+++ b/dev-python/uv-build/files/uv-build-0.6.9-use-uv.patch
@@ -0,0 +1,18 @@
+diff --git a/python/uv_build/__init__.py b/python/uv_build/__init__.py
+index c8ce9c5..835ba0f 100644
+--- a/python/uv_build/__init__.py
++++ b/python/uv_build/__init__.py
+@@ -39,11 +39,11 @@ def call(
+
+ warn_config_settings(config_settings)
+ # Unlike `find_uv_bin`, this mechanism must work according to PEP 517
+- uv_bin = shutil.which("uv-build")
++ uv_bin = shutil.which("uv")
+ if uv_bin is None:
+ raise RuntimeError("uv was not properly installed")
+ # Forward stderr, capture stdout for the filename
+- result = subprocess.run([uv_bin, *args], stdout=subprocess.PIPE)
++ result = subprocess.run([uv_bin, "build-backend", *args], stdout=subprocess.PIPE)
+ if result.returncode != 0:
+ sys.exit(result.returncode)
+ # If there was extra stdout, forward it (there should not be extra stdout)
diff --git a/dev-python/uv-build/metadata.xml b/dev-python/uv-build/metadata.xml
new file mode 100644
index 000000000000..936a4b3a6282
--- /dev/null
+++ b/dev-python/uv-build/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">astral-sh/uv</remote-id>
+ <remote-id type="pypi">uv-build</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/uv-build/uv-build-0.6.9.ebuild b/dev-python/uv-build/uv-build-0.6.9.ebuild
new file mode 100644
index 000000000000..a93405a17200
--- /dev/null
+++ b/dev-python/uv-build/uv-build-0.6.9.ebuild
@@ -0,0 +1,45 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=hatchling
+PYTHON_COMPAT=( pypy3 pypy3_11 python3_{10..13} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="PEP517 uv build backend"
+HOMEPAGE="
+ https://github.com/astral-sh/uv/
+ https://pypi.org/project/uv-build/
+"
+
+LICENSE="|| ( Apache-2.0 MIT )"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ >=dev-python/uv-${PV}
+"
+
+src_prepare() {
+ local PATCHES=(
+ # use 'uv build-backend' instead of compiling uv-build executable
+ # that largely overlaps with dev-python/uv
+ "${FILESDIR}/${PN}-0.6.9-use-uv.patch"
+ )
+
+ distutils-r1_src_prepare
+
+ # replace the upstream build system since we don't want maturin
+ # to recompile uv again
+ sed -i -e '/^\[build-system\]$/,$d' pyproject.toml || die
+ cat >> pyproject.toml <<-EOF || die
+ [build-system]
+ requires = ["hatchling"]
+ build-backend = "hatchling.build"
+
+ [tool.hatch.build.targets.wheel]
+ packages = ["python/uv_build"]
+ EOF
+}
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 04/11] distutils-r1.eclass: Support uv-build backend
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (2 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 03/11] dev-python/uv-build: New package, v0.6.9 Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 05/11] distutils-r1.eclass: Support the legacy "uv" backend too Michał Górny
` (8 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 21a2c79c1f71..e011502c01e6 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -137,6 +137,8 @@
# - standalone - standalone build systems without external deps
# (used for bootstrapping).
#
+# - uv-build - uv-build backend (using dev-python/uv)
+#
# The variable needs to be set before the inherit line. The eclass
# adds appropriate build-time dependencies and verifies the value.
#
@@ -316,6 +318,11 @@ _distutils_set_globals() {
;;
standalone)
;;
+ uv-build)
+ bdep+='
+ dev-python/uv-build[${PYTHON_USEDEP}]
+ '
+ ;;
*)
die "Unknown DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}"
;;
@@ -905,6 +912,12 @@ _distutils-r1_print_package_versions() {
dev-python/sip
)
;;
+ uv-build)
+ packages+=(
+ dev-python/uv
+ dev-python/uv-build
+ )
+ ;;
esac
else
case ${DISTUTILS_USE_SETUPTOOLS} in
@@ -1098,6 +1111,9 @@ _distutils-r1_backend_to_key() {
sipbuild.api)
echo sip
;;
+ uv_build)
+ echo uv-build
+ ;;
*)
die "Unknown backend: ${backend}"
;;
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 05/11] distutils-r1.eclass: Support the legacy "uv" backend too
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (3 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 04/11] distutils-r1.eclass: Support uv-build backend Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 06/11] distutils-r1.eclass: Use unique setuptools build directories Michał Górny
` (7 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e011502c01e6..8fc9ec5f568b 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1111,7 +1111,7 @@ _distutils-r1_backend_to_key() {
sipbuild.api)
echo sip
;;
- uv_build)
+ uv_build|uv)
echo uv-build
;;
*)
@@ -1173,6 +1173,9 @@ _distutils-r1_get_backend() {
[[ ! ${legacy_fallback} ]] &&
new_backend=setuptools.build_meta
;;
+ uv)
+ new_backend=uv_build
+ ;;
esac
if [[ -n ${new_backend} ]]; then
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 06/11] distutils-r1.eclass: Use unique setuptools build directories
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (4 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 05/11] distutils-r1.eclass: Support the legacy "uv" backend too Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 07/11] distutils-r1.eclass: Reflow _distutils-r1_backend_to_key() Michał Górny
` (6 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Add a dynamic component to the build directory used by setuptools,
to enable calling distutils-r1_python_compile multiple times without
having the builds share the same build directory (and therefore end up
being combined).
Closes: https://bugs.gentoo.org/951853
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 8fc9ec5f568b..02245424bff6 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1490,11 +1490,15 @@ distutils-r1_python_compile() {
*)
# we do this for all build systems, since other backends
# and custom hooks may wrap setuptools
+ #
+ # we are appending a dynamic component so that
+ # distutils-r1_python_compile can be called multiple
+ # times and don't end up combining resulting packages
mkdir -p "${BUILD_DIR}" || die
local -x DIST_EXTRA_CONFIG="${BUILD_DIR}/extra-setup.cfg"
cat > "${DIST_EXTRA_CONFIG}" <<-EOF || die
[build]
- build_base = ${BUILD_DIR}/build
+ build_base = ${BUILD_DIR}/build${#DISTUTILS_WHEELS[@]}
[build_ext]
parallel = $(makeopts_jobs "${MAKEOPTS} ${*}")
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 07/11] distutils-r1.eclass: Reflow _distutils-r1_backend_to_key()
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (5 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 06/11] distutils-r1.eclass: Use unique setuptools build directories Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 08/11] distutils-r1.eclass: Invert DISTUTILS_USE_PEP517 - backend mapping Michał Górny
` (5 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 100 +++++++++++++++++++------------------
1 file changed, 51 insertions(+), 49 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 02245424bff6..2eb6e3208082 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1128,65 +1128,67 @@ _distutils-r1_backend_to_key() {
_distutils-r1_get_backend() {
debug-print-function ${FUNCNAME} "$@"
- local build_backend legacy_fallback
+ local build_backend
if [[ -f pyproject.toml ]]; then
# if pyproject.toml exists, try getting the backend from it
# NB: this could fail if pyproject.toml doesn't list one
build_backend=$("${EPYTHON}" -m gpep517 get-backend)
fi
- if [[ -z ${build_backend} && ${DISTUTILS_USE_PEP517} == setuptools &&
- -f setup.py ]]
- then
- # use the legacy setuptools backend as a fallback
- build_backend=setuptools.build_meta:__legacy__
- legacy_fallback=1
- fi
if [[ -z ${build_backend} ]]; then
- die "Unable to obtain build-backend from pyproject.toml"
- fi
-
- if [[ ${DISTUTILS_USE_PEP517} != standalone ]]; then
- # verify whether DISTUTILS_USE_PEP517 was set correctly
- local expected_value=$(_distutils-r1_backend_to_key "${build_backend}")
- if [[ ${DISTUTILS_USE_PEP517} != ${expected_value} ]]; then
- eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!"
- eerror " have: DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}"
- eerror "expected: DISTUTILS_USE_PEP517=${expected_value}"
- eerror "(backend: ${build_backend})"
- die "DISTUTILS_USE_PEP517 value incorrect"
+ if [[ ${DISTUTILS_USE_PEP517} == setuptools && -f setup.py ]]
+ then
+ # use the legacy setuptools backend as a fallback
+ echo setuptools.build_meta:__legacy__
+ return
+ else
+ die "Unable to obtain build-backend from pyproject.toml"
fi
+ fi
- # fix deprecated backends up
- local new_backend=
- case ${build_backend} in
- flit.buildapi)
- new_backend=flit_core.buildapi
- ;;
- pdm.pep517.api)
- new_backend=pdm.backend
- ;;
- poetry.masonry.api)
- new_backend=poetry.core.masonry.api
- ;;
- setuptools.build_meta:__legacy__)
- # this backend should only be used as implicit fallback
- [[ ! ${legacy_fallback} ]] &&
- new_backend=setuptools.build_meta
- ;;
- uv)
- new_backend=uv_build
- ;;
- esac
+ if [[ ${DISTUTILS_USE_PEP517} == standalone ]]; then
+ echo "${build_backend}"
+ return
+ fi
- if [[ -n ${new_backend} ]]; then
- if [[ ! -f ${T}/.distutils_deprecated_backend_warned ]]; then
- eqawarn "${build_backend} backend is deprecated. Please see:"
- eqawarn "https://projects.gentoo.org/python/guide/qawarn.html#deprecated-pep-517-backends"
- eqawarn "The eclass will be using ${new_backend} instead."
- > "${T}"/.distutils_deprecated_backend_warned || die
- fi
- build_backend=${new_backend}
+ # verify whether DISTUTILS_USE_PEP517 was set correctly
+ local expected_value=$(_distutils-r1_backend_to_key "${build_backend}")
+ if [[ ${DISTUTILS_USE_PEP517} != ${expected_value} ]]; then
+ eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!"
+ eerror " have: DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}"
+ eerror "expected: DISTUTILS_USE_PEP517=${expected_value}"
+ eerror "(backend: ${build_backend})"
+ die "DISTUTILS_USE_PEP517 value incorrect"
+ fi
+
+ # fix deprecated backends up
+ local new_backend=
+ case ${build_backend} in
+ flit.buildapi)
+ new_backend=flit_core.buildapi
+ ;;
+ pdm.pep517.api)
+ new_backend=pdm.backend
+ ;;
+ poetry.masonry.api)
+ new_backend=poetry.core.masonry.api
+ ;;
+ setuptools.build_meta:__legacy__)
+ # this backend should only be used as implicit fallback
+ new_backend=setuptools.build_meta
+ ;;
+ uv)
+ new_backend=uv_build
+ ;;
+ esac
+
+ if [[ -n ${new_backend} ]]; then
+ if [[ ! -f ${T}/.distutils_deprecated_backend_warned ]]; then
+ eqawarn "${build_backend} backend is deprecated. Please see:"
+ eqawarn "https://projects.gentoo.org/python/guide/qawarn.html#deprecated-pep-517-backends"
+ eqawarn "The eclass will be using ${new_backend} instead."
+ > "${T}"/.distutils_deprecated_backend_warned || die
fi
+ build_backend=${new_backend}
fi
echo "${build_backend}"
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 08/11] distutils-r1.eclass: Invert DISTUTILS_USE_PEP517 - backend mapping
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (6 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 07/11] distutils-r1.eclass: Reflow _distutils-r1_backend_to_key() Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 09/11] distutils-r1.eclass: Support overriding PEP517 build backend Michał Górny
` (4 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Invert the eclass logic to map DISTUTILS_USE_PEP517 values to backends
rather than the other way around. This is in preparation for making
it possible to override the backend used. One side effect of this
is that in case of DISTUTILS_USE_PEP517 mismatch, we no longer provide
the "correct" value, and only indicate the backend used upstream.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 122 +++++++++++++++++--------------------
1 file changed, 56 insertions(+), 66 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 2eb6e3208082..0ab42eba1f24 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1064,58 +1064,57 @@ _distutils-r1_copy_egg_info() {
find -name '*.egg-info' -type d -exec cp -R -p {} "${BUILD_DIR}"/ ';' || die
}
-# @FUNCTION: _distutils-r1_backend_to_key
-# @USAGE: <backend>
+# @FUNCTION: _distutils-r1_key_to_backend
+# @USAGE: <key>
# @INTERNAL
# @DESCRIPTION:
-# Print the DISTUTILS_USE_PEP517 value corresponding to the backend
-# passed as the only argument.
-_distutils-r1_backend_to_key() {
+# Print the backend corresponding to the DISTUTILS_USE_PEP517 value.
+_distutils-r1_key_to_backend() {
debug-print-function ${FUNCNAME} "$@"
- local backend=${1}
- case ${backend} in
- flit_core.buildapi|flit.buildapi)
- echo flit
+ local key=${1}
+ case ${key} in
+ flit)
+ echo flit_core.buildapi
;;
- flit_scm:buildapi)
- echo flit_scm
+ flit_scm)
+ echo flit_scm:buildapi
;;
- hatchling.build)
- echo hatchling
+ hatchling)
+ echo hatchling.build
;;
- jupyter_packaging.build_api)
- echo jupyter
+ jupyter)
+ echo jupyter_packaging.build_api
;;
maturin)
echo maturin
;;
- mesonpy)
- echo meson-python
+ meson-python)
+ echo mesonpy
;;
- pbr.build)
- echo pbr
+ pbr)
+ echo pbr.build
;;
- pdm.backend|pdm.pep517.api)
- echo pdm-backend
+ pdm-backend)
+ echo pdm.backend
;;
- poetry.core.masonry.api|poetry.masonry.api)
- echo poetry
+ poetry)
+ echo poetry.core.masonry.api
;;
- scikit_build_core.build)
- echo scikit-build-core
+ scikit-build-core)
+ echo scikit_build_core.build
;;
- setuptools.build_meta|setuptools.build_meta:__legacy__)
- echo setuptools
+ setuptools)
+ echo setuptools.build_meta
;;
- sipbuild.api)
- echo sip
+ sip)
+ echo sipbuild.api
;;
- uv_build|uv)
- echo uv-build
+ uv-build)
+ echo uv_build
;;
*)
- die "Unknown backend: ${backend}"
+ die "Unknown DISTUTILS_USE_PEP517 key: ${key}"
;;
esac
}
@@ -1150,48 +1149,39 @@ _distutils-r1_get_backend() {
return
fi
- # verify whether DISTUTILS_USE_PEP517 was set correctly
- local expected_value=$(_distutils-r1_backend_to_key "${build_backend}")
- if [[ ${DISTUTILS_USE_PEP517} != ${expected_value} ]]; then
- eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!"
- eerror " have: DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}"
- eerror "expected: DISTUTILS_USE_PEP517=${expected_value}"
- eerror "(backend: ${build_backend})"
- die "DISTUTILS_USE_PEP517 value incorrect"
- fi
-
- # fix deprecated backends up
- local new_backend=
- case ${build_backend} in
- flit.buildapi)
- new_backend=flit_core.buildapi
- ;;
- pdm.pep517.api)
- new_backend=pdm.backend
- ;;
- poetry.masonry.api)
- new_backend=poetry.core.masonry.api
- ;;
- setuptools.build_meta:__legacy__)
- # this backend should only be used as implicit fallback
- new_backend=setuptools.build_meta
- ;;
- uv)
- new_backend=uv_build
- ;;
- esac
+ # get the preferred backend from the eclass
+ local backend_to_use=$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")
+ if [[ ${backend_to_use} != ${build_backend} ]]; then
+ # special-case deprecated backends
+ case ${build_backend} in
+ flit.buildapi)
+ ;;
+ pdm.pep517.api)
+ ;;
+ poetry.masonry.api)
+ ;;
+ setuptools.build_meta:__legacy__)
+ ;;
+ uv)
+ ;;
+ *)
+ eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!"
+ eerror " DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}"
+ eerror " implies backend: ${backend_to_use}"
+ eerror " pyproject.toml: ${build_backend}"
+ die "DISTUTILS_USE_PEP517 value incorrect"
+ esac
- if [[ -n ${new_backend} ]]; then
+ # if we didn't die, we're dealing with a deprecated backend
if [[ ! -f ${T}/.distutils_deprecated_backend_warned ]]; then
eqawarn "${build_backend} backend is deprecated. Please see:"
eqawarn "https://projects.gentoo.org/python/guide/qawarn.html#deprecated-pep-517-backends"
- eqawarn "The eclass will be using ${new_backend} instead."
+ eqawarn "The eclass will be using ${backend_to_use} instead."
> "${T}"/.distutils_deprecated_backend_warned || die
fi
- build_backend=${new_backend}
fi
- echo "${build_backend}"
+ echo "${backend_to_use}"
}
# @FUNCTION: distutils_wheel_install
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 09/11] distutils-r1.eclass: Support overriding PEP517 build backend
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (7 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 08/11] distutils-r1.eclass: Invert DISTUTILS_USE_PEP517 - backend mapping Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 10/11] dev-python/uv-build: Use DISTUTILS_UPSTREAM_PEP517 Michał Górny
` (3 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Add a DISTUTILS_UPSTREAM_PEP517 variable that drives the build backend
check, and can be used to override it when it is desirable to override
the backend used.
Closes: https://bugs.gentoo.org/951944
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 0ab42eba1f24..be61c49a8255 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -153,6 +153,20 @@
# files are found in ${BUILD_DIR}/install after python_install(), they
# will be merged into ${D}.
+# @ECLASS_VARIABLE: DISTUTILS_UPSTREAM_PEP517
+# @DESCRIPTION:
+# Specifies the PEP517 build backend used upstream. It is used
+# by the eclass to verify the correctness of DISTUTILS_USE_PEP517,
+# and matches DISTUTILS_USE_PEP517 by default. However, it can be
+# overriden to workaround the eclass check, when it is desirable
+# to build the wheel using other backend than the one used upstream.
+#
+# Please note that even in packages using PEP621 metadata, there can
+# be subtle differences between the behavior of different PEP517 build
+# backends, for example regarding finding package files. When using
+# this option, please make sure that the package is installed correctly.
+: "${DISTUTILS_UPSTREAM_PEP517:=${DISTUTILS_USE_PEP517}}"
+
# @ECLASS_VARIABLE: DISTUTILS_USE_SETUPTOOLS
# @DEFAULT_UNSET
# @PRE_INHERIT
@@ -1149,9 +1163,9 @@ _distutils-r1_get_backend() {
return
fi
- # get the preferred backend from the eclass
- local backend_to_use=$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")
- if [[ ${backend_to_use} != ${build_backend} ]]; then
+ # verify that the ebuild correctly specifies the build backend
+ local expected_backend=$(_distutils-r1_key_to_backend "${DISTUTILS_UPSTREAM_PEP517}")
+ if [[ ${expected_backend} != ${build_backend} ]]; then
# special-case deprecated backends
case ${build_backend} in
flit.buildapi)
@@ -1165,9 +1179,9 @@ _distutils-r1_get_backend() {
uv)
;;
*)
- eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!"
- eerror " DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}"
- eerror " implies backend: ${backend_to_use}"
+ eerror "DISTUTILS_UPSTREAM_PEP517 does not match pyproject.toml!"
+ eerror " DISTUTILS_UPSTREAM_PEP517=${DISTUTILS_USE_PEP517}"
+ eerror " implies backend: ${expected_backend}"
eerror " pyproject.toml: ${build_backend}"
die "DISTUTILS_USE_PEP517 value incorrect"
esac
@@ -1176,12 +1190,12 @@ _distutils-r1_get_backend() {
if [[ ! -f ${T}/.distutils_deprecated_backend_warned ]]; then
eqawarn "${build_backend} backend is deprecated. Please see:"
eqawarn "https://projects.gentoo.org/python/guide/qawarn.html#deprecated-pep-517-backends"
- eqawarn "The eclass will be using ${backend_to_use} instead."
+ eqawarn "The project should use ${expected_backend} instead."
> "${T}"/.distutils_deprecated_backend_warned || die
fi
fi
- echo "${backend_to_use}"
+ echo "$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")"
}
# @FUNCTION: distutils_wheel_install
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 10/11] dev-python/uv-build: Use DISTUTILS_UPSTREAM_PEP517
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (8 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 09/11] distutils-r1.eclass: Support overriding PEP517 build backend Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 11/11] distutils-r1.eclass: Reflow distutils-r1_python_compile() Michał Górny
` (2 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
dev-python/uv-build/uv-build-0.6.9.ebuild | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/dev-python/uv-build/uv-build-0.6.9.ebuild b/dev-python/uv-build/uv-build-0.6.9.ebuild
index a93405a17200..39fada98c1d0 100644
--- a/dev-python/uv-build/uv-build-0.6.9.ebuild
+++ b/dev-python/uv-build/uv-build-0.6.9.ebuild
@@ -4,6 +4,9 @@
EAPI=8
DISTUTILS_USE_PEP517=hatchling
+# maturin compiles uv-build executable for every impl, we do not want
+# that, so we hack hatchling into installing the Python module instead.
+DISTUTILS_UPSTREAM_PEP517=maturin
PYTHON_COMPAT=( pypy3 pypy3_11 python3_{10..13} )
inherit distutils-r1 pypi
@@ -31,14 +34,7 @@ src_prepare() {
distutils-r1_src_prepare
- # replace the upstream build system since we don't want maturin
- # to recompile uv again
- sed -i -e '/^\[build-system\]$/,$d' pyproject.toml || die
cat >> pyproject.toml <<-EOF || die
- [build-system]
- requires = ["hatchling"]
- build-backend = "hatchling.build"
-
[tool.hatch.build.targets.wheel]
packages = ["python/uv_build"]
EOF
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 11/11] distutils-r1.eclass: Reflow distutils-r1_python_compile()
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (9 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 10/11] dev-python/uv-build: Use DISTUTILS_UPSTREAM_PEP517 Michał Górny
@ 2025-03-25 20:16 ` Michał Górny
2025-03-26 8:27 ` [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Ulrich Müller
2025-03-26 11:34 ` [gentoo-dev] [PATCH 12/12] distutils-r1.eclass: Add a safety check for wheel install done Michał Górny
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-25 20:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Reflow distutils-r1_python_compile() to remove duplicate conditions
and improve readability.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 117 ++++++++++++++++++-------------------
1 file changed, 56 insertions(+), 61 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index be61c49a8255..7a28644252ba 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1484,71 +1484,66 @@ distutils-r1_python_compile() {
_python_check_EPYTHON
- case ${DISTUTILS_USE_PEP517:-unset} in
- no)
- return
- ;;
- unset)
- # legacy mode
- _distutils-r1_copy_egg_info
- esetup.py build -j "$(makeopts_jobs "${MAKEOPTS} ${*}")" "${@}"
- ;;
- *)
- # we do this for all build systems, since other backends
- # and custom hooks may wrap setuptools
- #
- # we are appending a dynamic component so that
- # distutils-r1_python_compile can be called multiple
- # times and don't end up combining resulting packages
- mkdir -p "${BUILD_DIR}" || die
- local -x DIST_EXTRA_CONFIG="${BUILD_DIR}/extra-setup.cfg"
- cat > "${DIST_EXTRA_CONFIG}" <<-EOF || die
- [build]
- build_base = ${BUILD_DIR}/build${#DISTUTILS_WHEELS[@]}
-
- [build_ext]
- parallel = $(makeopts_jobs "${MAKEOPTS} ${*}")
- EOF
- ;;
- esac
+ [[ ${DISTUTILS_USE_PEP517} == no ]] && return
- if [[ ${DISTUTILS_USE_PEP517} ]]; then
- if [[ ${DISTUTILS_ALLOW_WHEEL_REUSE} ]]; then
- local whl
- for whl in "${!DISTUTILS_WHEELS[@]}"; do
- # use only wheels corresponding to the current directory
- if [[ ${PWD} != ${DISTUTILS_WHEELS["${whl}"]} ]]; then
- continue
- fi
+ if [[ ! ${DISTUTILS_USE_PEP517} ]]; then
+ # legacy mode
+ _distutils-r1_copy_egg_info
+ esetup.py build -j "$(makeopts_jobs "${MAKEOPTS} ${*}")" "${@}"
+ return
+ fi
- # 1. Use pure Python wheels only if we're not expected
- # to build extensions. Otherwise, we may end up
- # not building the extension at all when e.g. PyPy3
- # is built without one.
- #
- # 2. For CPython, we can reuse stable ABI wheels. Note
- # that this relies on the assumption that we're building
- # from the oldest to the newest implementation,
- # and the wheels are forward-compatible.
- if [[
- ( ! ${DISTUTILS_EXT} && ${whl} == *py3-none-any* ) ||
- (
- ${EPYTHON} == python* &&
- # freethreading does not support stable ABI
- # at the moment
- ${EPYTHON} != *t &&
- ${whl} == *-abi3-*
- )
- ]]; then
- distutils_wheel_install "${BUILD_DIR}/install" "${whl}"
- return
- fi
- done
- fi
+ # we do this for all build systems, since other backends
+ # and custom hooks may wrap setuptools
+ #
+ # we are appending a dynamic component so that
+ # distutils-r1_python_compile can be called multiple
+ # times and don't end up combining resulting packages
+ mkdir -p "${BUILD_DIR}" || die
+ local -x DIST_EXTRA_CONFIG="${BUILD_DIR}/extra-setup.cfg"
+ cat > "${DIST_EXTRA_CONFIG}" <<-EOF || die
+ [build]
+ build_base = ${BUILD_DIR}/build${#DISTUTILS_WHEELS[@]}
+
+ [build_ext]
+ parallel = $(makeopts_jobs "${MAKEOPTS} ${*}")
+ EOF
+
+ if [[ ${DISTUTILS_ALLOW_WHEEL_REUSE} ]]; then
+ local whl
+ for whl in "${!DISTUTILS_WHEELS[@]}"; do
+ # use only wheels corresponding to the current directory
+ if [[ ${PWD} != ${DISTUTILS_WHEELS["${whl}"]} ]]; then
+ continue
+ fi
- distutils_pep517_install "${BUILD_DIR}/install"
- DISTUTILS_WHEELS+=( "${DISTUTILS_WHEEL_PATH}" "${PWD}" )
+ # 1. Use pure Python wheels only if we're not expected
+ # to build extensions. Otherwise, we may end up
+ # not building the extension at all when e.g. PyPy3
+ # is built without one.
+ #
+ # 2. For CPython, we can reuse stable ABI wheels. Note
+ # that this relies on the assumption that we're building
+ # from the oldest to the newest implementation,
+ # and the wheels are forward-compatible.
+ if [[
+ ( ! ${DISTUTILS_EXT} && ${whl} == *py3-none-any* ) ||
+ (
+ ${EPYTHON} == python* &&
+ # freethreading does not support stable ABI
+ # at the moment
+ ${EPYTHON} != *t &&
+ ${whl} == *-abi3-*
+ )
+ ]]; then
+ distutils_wheel_install "${BUILD_DIR}/install" "${whl}"
+ return
+ fi
+ done
fi
+
+ distutils_pep517_install "${BUILD_DIR}/install"
+ DISTUTILS_WHEELS+=( "${DISTUTILS_WHEEL_PATH}" "${PWD}" )
}
# @FUNCTION: _distutils-r1_wrap_scripts
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (10 preceding siblings ...)
2025-03-25 20:16 ` [gentoo-dev] [PATCH 11/11] distutils-r1.eclass: Reflow distutils-r1_python_compile() Michał Górny
@ 2025-03-26 8:27 ` Ulrich Müller
2025-03-26 8:30 ` Michał Górny
2025-03-26 11:34 ` [gentoo-dev] [PATCH 12/12] distutils-r1.eclass: Add a safety check for wheel install done Michał Górny
12 siblings, 1 reply; 17+ messages in thread
From: Ulrich Müller @ 2025-03-26 8:27 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 516 bytes --]
>>>>> On Tue, 25 Mar 2025, Michał Górny wrote:
> 5. We now make it easier to override the PEP517 backend used. You set
> DISTUTILS_UPSTREAM_PEP517 to the backend used upstream, and
> DISTUTILS_USE_PEP517 to the backend you want to use -- and you don't
> have to edit build-backend in pyproject.toml anymore. Most packages
> won't need it, and should just continue setting DISTUTILS_USE_PEP517.
These variable names confuse me since some time. How are they related to
distutils?
Ulrich
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support
2025-03-26 8:27 ` [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Ulrich Müller
@ 2025-03-26 8:30 ` Michał Górny
2025-03-26 8:37 ` Ulrich Müller
0 siblings, 1 reply; 17+ messages in thread
From: Michał Górny @ 2025-03-26 8:30 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
On Wed, 2025-03-26 at 09:27 +0100, Ulrich Müller wrote:
> > > > > > On Tue, 25 Mar 2025, Michał Górny wrote:
>
> > 5. We now make it easier to override the PEP517 backend used. You set
> > DISTUTILS_UPSTREAM_PEP517 to the backend used upstream, and
> > DISTUTILS_USE_PEP517 to the backend you want to use -- and you don't
> > have to edit build-backend in pyproject.toml anymore. Most packages
> > won't need it, and should just continue setting DISTUTILS_USE_PEP517.
>
> These variable names confuse me since some time. How are they related to
> distutils?
>
The eclass is called 'distutils-r1', so 'distutils' is the namespace for
all variables and functions.
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support
2025-03-26 8:30 ` Michał Górny
@ 2025-03-26 8:37 ` Ulrich Müller
2025-03-26 8:41 ` Michał Górny
0 siblings, 1 reply; 17+ messages in thread
From: Ulrich Müller @ 2025-03-26 8:37 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 884 bytes --]
>>>>> On Wed, 26 Mar 2025, Michał Górny wrote:
> On Wed, 2025-03-26 at 09:27 +0100, Ulrich Müller wrote:
>> > > > > > On Tue, 25 Mar 2025, Michał Górny wrote:
>>
>> > 5. We now make it easier to override the PEP517 backend used. You set
>> > DISTUTILS_UPSTREAM_PEP517 to the backend used upstream, and
>> > DISTUTILS_USE_PEP517 to the backend you want to use -- and you don't
>> > have to edit build-backend in pyproject.toml anymore. Most packages
>> > won't need it, and should just continue setting DISTUTILS_USE_PEP517.
>>
>> These variable names confuse me since some time. How are they related to
>> distutils?
> The eclass is called 'distutils-r1', so 'distutils' is the namespace for
> all variables and functions.
Then let me rephrase the question, why is the eclass called
distutils-r1? How is it related to distutils?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support
2025-03-26 8:37 ` Ulrich Müller
@ 2025-03-26 8:41 ` Michał Górny
0 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-26 8:41 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
On Wed, 2025-03-26 at 09:37 +0100, Ulrich Müller wrote:
> > > > > > On Wed, 26 Mar 2025, Michał Górny wrote:
>
> > On Wed, 2025-03-26 at 09:27 +0100, Ulrich Müller wrote:
> > > > > > > > On Tue, 25 Mar 2025, Michał Górny wrote:
> > >
> > > > 5. We now make it easier to override the PEP517 backend used. You set
> > > > DISTUTILS_UPSTREAM_PEP517 to the backend used upstream, and
> > > > DISTUTILS_USE_PEP517 to the backend you want to use -- and you don't
> > > > have to edit build-backend in pyproject.toml anymore. Most packages
> > > > won't need it, and should just continue setting DISTUTILS_USE_PEP517.
> > >
> > > These variable names confuse me since some time. How are they related to
> > > distutils?
>
> > The eclass is called 'distutils-r1', so 'distutils' is the namespace for
> > all variables and functions.
>
> Then let me rephrase the question, why is the eclass called
> distutils-r1? How is it related to distutils?
It is called distutils-r1 because it is a logical continuation of
distutils.eclass which was named this way back in 2002, when its primary
function was dealing with the distutils build system.
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [gentoo-dev] [PATCH 12/12] distutils-r1.eclass: Add a safety check for wheel install done
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
` (11 preceding siblings ...)
2025-03-26 8:27 ` [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Ulrich Müller
@ 2025-03-26 11:34 ` Michał Górny
12 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2025-03-26 11:34 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Add a safety check to verify that distutils_wheel_install is being
(usually indirectly) called in python_compile(), when using PEP517
build. If it weren't, this usually indicates that
distutils-r1_python_compile (or distutils_pep517_install) was not
called.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 7a28644252ba..2f173b741896 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1246,6 +1246,8 @@ distutils_wheel_install() {
-o -path '*.dist-info/licenses' \
-o -path '*.dist-info/zip-safe' \
\) -delete || die
+
+ _DISTUTILS_WHL_INSTALLED=1
}
# @VARIABLE: DISTUTILS_WHEEL_PATH
@@ -2011,6 +2013,11 @@ _distutils-r1_compare_installed_files() {
_distutils-r1_post_python_compile() {
debug-print-function ${FUNCNAME} "$@"
+ if [[ ! ${_DISTUTILS_WHL_INSTALLED} && ${DISTUTILS_USE_PEP517:-no} != no ]]
+ then
+ die "No wheel installed in python_compile(), did you call distutils-r1_python_compile?"
+ fi
+
local root=${BUILD_DIR}/install
if [[ ${DISTUTILS_USE_PEP517} && -d ${root} ]]; then
# copy executables to python-exec directory
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-03-26 11:35 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 20:16 [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 01/11] distutils-r1.eclass: Bump build system lower bounds Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 02/11] distutils-r1.eclass: Set FLIT_ALLOW_INVALID Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 03/11] dev-python/uv-build: New package, v0.6.9 Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 04/11] distutils-r1.eclass: Support uv-build backend Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 05/11] distutils-r1.eclass: Support the legacy "uv" backend too Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 06/11] distutils-r1.eclass: Use unique setuptools build directories Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 07/11] distutils-r1.eclass: Reflow _distutils-r1_backend_to_key() Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 08/11] distutils-r1.eclass: Invert DISTUTILS_USE_PEP517 - backend mapping Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 09/11] distutils-r1.eclass: Support overriding PEP517 build backend Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 10/11] dev-python/uv-build: Use DISTUTILS_UPSTREAM_PEP517 Michał Górny
2025-03-25 20:16 ` [gentoo-dev] [PATCH 11/11] distutils-r1.eclass: Reflow distutils-r1_python_compile() Michał Górny
2025-03-26 8:27 ` [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: uv-build support, setuptools build dir fixes, PEP517 backend override support Ulrich Müller
2025-03-26 8:30 ` Michał Górny
2025-03-26 8:37 ` Ulrich Müller
2025-03-26 8:41 ` Michał Górny
2025-03-26 11:34 ` [gentoo-dev] [PATCH 12/12] distutils-r1.eclass: Add a safety check for wheel install done Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox