# uv-build -- the PEP 517 build backend of the uv project. # # Upstream publishes it as the standalone `uv-build` PyPI package built from # crates/uv-build: a small Rust binary plus the pure-Python `uv_build` module # that build frontends import and that dispatches to the binary. # # Source tarball top level directory: %{name}-%{version} %global pypi_name uv-build %global crate uv-build # The release profile upstream uses carries no DWARF, so the debug info # extracted by find-debuginfo is empty and rpmbuild aborts with # "Empty %files file debugfiles.list". %global debug_package %{nil} Name: python-%{pypi_name} Version: 0.8.13 Release: 1%{?dist} Summary: The uv build backend License: MIT OR Apache-2.0 URL: https://github.com/astral-sh/uv Source0: https://github.com/astral-sh/uv/archive/refs/tags/%{version}/uv-%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: %{name}-vendor.tar.gz BuildRequires: rust >= 1.86 BuildRequires: cargo BuildRequires: gcc BuildRequires: python3-devel %description uv-build is uv's native build backend for pure Python projects. It implements the PEP 517 and PEP 660 hooks (build_wheel, build_sdist, build_editable, prepare_metadata_for_build_wheel, ...) and is considerably faster than the generic pure-Python backends, at the cost of only supporting pure Python code. The hooks live in a small Rust binary; the uv_build module is a thin Python shim that dispatches to it. %package -n python3-%{pypi_name} Summary: The uv build backend Provides: python3dist(%{pypi_name}) = %{version} %description -n python3-%{pypi_name} uv-build is uv's native build backend for pure Python projects. It implements the PEP 517 and PEP 660 hooks (build_wheel, build_sdist, build_editable, prepare_metadata_for_build_wheel, ...) and is considerably faster than the generic pure-Python backends, at the cost of only supporting pure Python code. The hooks live in a small Rust binary; the uv_build module is a thin Python shim that dispatches to it. %prep %autosetup -n %{name}-%{version} # Unpack the vendored crates: the COPR builders have no network access, so the # build has to run against a local replacement of the crate sources. # The replacement map was produced by `cargo vendor` on the upstream tree. tar -xf %{SOURCE1} mkdir -p .cargo cat > .cargo/config.toml << 'EOF' [source.crates-io] replace-with = "vendored-sources" [source."git+https://github.com/astral-sh/pubgrub?rev=06ec5a5f59ffaeb6cf5079c6cb184467da06c9db"] git = "https://github.com/astral-sh/pubgrub" rev = "06ec5a5f59ffaeb6cf5079c6cb184467da06c9db" replace-with = "vendored-sources" [source."git+https://github.com/astral-sh/reqwest-middleware?rev=ad8b9d332d1773fde8b4cd008486de5973e0a3f8"] git = "https://github.com/astral-sh/reqwest-middleware" rev = "ad8b9d332d1773fde8b4cd008486de5973e0a3f8" replace-with = "vendored-sources" [source."git+https://github.com/astral-sh/rs-async-zip?rev=285e48742b74ab109887d62e1ae79e7c15fd4878"] git = "https://github.com/astral-sh/rs-async-zip" rev = "285e48742b74ab109887d62e1ae79e7c15fd4878" replace-with = "vendored-sources" [source."git+https://github.com/astral-sh/tl.git?rev=6e25b2ee2513d75385101a8ff9f591ef51f314ec"] git = "https://github.com/astral-sh/tl.git" rev = "6e25b2ee2513d75385101a8ff9f591ef51f314ec" replace-with = "vendored-sources" [source.vendored-sources] directory = "vendor/" EOF %build cargo build --release --offline --locked -p %{crate} %check # The upstream Rust test-suite needs network access and test fixtures that are # not part of the vendored sources, so it cannot run here. Smoke-test the # backend binary instead: `uv-build --help` is upstream's own smoke test. %{buildroot}%{_bindir}/%{crate} --help %install install -Dpm0755 target/release/%{crate} %{buildroot}%{_bindir}/%{crate} # uv_build is the pure-Python shim, shipped from crates/%{crate}/python. mkdir -p %{buildroot}%{python3_sitelib}/uv_build install -pm0644 crates/%{crate}/python/uv_build/__init__.py \ crates/%{crate}/python/uv_build/__main__.py \ crates/%{crate}/python/uv_build/py.typed \ %{buildroot}%{python3_sitelib}/uv_build/ # Upstream builds this project with maturin, which is what normally emits the # dist-info directory. Building with cargo directly means emitting that # metadata here; it is what makes the distribution visible to # importlib.metadata and to the RPM python3dist() dependency generator. distinfo=%{buildroot}%{python3_sitelib}/uv_build-%{version}.dist-info mkdir -p "$distinfo" cat > "$distinfo/METADATA" <=3.8 EOF cat > "$distinfo/WHEEL" < "$distinfo/top_level.txt" cat > "$distinfo/RECORD" < - 0.8.13-1 - Initial package