|
| 1 | +# Copyright 1999-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +CRATES=" |
| 7 | +" |
| 8 | + |
| 9 | +declare -A GIT_CRATES=( |
| 10 | + [async_zip]='https://github.com/charliermarsh/rs-async-zip;1dcb40cfe1bf5325a6fd4bfcf9894db40241f585;rs-async-zip-%commit%' |
| 11 | + [pubgrub]='https://github.com/astral-sh/pubgrub;0e684a874c9fb8f74738cd8875524c80e3d4820b;pubgrub-%commit%' |
| 12 | +) |
| 13 | + |
| 14 | +inherit cargo check-reqs |
| 15 | + |
| 16 | +CRATE_P=${P} |
| 17 | +DESCRIPTION="A Python package installer and resolver, written in Rust" |
| 18 | +HOMEPAGE=" |
| 19 | + https://github.com/astral-sh/uv/ |
| 20 | + https://pypi.org/project/uv/ |
| 21 | +" |
| 22 | +# pypi sdist misses scripts/, needed for tests |
| 23 | +SRC_URI=" |
| 24 | + https://github.com/astral-sh/uv/archive/${PV}.tar.gz |
| 25 | + -> ${P}.gh.tar.gz |
| 26 | + ${CARGO_CRATE_URIS} |
| 27 | +" |
| 28 | +if [[ ${PKGBUMPING} != ${PVR} ]]; then |
| 29 | + SRC_URI+=" |
| 30 | + https://dev.gentoo.org/~mgorny/dist/${CRATE_P}-crates.tar.xz |
| 31 | + " |
| 32 | +fi |
| 33 | + |
| 34 | +# most of the code |
| 35 | +LICENSE="|| ( Apache-2.0 MIT )" |
| 36 | +# crates/pep508-rs is || ( Apache-2.0 BSD-2 ) which is covered below |
| 37 | +# Dependent crate licenses |
| 38 | +LICENSE+=" |
| 39 | + 0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD ISC MIT |
| 40 | + MPL-2.0 Unicode-DFS-2016 |
| 41 | +" |
| 42 | +# ring crate |
| 43 | +LICENSE+=" openssl" |
| 44 | +SLOT="0" |
| 45 | +KEYWORDS="amd64 arm arm64 x86" |
| 46 | +IUSE="test" |
| 47 | +RESTRICT="test" |
| 48 | +PROPERTIES="test_network" |
| 49 | + |
| 50 | +DEPEND=" |
| 51 | + dev-libs/libgit2:= |
| 52 | +" |
| 53 | +RDEPEND=" |
| 54 | + ${DEPEND} |
| 55 | +" |
| 56 | +BDEPEND=" |
| 57 | + >=virtual/rust-1.77 |
| 58 | + test? ( |
| 59 | + dev-lang/python:3.8 |
| 60 | + dev-lang/python:3.9 |
| 61 | + dev-lang/python:3.10 |
| 62 | + dev-lang/python:3.11 |
| 63 | + dev-lang/python:3.12 |
| 64 | + ) |
| 65 | +" |
| 66 | + |
| 67 | +QA_FLAGS_IGNORED="usr/bin/.*" |
| 68 | + |
| 69 | +check_space() { |
| 70 | + local CHECKREQS_DISK_BUILD=3G |
| 71 | + use debug && CHECKREQS_DISK_BUILD=9G |
| 72 | + check-reqs_pkg_setup |
| 73 | +} |
| 74 | + |
| 75 | +pkg_pretend() { |
| 76 | + check_space |
| 77 | +} |
| 78 | + |
| 79 | +pkg_setup() { |
| 80 | + check_space |
| 81 | +} |
| 82 | + |
| 83 | +src_prepare() { |
| 84 | + # https://github.com/astral-sh/uv/pull/3569 |
| 85 | + eapply "${FILESDIR}/${P}-test.patch" |
| 86 | + default |
| 87 | + |
| 88 | + # https://github.com/vorot93/tokio-tar/pull/23 |
| 89 | + # (fortunately uv already depends on portable-atomic, so we don't |
| 90 | + # have to fight Cargo.lock) |
| 91 | + cd "${WORKDIR}/cargo_home/gentoo/tokio-tar-0.3.1" || die |
| 92 | + eapply "${FILESDIR}/tokio-tar-0.3.1-ppc.patch" |
| 93 | +} |
| 94 | + |
| 95 | +src_configure() { |
| 96 | + local myfeatures=( |
| 97 | + # from upstream defaults |
| 98 | + flate2/zlib-ng |
| 99 | + python |
| 100 | + pypi |
| 101 | + git |
| 102 | + maturin |
| 103 | + # skip tests that require specific patch version of the interpreter: |
| 104 | + # python-patch |
| 105 | + ) |
| 106 | + |
| 107 | + cargo_src_configure --no-default-features |
| 108 | +} |
| 109 | + |
| 110 | +src_compile() { |
| 111 | + cd crates/uv || die |
| 112 | + cargo_src_compile |
| 113 | +} |
| 114 | + |
| 115 | +src_test() { |
| 116 | + cd crates/uv || die |
| 117 | + cargo_src_test --no-fail-fast |
| 118 | +} |
| 119 | + |
| 120 | +src_install() { |
| 121 | + cd crates/uv || die |
| 122 | + cargo_src_install |
| 123 | +} |
0 commit comments