dev-python/uv-build: New package, v0.6.11

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>
This commit is contained in:
Michał Górny
2025-03-22 17:24:56 +01:00
parent 43f125c015
commit 565223bf17
4 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST uv_build-0.6.11.tar.gz 292635 BLAKE2B 906d310f6884def53d4b739d0b2d246be4a2651b8add2ec94665128d9cd815830de9246ce5e7c1850842673d56c829547ebd1d707ca69984bbc15183f3ade0d8 SHA512 b68ff4c87b21bae1095ac622fdb4ed60610e44db9c73c0ae29c5566ee30ecdfee39a0c8a0659a70101c72dd04317de80f2ac7a377d2ad5a2c59fa4adabeb7c5b

View File

@@ -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)

View File

@@ -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>

View File

@@ -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
}