commit:     c2366ca783f0e661358da697f0b15ee3c5b293be
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 24 05:20:05 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 24 06:11:01 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2366ca7

dev-python/uv-build: Dogfood the build backend into building itself

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/uv-build/uv-build-0.7.8.ebuild | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/dev-python/uv-build/uv-build-0.7.8.ebuild 
b/dev-python/uv-build/uv-build-0.7.8.ebuild
index 1eb48149a900..770145636992 100644
--- a/dev-python/uv-build/uv-build-0.7.8.ebuild
+++ b/dev-python/uv-build/uv-build-0.7.8.ebuild
@@ -3,10 +3,10 @@
 
 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
+# Maturin compiles uv-build executable for every impl, we do not want
+# that, so we use another backend.  And since we use another backend,
+# why not dogfood it in the first place?
+DISTUTILS_USE_PEP517=standalone
 PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
 
 inherit distutils-r1 pypi
@@ -28,12 +28,19 @@ RDEPEND="
 src_prepare() {
        distutils-r1_src_prepare
 
-       cat >> pyproject.toml <<-EOF || die
-               [tool.hatch.build.targets.wheel]
-               packages = ["python/uv_build"]
-       EOF
-
        # use the executable from dev-python/uv instead of building
        # a largely overlapping uv-build executable (at least for now)
        sed -i -e '/USE_UV_EXECUTABLE/s:False:True:' 
python/uv_build/__init__.py || die
+
+       # replace the build-system section
+       sed -i -e '/\[build-system\]/,$d' pyproject.toml || die
+       cat >> pyproject.toml <<-EOF || die
+               [build-system]
+               requires = []
+               build-backend = "uv_build"
+               backend-path = ["src"]
+       EOF
+
+       # rename to make uv-build find it
+       mv python src || die
 }

Reply via email to