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 <mgo...@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>pyt...@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 +}