mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-25 14:21:36 +02:00
dev-util/maturin: Sync with Gentoo
It's from Gentoo commit 3dc43d07adcb3f8944470ff6a5e3dc856a1c63f4. Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
parent
035e69a8ce
commit
fcdaece1a3
@ -1,7 +1,3 @@
|
||||
DIST maturin-1.8.6-vendor.tar.xz 15035340 BLAKE2B 0bc4016f460c704ac2be81af27842f65ddec9c69ea6a7c29fc421dc863c629109e4efbb6d87825d05c8d33f9e4803eb63081726a8d6d6dcd710c78ed6bca6f9c SHA512 c338cf375640f75d9b9c0151ea9e4ba99781ec6ca065f39e27020c37ce0505c085844d16426df8597063e1f15a965575150a0b25fe6bfc3841c483a45a80a12d
|
||||
DIST maturin-1.8.6.gh.tar.gz 551946 BLAKE2B 4fbeadeb25b69e99286238c9f7b7acb2bdde05242af760a0279664277334831a8cd03db49ddb3a0d528b6acd827d3ee3863e283318270ee53c3710c103c7461f SHA512 2616b3bcdbb96c77a3efeda5a24841675fded9d1299507c64905c94e57af15afa855c329f013a1e36527c2b8de4bf7acfb060e5d2828558da658a7b86d88bf8f
|
||||
DIST maturin-1.9.1-vendor.tar.xz 15643332 BLAKE2B cf7fd445186c5de8d09c99eb4a270b85c547bcf8dddf891c24bf0d2a75f634f49115de7841b1bce88c97391d784119e9dd4873a6a4903735443ce05958056a3b SHA512 93665219f09bb16f1abcf810bc60e3b9056521d42b03d5b42d03e76ad782f56c86f1ead5077ab260eb530ff444dd16cd7ce18df89cd72d3ac8f6dcb588f46582
|
||||
DIST maturin-1.9.1.gh.tar.gz 559847 BLAKE2B 8c69a437f7cabb71242e231baefb02b2f5c2a2f361318ddbcab18055d13b08836f36d690eac55307c61134e15f03511ea6bf711288f10871aff9578be41e6b44 SHA512 d4bc9994966cc654f109596a65d450924bdfd84b2ad5c1ea21ab93f8861b313258e0c60edc0843eeeb7d0d975a2f64f76d784868f1ef301fbb7748fc1ce56b96
|
||||
DIST maturin-1.9.3-vendor.tar.xz 15638528 BLAKE2B bde95efcdcf0bcd0e559df0753b402756c1b8fa354c9be0b927f9dc969adb6b0b186914c6f35fcc0d7a02919c28e882de6b4d779fd51037ae3d6e963b23a1f16 SHA512 a3441ea6fd36e9284f6f8229ba2e370f5f43130e7bc4437e21d6a1612fb07b0671f29d98c2092c848db5dc22e1072ce06ae75f33bdc6a59e9297273c1fedcaf4
|
||||
DIST maturin-1.9.3.gh.tar.gz 563145 BLAKE2B a9b303d9279f007ce86f51fb423787e53e8a86e9c0cfda03795d85c8e781eca8141258e2ce7eeb8c0841205f69005d14ded6641e631cab872d2337c5e7f9969c SHA512 9c0c2e428db725b2f6e3bd06b166e2bb3448018c8f3b2e3e85effc4294cb0b7f25918761ac2fce70b4e98890b3f3fbeb93db64f5e5de39886d009ba8bc62a707
|
||||
DIST maturin-1.9.4-vendor.tar.xz 15870760 BLAKE2B 8ea5a26d618fc2698ecf0a264a81d41a28b0e74602dc6004c6a72788c1b5f7e65e9efbc56e2e2b2418f550055ff4510bdb7d77445472da300a495d31a3e84a11 SHA512 901ff4dd5901ea21f6f0ef6c055e58f3592ef651f95c413669f4fabdc009c55a453247866ab23a4ebf4c0a1b987084eeb9719d0f474ec72587bc0fba964958e2
|
||||
|
||||
@ -1,175 +0,0 @@
|
||||
This may or may not be correct, but maturin itself does not use pyo3
|
||||
and it should be fine as long as the tests pass (aka, it builds
|
||||
rust packages for tests, and these are the ones using pyo3).
|
||||
|
||||
[patch] directive is used to override the (older) pyo3-ffi that
|
||||
is also vendored but patch does not apply to, this also skip
|
||||
checking hashes at same time. Note that it prints a harmless
|
||||
warning when done here for packages that do not use pyo3-ffi
|
||||
but this is simpler than doing it per-test-package.
|
||||
|
||||
https://github.com/PyO3/pyo3/pull/4760
|
||||
--- a/.cargo/config.toml
|
||||
+++ b/.cargo/config.toml
|
||||
@@ -4,2 +4,5 @@
|
||||
[source.vendored-sources]
|
||||
directory = "vendor"
|
||||
+
|
||||
+[patch.crates-io]
|
||||
+pyo3-ffi = { path = "vendor/pyo3-ffi-0.23.4" }
|
||||
--- a/vendor/pyo3-ffi-0.23.4/build.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/build.rs
|
||||
@@ -26,5 +26,5 @@
|
||||
max: PythonVersion {
|
||||
major: 3,
|
||||
- minor: 10,
|
||||
+ minor: 11,
|
||||
},
|
||||
};
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/abstract_.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/abstract_.rs
|
||||
@@ -4,5 +4,8 @@
|
||||
|
||||
#[inline]
|
||||
-#[cfg(all(not(Py_3_13), not(PyPy)))] // CPython exposed as a function in 3.13, in object.h
|
||||
+#[cfg(all(
|
||||
+ not(Py_3_13), // CPython exposed as a function in 3.13, in object.h
|
||||
+ not(all(PyPy, not(Py_3_11))) // PyPy exposed as a function until PyPy 3.10, macro in 3.11+
|
||||
+))]
|
||||
pub unsafe fn PyObject_DelAttrString(o: *mut PyObject, attr_name: *const c_char) -> c_int {
|
||||
PyObject_SetAttrString(o, attr_name, std::ptr::null_mut())
|
||||
@@ -10,5 +13,8 @@
|
||||
|
||||
#[inline]
|
||||
-#[cfg(all(not(Py_3_13), not(PyPy)))] // CPython exposed as a function in 3.13, in object.h
|
||||
+#[cfg(all(
|
||||
+ not(Py_3_13), // CPython exposed as a function in 3.13, in object.h
|
||||
+ not(all(PyPy, not(Py_3_11))) // PyPy exposed as a function until PyPy 3.10, macro in 3.11+
|
||||
+))]
|
||||
pub unsafe fn PyObject_DelAttr(o: *mut PyObject, attr_name: *mut PyObject) -> c_int {
|
||||
PyObject_SetAttr(o, attr_name, std::ptr::null_mut())
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/abstract_.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/abstract_.rs
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{PyObject, Py_ssize_t};
|
||||
-#[cfg(not(all(Py_3_11, GraalPy)))]
|
||||
+#[cfg(any(all(Py_3_8, not(any(PyPy, GraalPy))), not(Py_3_11)))]
|
||||
use std::os::raw::c_char;
|
||||
use std::os::raw::c_int;
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/genobject.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/genobject.rs
|
||||
@@ -3,5 +3,5 @@
|
||||
#[cfg(not(any(PyPy, GraalPy)))]
|
||||
use crate::_PyErr_StackItem;
|
||||
-#[cfg(all(Py_3_11, not(GraalPy)))]
|
||||
+#[cfg(all(Py_3_11, not(any(PyPy, GraalPy))))]
|
||||
use std::os::raw::c_char;
|
||||
use std::os::raw::c_int;
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/mod.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/mod.rs
|
||||
@@ -72,5 +72,5 @@
|
||||
pub use self::pydebug::*;
|
||||
pub use self::pyerrors::*;
|
||||
-#[cfg(Py_3_11)]
|
||||
+#[cfg(all(Py_3_11, not(PyPy)))]
|
||||
pub use self::pyframe::*;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/object.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/object.rs
|
||||
@@ -311,7 +311,7 @@
|
||||
#[cfg(Py_3_9)]
|
||||
pub ht_module: *mut object::PyObject,
|
||||
- #[cfg(Py_3_11)]
|
||||
+ #[cfg(all(Py_3_11, not(PyPy)))]
|
||||
_ht_tpname: *mut c_char,
|
||||
- #[cfg(Py_3_11)]
|
||||
+ #[cfg(all(Py_3_11, not(PyPy)))]
|
||||
_spec_cache: _specialization_cache,
|
||||
}
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/objimpl.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/objimpl.rs
|
||||
@@ -1,3 +1,3 @@
|
||||
-#[cfg(not(all(Py_3_11, GraalPy)))]
|
||||
+#[cfg(not(all(Py_3_11, any(PyPy, GraalPy))))]
|
||||
use libc::size_t;
|
||||
use std::os::raw::c_int;
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/pyframe.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/pyframe.rs
|
||||
@@ -1,2 +1,2 @@
|
||||
-#[cfg(Py_3_11)]
|
||||
+#[cfg(all(Py_3_11, not(PyPy)))]
|
||||
opaque_struct!(_PyInterpreterFrame);
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/pystate.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/pystate.rs
|
||||
@@ -70,5 +70,5 @@
|
||||
}
|
||||
|
||||
-#[cfg(all(Py_3_9, not(Py_3_11)))]
|
||||
+#[cfg(all(Py_3_9, not(any(Py_3_11, PyPy))))]
|
||||
pub type _PyFrameEvalFunction = extern "C" fn(
|
||||
*mut crate::PyThreadState,
|
||||
@@ -77,5 +77,5 @@
|
||||
) -> *mut crate::object::PyObject;
|
||||
|
||||
-#[cfg(Py_3_11)]
|
||||
+#[cfg(all(Py_3_11, not(PyPy)))]
|
||||
pub type _PyFrameEvalFunction = extern "C" fn(
|
||||
*mut crate::PyThreadState,
|
||||
@@ -84,5 +84,5 @@
|
||||
) -> *mut crate::object::PyObject;
|
||||
|
||||
-#[cfg(Py_3_9)]
|
||||
+#[cfg(all(Py_3_9, not(PyPy)))]
|
||||
extern "C" {
|
||||
/// Get the frame evaluation function.
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/cpython/unicodeobject.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/cpython/unicodeobject.rs
|
||||
@@ -1,3 +1,3 @@
|
||||
-#[cfg(not(PyPy))]
|
||||
+#[cfg(any(Py_3_11, not(PyPy)))]
|
||||
use crate::Py_hash_t;
|
||||
use crate::{PyObject, Py_UCS1, Py_UCS2, Py_UCS4, Py_ssize_t};
|
||||
@@ -252,5 +252,5 @@
|
||||
pub ob_base: PyObject,
|
||||
pub length: Py_ssize_t,
|
||||
- #[cfg(not(PyPy))]
|
||||
+ #[cfg(any(Py_3_11, not(PyPy)))]
|
||||
pub hash: Py_hash_t,
|
||||
/// A bit field with various properties.
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/object.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/object.rs
|
||||
@@ -437,5 +437,5 @@
|
||||
arg3: *mut PyObject,
|
||||
) -> c_int;
|
||||
- #[cfg(any(Py_3_13, PyPy))] // CPython defined in 3.12 as an inline function in abstract.h
|
||||
+ #[cfg(any(Py_3_13, all(PyPy, not(Py_3_11))))] // CPython defined in 3.12 as an inline function in abstract.h
|
||||
#[cfg_attr(PyPy, link_name = "PyPyObject_DelAttrString")]
|
||||
pub fn PyObject_DelAttrString(arg1: *mut PyObject, arg2: *const c_char) -> c_int;
|
||||
@@ -461,5 +461,5 @@
|
||||
pub fn PyObject_SetAttr(arg1: *mut PyObject, arg2: *mut PyObject, arg3: *mut PyObject)
|
||||
-> c_int;
|
||||
- #[cfg(any(Py_3_13, PyPy))] // CPython defined in 3.12 as an inline function in abstract.h
|
||||
+ #[cfg(any(Py_3_13, all(PyPy, not(Py_3_11))))] // CPython defined in 3.12 as an inline function in abstract.h
|
||||
#[cfg_attr(PyPy, link_name = "PyPyObject_DelAttr")]
|
||||
pub fn PyObject_DelAttr(arg1: *mut PyObject, arg2: *mut PyObject) -> c_int;
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/pybuffer.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/pybuffer.rs
|
||||
@@ -104,5 +104,9 @@
|
||||
|
||||
/// Maximum number of dimensions
|
||||
-pub const PyBUF_MAX_NDIM: c_int = if cfg!(PyPy) { 36 } else { 64 };
|
||||
+pub const PyBUF_MAX_NDIM: usize = if cfg!(all(PyPy, not(Py_3_11))) {
|
||||
+ 36
|
||||
+} else {
|
||||
+ 64
|
||||
+};
|
||||
|
||||
/* Flags for getting buffers */
|
||||
--- a/vendor/pyo3-ffi-0.23.4/src/pyerrors.rs
|
||||
+++ b/vendor/pyo3-ffi-0.23.4/src/pyerrors.rs
|
||||
@@ -117,4 +117,5 @@
|
||||
pub static mut PyExc_BaseException: *mut PyObject;
|
||||
#[cfg(Py_3_11)]
|
||||
+ #[cfg_attr(PyPy, link_name = "PyPyExc_BaseExceptionGroup")]
|
||||
pub static mut PyExc_BaseExceptionGroup: *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyExc_Exception")]
|
||||
@ -1,156 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
DISTUTILS_UPSTREAM_PEP517=standalone
|
||||
PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
|
||||
RUST_MIN_VER=1.75.0
|
||||
inherit cargo distutils-r1 flag-o-matic shell-completion toolchain-funcs
|
||||
|
||||
DESCRIPTION="Build and publish crates with pyo3, rust-cpython and cffi bindings"
|
||||
HOMEPAGE="https://www.maturin.rs/"
|
||||
SRC_URI="
|
||||
https://github.com/PyO3/maturin/archive/refs/tags/v${PV}.tar.gz
|
||||
-> ${P}.gh.tar.gz
|
||||
https://dev.gentoo.org/~ionen/distfiles/${P}-vendor.tar.xz
|
||||
"
|
||||
# ^ tarball also includes test-crates' Cargo.lock(s) crates for tests
|
||||
|
||||
# rustls+ring is unused, so openssl license can be skipped
|
||||
LICENSE="|| ( Apache-2.0 MIT ) doc? ( CC-BY-4.0 OFL-1.1 )"
|
||||
LICENSE+="
|
||||
0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD Boost-1.0 MIT
|
||||
MPL-2.0 Unicode-3.0 Unicode-DFS-2016
|
||||
" # crates
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
||||
IUSE="doc +ssl test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
DEPEND="
|
||||
app-arch/xz-utils
|
||||
ssl? ( dev-libs/openssl:= )
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
BDEPEND="
|
||||
virtual/pkgconfig
|
||||
doc? ( app-text/mdbook )
|
||||
test? (
|
||||
$(python_gen_cond_dep 'dev-python/cffi[${PYTHON_USEDEP}]' 'python*')
|
||||
dev-python/boltons[${PYTHON_USEDEP}]
|
||||
dev-python/virtualenv[${PYTHON_USEDEP}]
|
||||
dev-vcs/git
|
||||
elibc_musl? ( dev-util/patchelf )
|
||||
)
|
||||
"
|
||||
|
||||
QA_FLAGS_IGNORED="usr/bin/${PN}"
|
||||
|
||||
src_prepare() {
|
||||
distutils-r1_src_prepare
|
||||
|
||||
# we build the Rust executable (just once) via cargo_src_compile
|
||||
sed -i -e '/setuptools_rust/d' -e '/rust_extensions/d' setup.py || die
|
||||
|
||||
if use test; then
|
||||
# used to prevent use of network during tests, and silence pip
|
||||
# if it finds unrelated issues with system packages (bug #913613)
|
||||
cat > "${T}"/pip.conf <<-EOF || die
|
||||
[global]
|
||||
quiet = 2
|
||||
|
||||
[install]
|
||||
no-index = yes
|
||||
no-dependencies = yes
|
||||
EOF
|
||||
|
||||
# uv does not work easily w/ network-sandbox, force virtualenv
|
||||
sed -i 's/"uv"/"uv-not-found"/' tests/common/mod.rs || die
|
||||
|
||||
# increase timeouts for tests (bug #950332)
|
||||
sed -i '/^#\[timeout/s/secs(60)/secs(300)/' tests/run.rs || die
|
||||
|
||||
# used by *git_sdist_generator tests
|
||||
git init -q || die
|
||||
git config --global user.email "larry@gentoo.org" || die
|
||||
git config --global user.name "Larry the Cow" || die
|
||||
git add . || die
|
||||
git commit -qm init || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
export OPENSSL_NO_VENDOR=1
|
||||
|
||||
# https://github.com/rust-lang/stacker/issues/79
|
||||
use s390 && ! is-flagq '-march=*' &&
|
||||
append-cflags $(test-flags-CC -march=z10)
|
||||
|
||||
local myfeatures=(
|
||||
# like release.yml + native-tls for better platform support than rustls
|
||||
full
|
||||
password-storage
|
||||
$(usev ssl native-tls)
|
||||
)
|
||||
|
||||
cargo_src_configure --no-default-features
|
||||
}
|
||||
|
||||
python_compile_all() {
|
||||
cargo_src_compile
|
||||
|
||||
use !doc || mdbook build -d html guide || die
|
||||
|
||||
if ! tc-is-cross-compiler; then
|
||||
local maturin=$(cargo_target_dir)/maturin
|
||||
"${maturin}" completions bash > "${T}"/${PN} || die
|
||||
"${maturin}" completions fish > "${T}"/${PN}.fish || die
|
||||
"${maturin}" completions zsh > "${T}"/_${PN} || die
|
||||
else
|
||||
ewarn "shell completion files were skipped due to cross-compilation"
|
||||
fi
|
||||
}
|
||||
|
||||
python_test() {
|
||||
local -x MATURIN_TEST_PYTHON=${EPYTHON}
|
||||
local -x PIP_CONFIG_FILE=${T}/pip.conf
|
||||
local -x VIRTUALENV_SYSTEM_SITE_PACKAGES=1
|
||||
|
||||
# need this for (new) python versions not yet recognized by pyo3
|
||||
local -x PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
|
||||
|
||||
local skip=(
|
||||
# picky cli output test that easily benignly fail (bug #937992)
|
||||
--skip cli_tests
|
||||
# avoid need for wasm over a single hello world test
|
||||
--skip integration_wasm_hello_world
|
||||
# fragile depending on rust version, also wants libpypy*-c.so for pypy
|
||||
--skip pyo3_no_extension_module
|
||||
# unimportant tests that require uv, and not obvious to get it
|
||||
# to work with network-sandbox (not worth the trouble)
|
||||
--skip develop_hello_world::case_2
|
||||
--skip develop_pyo3_ffi_pure::case_2
|
||||
# compliance test using zig requires an old libc to pass (bug #946967)
|
||||
--skip integration_pyo3_mixed_py_subdir
|
||||
# fails on sparc since rust-1.74 (bug #934573), skip for now given
|
||||
# should not affect the pep517 backend which is all we need on sparc
|
||||
$(usev sparc '--skip build_context::test::test_macosx_deployment_target')
|
||||
)
|
||||
|
||||
cargo_src_test -- "${skip[@]}"
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
cargo_src_install
|
||||
|
||||
dodoc Changelog.md README.md
|
||||
use doc && dodoc -r guide/html
|
||||
|
||||
if ! tc-is-cross-compiler; then
|
||||
dobashcomp "${T}"/${PN}
|
||||
dofishcomp "${T}"/${PN}.fish
|
||||
dozshcomp "${T}"/_${PN}
|
||||
fi
|
||||
}
|
||||
@ -1,157 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
DISTUTILS_UPSTREAM_PEP517=standalone
|
||||
PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
|
||||
RUST_MIN_VER=1.75.0
|
||||
inherit cargo distutils-r1 flag-o-matic shell-completion toolchain-funcs
|
||||
|
||||
DESCRIPTION="Build and publish crates with pyo3, rust-cpython and cffi bindings"
|
||||
HOMEPAGE="https://www.maturin.rs/"
|
||||
SRC_URI="
|
||||
https://github.com/PyO3/maturin/archive/refs/tags/v${PV}.tar.gz
|
||||
-> ${P}.gh.tar.gz
|
||||
https://dev.gentoo.org/~ionen/distfiles/${P}-vendor.tar.xz
|
||||
"
|
||||
# ^ tarball also includes test-crates' Cargo.lock(s) crates for tests
|
||||
|
||||
LICENSE="|| ( Apache-2.0 MIT ) doc? ( CC-BY-4.0 OFL-1.1 )"
|
||||
LICENSE+="
|
||||
0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD Boost-1.0 MIT
|
||||
MPL-2.0 Unicode-3.0 Unicode-DFS-2016
|
||||
" # crates
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
||||
IUSE="doc +ssl test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
app-arch/xz-utils
|
||||
app-arch/zstd:=
|
||||
ssl? ( dev-libs/openssl:= )
|
||||
"
|
||||
DEPEND="${RDEPEND}"
|
||||
BDEPEND="
|
||||
virtual/pkgconfig
|
||||
doc? ( app-text/mdbook )
|
||||
test? (
|
||||
$(python_gen_cond_dep 'dev-python/cffi[${PYTHON_USEDEP}]' 'python*')
|
||||
dev-python/boltons[${PYTHON_USEDEP}]
|
||||
dev-python/virtualenv[${PYTHON_USEDEP}]
|
||||
dev-vcs/git
|
||||
elibc_musl? ( dev-util/patchelf )
|
||||
)
|
||||
"
|
||||
|
||||
QA_FLAGS_IGNORED="usr/bin/${PN}"
|
||||
|
||||
src_prepare() {
|
||||
distutils-r1_src_prepare
|
||||
|
||||
# we build the Rust executable (just once) via cargo_src_compile
|
||||
sed -i -e '/setuptools_rust/d' -e '/rust_extensions/d' setup.py || die
|
||||
|
||||
if use test; then
|
||||
# used to prevent use of network during tests, and silence pip
|
||||
# if it finds unrelated issues with system packages (bug #913613)
|
||||
cat > "${T}"/pip.conf <<-EOF || die
|
||||
[global]
|
||||
quiet = 2
|
||||
|
||||
[install]
|
||||
no-index = yes
|
||||
no-dependencies = yes
|
||||
EOF
|
||||
|
||||
# uv does not work easily w/ network-sandbox, force virtualenv
|
||||
sed -i 's/"uv"/"uv-not-found"/' tests/common/mod.rs || die
|
||||
|
||||
# increase timeouts for tests (bug #950332)
|
||||
sed -i '/^#\[timeout/s/secs(60)/secs(300)/' tests/run.rs || die
|
||||
|
||||
# used by *git_sdist_generator tests
|
||||
git init -q || die
|
||||
git config --global user.email "larry@gentoo.org" || die
|
||||
git config --global user.name "Larry the Cow" || die
|
||||
git add . || die
|
||||
git commit -qm init || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
export OPENSSL_NO_VENDOR=1
|
||||
export ZSTD_SYS_USE_PKG_CONFIG=1
|
||||
|
||||
# https://github.com/rust-lang/stacker/issues/79
|
||||
use s390 && ! is-flagq '-march=*' &&
|
||||
append-cflags $(test-flags-CC -march=z10)
|
||||
|
||||
local myfeatures=(
|
||||
# like release.yml + native-tls for better platform support than rustls
|
||||
full
|
||||
password-storage
|
||||
$(usev ssl native-tls)
|
||||
)
|
||||
|
||||
cargo_src_configure --no-default-features
|
||||
}
|
||||
|
||||
python_compile_all() {
|
||||
cargo_src_compile
|
||||
|
||||
use !doc || mdbook build -d html guide || die
|
||||
|
||||
if ! tc-is-cross-compiler; then
|
||||
local maturin=$(cargo_target_dir)/maturin
|
||||
"${maturin}" completions bash > "${T}"/${PN} || die
|
||||
"${maturin}" completions fish > "${T}"/${PN}.fish || die
|
||||
"${maturin}" completions zsh > "${T}"/_${PN} || die
|
||||
else
|
||||
ewarn "shell completion files were skipped due to cross-compilation"
|
||||
fi
|
||||
}
|
||||
|
||||
python_test() {
|
||||
local -x MATURIN_TEST_PYTHON=${EPYTHON}
|
||||
local -x PIP_CONFIG_FILE=${T}/pip.conf
|
||||
local -x VIRTUALENV_SYSTEM_SITE_PACKAGES=1
|
||||
|
||||
# need this for (new) python versions not yet recognized by pyo3
|
||||
local -x PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
|
||||
|
||||
local skip=(
|
||||
# picky cli output test that easily benignly fail (bug #937992)
|
||||
--skip cli_tests
|
||||
# avoid need for wasm over a single hello world test
|
||||
--skip integration_wasm_hello_world
|
||||
# fragile depending on rust version, also wants libpypy*-c.so for pypy
|
||||
--skip pyo3_no_extension_module
|
||||
# unimportant tests that require uv, and not obvious to get it
|
||||
# to work with network-sandbox (not worth the trouble)
|
||||
--skip develop_hello_world::case_2
|
||||
--skip develop_pyo3_ffi_pure::case_2
|
||||
# compliance test using zig requires an old libc to pass (bug #946967)
|
||||
--skip integration_pyo3_mixed_py_subdir
|
||||
# fails on sparc since rust-1.74 (bug #934573), skip for now given
|
||||
# should not affect the pep517 backend which is all we need on sparc
|
||||
$(usev sparc '--skip build_context::test::test_macosx_deployment_target')
|
||||
)
|
||||
|
||||
cargo_src_test -- "${skip[@]}"
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
cargo_src_install
|
||||
|
||||
dodoc Changelog.md README.md
|
||||
use doc && dodoc -r guide/html
|
||||
|
||||
if ! tc-is-cross-compiler; then
|
||||
dobashcomp "${T}"/${PN}
|
||||
dofishcomp "${T}"/${PN}.fish
|
||||
dozshcomp "${T}"/_${PN}
|
||||
fi
|
||||
}
|
||||
@ -24,7 +24,7 @@ LICENSE+="
|
||||
MPL-2.0 Unicode-3.0 Unicode-DFS-2016
|
||||
" # crates
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
||||
IUSE="doc +ssl test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
@ -141,7 +141,7 @@ python_test() {
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
cargo_src_install
|
||||
dobin "$(cargo_target_dir)"/maturin
|
||||
|
||||
dodoc Changelog.md README.md
|
||||
use doc && dodoc -r guide/html
|
||||
|
||||
@ -141,7 +141,7 @@ python_test() {
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
cargo_src_install
|
||||
dobin "$(cargo_target_dir)"/maturin
|
||||
|
||||
dodoc Changelog.md README.md
|
||||
use doc && dodoc -r guide/html
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user