import rust-pyo3_0.19-0.19.2-4.el10

i10ce changed/i10ce/rust-pyo3_0.19-0.19.2-4.el10
Arkady L. Shane 1 week ago
commit b63b3d71dc
Signed by: tigro
GPG Key ID: 1EC08A25C9DB2503

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/pyo3-0.19.2.crate

@ -0,0 +1 @@
656aa07db46a4a6ea0481ff5955fca1d484a8dbd SOURCES/pyo3-0.19.2.crate

@ -0,0 +1,164 @@
From 13590693f15bdc8208e448adf1da5b828331aaac Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Wed, 26 Jun 2024 19:58:54 +0200
Subject: [PATCH] backport support for Python 3.13
---
src/conversions/std/num.rs | 113 ++++++++++++++++++++++++++++---------
1 file changed, 87 insertions(+), 26 deletions(-)
diff --git a/src/conversions/std/num.rs b/src/conversions/std/num.rs
index 3427942..9dd93cf 100644
--- a/src/conversions/std/num.rs
+++ b/src/conversions/std/num.rs
@@ -5,6 +5,8 @@ use crate::{
ToPyObject,
};
use std::convert::TryFrom;
+#[cfg(Py_3_13)]
+use std::convert::TryInto;
use std::num::{
NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize, NonZeroU128,
NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize,
@@ -169,7 +171,7 @@ mod fast_128bit_int_conversion {
// for 128bit Integers
macro_rules! int_convert_128 {
- ($rust_type: ty, $is_signed: expr) => {
+ ($rust_type: ty, $is_signed: literal) => {
impl ToPyObject for $rust_type {
#[inline]
fn to_object(&self, py: Python<'_>) -> PyObject {
@@ -178,18 +180,47 @@ mod fast_128bit_int_conversion {
}
impl IntoPy<PyObject> for $rust_type {
fn into_py(self, py: Python<'_>) -> PyObject {
- // Always use little endian
- let bytes = self.to_le_bytes();
- unsafe {
- PyObject::from_owned_ptr(
- py,
- ffi::_PyLong_FromByteArray(
- bytes.as_ptr() as *const std::os::raw::c_uchar,
- bytes.len(),
- 1,
- $is_signed,
- ),
- )
+ #[cfg(not(Py_3_13))]
+ {
+ let bytes = self.to_le_bytes();
+ unsafe {
+ PyObject::from_owned_ptr(
+ py,
+ ffi::_PyLong_FromByteArray(
+ bytes.as_ptr().cast(),
+ bytes.len(),
+ 1,
+ $is_signed.into(),
+ ),
+ )
+ }
+ }
+ #[cfg(Py_3_13)]
+ {
+ let bytes = self.to_ne_bytes();
+ if $is_signed {
+ unsafe {
+ PyObject::from_owned_ptr(
+ py,
+ ffi::PyLong_FromNativeBytes(
+ bytes.as_ptr().cast(),
+ bytes.len(),
+ ffi::Py_ASNATIVEBYTES_NATIVE_ENDIAN,
+ ),
+ )
+ }
+ } else {
+ unsafe {
+ PyObject::from_owned_ptr(
+ py,
+ ffi::PyLong_FromUnsignedNativeBytes(
+ bytes.as_ptr().cast(),
+ bytes.len(),
+ ffi::Py_ASNATIVEBYTES_NATIVE_ENDIAN,
+ ),
+ )
+ }
+ }
}
}
@@ -204,17 +235,47 @@ mod fast_128bit_int_conversion {
let num = unsafe {
PyObject::from_owned_ptr_or_err(ob.py(), ffi::PyNumber_Index(ob.as_ptr()))?
};
- let mut buffer = [0; std::mem::size_of::<$rust_type>()];
- crate::err::error_on_minusone(ob.py(), unsafe {
- ffi::_PyLong_AsByteArray(
- num.as_ptr() as *mut ffi::PyLongObject,
- buffer.as_mut_ptr(),
- buffer.len(),
- 1,
- $is_signed,
- )
- })?;
- Ok(<$rust_type>::from_le_bytes(buffer))
+ let mut buffer = [0u8; std::mem::size_of::<$rust_type>()];
+ #[cfg(not(Py_3_13))]
+ {
+ crate::err::error_on_minusone(ob.py(), unsafe {
+ ffi::_PyLong_AsByteArray(
+ num.as_ptr() as *mut ffi::PyLongObject,
+ buffer.as_mut_ptr(),
+ buffer.len(),
+ 1,
+ $is_signed.into(),
+ )
+ })?;
+ Ok(<$rust_type>::from_le_bytes(buffer))
+ }
+ #[cfg(Py_3_13)]
+ {
+ let mut flags = ffi::Py_ASNATIVEBYTES_NATIVE_ENDIAN;
+ if !$is_signed {
+ flags |= ffi::Py_ASNATIVEBYTES_UNSIGNED_BUFFER
+ | ffi::Py_ASNATIVEBYTES_REJECT_NEGATIVE;
+ }
+ let actual_size: usize = unsafe {
+ ffi::PyLong_AsNativeBytes(
+ num.as_ptr(),
+ buffer.as_mut_ptr().cast(),
+ buffer
+ .len()
+ .try_into()
+ .expect("length of buffer fits in Py_ssize_t"),
+ flags,
+ )
+ }
+ .try_into()
+ .map_err(|_| PyErr::fetch(ob.py()))?;
+ if actual_size as usize > buffer.len() {
+ return Err(crate::exceptions::PyOverflowError::new_err(
+ "Python int larger than 128 bits",
+ ));
+ }
+ Ok(<$rust_type>::from_ne_bytes(buffer))
+ }
}
#[cfg(feature = "experimental-inspect")]
@@ -225,8 +286,8 @@ mod fast_128bit_int_conversion {
};
}
- int_convert_128!(i128, 1);
- int_convert_128!(u128, 0);
+ int_convert_128!(i128, true);
+ int_convert_128!(u128, false);
}
// For ABI3 we implement the conversion manually.
--
2.45.2

@ -0,0 +1,43 @@
From 44d2a7bc66a583beee9b000a77cfa418aa28b79a Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Wed, 5 Jul 2023 19:13:56 +0200
Subject: [PATCH 1/3] ignore doctests with missing send_wrapper dependency
---
src/marker.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/marker.rs b/src/marker.rs
index 8912f66..5ac0106 100644
--- a/src/marker.rs
+++ b/src/marker.rs
@@ -66,7 +66,7 @@
//! This will "work" to smuggle Python references across the closure, because we're not actually
//! doing anything with threads:
//!
-//! ```rust, no_run
+//! ```rust, ignore
//! use pyo3::prelude::*;
//! use pyo3::types::PyString;
//! use send_wrapper::SendWrapper;
@@ -158,7 +158,7 @@ use std::os::raw::c_int;
/// This also implies that the interplay between `with_gil` and `allow_threads` is unsound, for example
/// one can circumvent this protection using the [`send_wrapper`](https://docs.rs/send_wrapper/) crate:
///
-/// ```no_run
+/// ```ignore
/// # use pyo3::prelude::*;
/// # use pyo3::types::PyString;
/// use send_wrapper::SendWrapper;
@@ -225,7 +225,7 @@ unsafe impl<T: Send> Ungil for T {}
/// On nightly Rust, this is not based on the [`Send`] auto trait and hence we are able
/// to prevent incorrectly circumventing it using e.g. the [`send_wrapper`](https://docs.rs/send_wrapper/) crate:
///
-/// ```compile_fail
+/// ```ignore
/// # use pyo3::prelude::*;
/// # use pyo3::types::PyString;
/// use send_wrapper::SendWrapper;
--
2.44.0

@ -0,0 +1,25 @@
From f5d0e9c16900ee863b0b6528b8df40dc7113b1c9 Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Tue, 23 Jan 2024 14:05:22 +0100
Subject: [PATCH 2/3] Skip a doctest that does not compile with Rust 1.74+
---
src/exceptions.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/exceptions.rs b/src/exceptions.rs
index 48a0986..48ad973 100644
--- a/src/exceptions.rs
+++ b/src/exceptions.rs
@@ -637,7 +637,7 @@ impl PyUnicodeDecodeError {
///
/// # Examples
///
- /// ```
+ /// ```rust, ignore
/// use pyo3::prelude::*;
/// use pyo3::exceptions::PyUnicodeDecodeError;
///
--
2.44.0

@ -0,0 +1,26 @@
From 4c266e662de58bd1dd7a5eb1cbb15982177a99ff Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Fri, 5 Apr 2024 11:08:53 +0200
Subject: [PATCH 3/3] drop deny(warnings) from doctests
---
src/lib.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
index 8114e79..30f4cd5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,8 +16,7 @@
deny(
rust_2018_idioms,
unused_lifetimes,
- rust_2021_prelude_collisions,
- warnings
+ rust_2021_prelude_collisions
),
allow(unused_variables, unused_assignments, unused_extern_crates)
)))]
--
2.44.0

@ -0,0 +1,30 @@
--- pyo3-0.19.2/Cargo.toml 1970-01-01T00:00:01+00:00
+++ pyo3-0.19.2/Cargo.toml 2023-11-13T23:14:39.566336+00:00
@@ -151,9 +151,6 @@
[dev-dependencies.rustversion]
version = "1.0"
-[dev-dependencies.send_wrapper]
-version = "0.6"
-
[dev-dependencies.serde]
version = "1.0"
features = ["derive"]
@@ -163,9 +160,6 @@
[dev-dependencies.trybuild]
version = ">=1.0.70"
-
-[dev-dependencies.widestring]
-version = "0.5.1"
[build-dependencies.pyo3-build-config]
version = "0.19.2"
@@ -219,7 +213,6 @@
"experimental-inspect",
"rust_decimal",
]
-generate-import-lib = ["pyo3-ffi/generate-import-lib"]
macros = [
"pyo3-macros",
"indoc",

@ -0,0 +1,431 @@
## START: Set by rpmautospec
## (rpmautospec version 0.6.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 4;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
# Generated by rust2rpm 25
%bcond_without check
%global debug_package %{nil}
%global crate pyo3
Name: rust-pyo3_0.19
Version: 0.19.2
Release: %autorelease
Summary: Bindings to Python interpreter
License: Apache-2.0
URL: https://crates.io/crates/pyo3
Source: %{crates_source}
# Manually created patch for downstream crate metadata changes
# * drop send_wrapper and widestring dev-dependencies (not packaged yet)
# * drop MSVC- and MinGW-only features
Patch: pyo3-fix-metadata.diff
# * skip the single doctest that depends on send_wrapper
Patch: 0001-ignore-doctests-with-missing-send_wrapper-dependency.patch
# * skip a doctest that does not compile with Rust 1.74+
Patch: 0002-Skip-a-doctest-that-does-not-compile-with-Rust-1.74.patch
# * drop deny(warnings) from doctests to fix building with recent Rust
Patch: 0003-drop-deny-warnings-from-doctests.patch
# backport support for Python 3.13: https://github.com/PyO3/pyo3/pull/4184
Patch: 0001-backport-support-for-Python-3.13.patch
BuildRequires: cargo-rpm-macros >= 24
%global _description %{expand:
Bindings to Python interpreter.}
%description %{_description}
%package devel
Summary: %{summary}
BuildArch: noarch
%description devel %{_description}
This package contains library source intended for building other packages which
use the "%{crate}" crate.
%files devel
%license %{crate_instdir}/LICENSE
%doc %{crate_instdir}/Architecture.md
%doc %{crate_instdir}/CHANGELOG.md
%doc %{crate_instdir}/Code-of-Conduct.md
%doc %{crate_instdir}/Contributing.md
%doc %{crate_instdir}/README.md
%doc %{crate_instdir}/Releasing.md
%{crate_instdir}/
%package -n %{name}+default-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+default-devel %{_description}
This package contains library source intended for building other packages which
use the "default" feature of the "%{crate}" crate.
%files -n %{name}+default-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+abi3-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+abi3-devel %{_description}
This package contains library source intended for building other packages which
use the "abi3" feature of the "%{crate}" crate.
%files -n %{name}+abi3-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+abi3-py310-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+abi3-py310-devel %{_description}
This package contains library source intended for building other packages which
use the "abi3-py310" feature of the "%{crate}" crate.
%files -n %{name}+abi3-py310-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+abi3-py311-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+abi3-py311-devel %{_description}
This package contains library source intended for building other packages which
use the "abi3-py311" feature of the "%{crate}" crate.
%files -n %{name}+abi3-py311-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+abi3-py37-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+abi3-py37-devel %{_description}
This package contains library source intended for building other packages which
use the "abi3-py37" feature of the "%{crate}" crate.
%files -n %{name}+abi3-py37-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+abi3-py38-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+abi3-py38-devel %{_description}
This package contains library source intended for building other packages which
use the "abi3-py38" feature of the "%{crate}" crate.
%files -n %{name}+abi3-py38-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+abi3-py39-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+abi3-py39-devel %{_description}
This package contains library source intended for building other packages which
use the "abi3-py39" feature of the "%{crate}" crate.
%files -n %{name}+abi3-py39-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+anyhow-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+anyhow-devel %{_description}
This package contains library source intended for building other packages which
use the "anyhow" feature of the "%{crate}" crate.
%files -n %{name}+anyhow-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+auto-initialize-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+auto-initialize-devel %{_description}
This package contains library source intended for building other packages which
use the "auto-initialize" feature of the "%{crate}" crate.
%files -n %{name}+auto-initialize-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+chrono-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+chrono-devel %{_description}
This package contains library source intended for building other packages which
use the "chrono" feature of the "%{crate}" crate.
%files -n %{name}+chrono-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+experimental-inspect-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+experimental-inspect-devel %{_description}
This package contains library source intended for building other packages which
use the "experimental-inspect" feature of the "%{crate}" crate.
%files -n %{name}+experimental-inspect-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+extension-module-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+extension-module-devel %{_description}
This package contains library source intended for building other packages which
use the "extension-module" feature of the "%{crate}" crate.
%files -n %{name}+extension-module-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+eyre-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+eyre-devel %{_description}
This package contains library source intended for building other packages which
use the "eyre" feature of the "%{crate}" crate.
%files -n %{name}+eyre-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+full-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+full-devel %{_description}
This package contains library source intended for building other packages which
use the "full" feature of the "%{crate}" crate.
%files -n %{name}+full-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+hashbrown-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+hashbrown-devel %{_description}
This package contains library source intended for building other packages which
use the "hashbrown" feature of the "%{crate}" crate.
%files -n %{name}+hashbrown-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+indexmap-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+indexmap-devel %{_description}
This package contains library source intended for building other packages which
use the "indexmap" feature of the "%{crate}" crate.
%files -n %{name}+indexmap-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+indoc-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+indoc-devel %{_description}
This package contains library source intended for building other packages which
use the "indoc" feature of the "%{crate}" crate.
%files -n %{name}+indoc-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+inventory-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+inventory-devel %{_description}
This package contains library source intended for building other packages which
use the "inventory" feature of the "%{crate}" crate.
%files -n %{name}+inventory-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+macros-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+macros-devel %{_description}
This package contains library source intended for building other packages which
use the "macros" feature of the "%{crate}" crate.
%files -n %{name}+macros-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+multiple-pymethods-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+multiple-pymethods-devel %{_description}
This package contains library source intended for building other packages which
use the "multiple-pymethods" feature of the "%{crate}" crate.
%files -n %{name}+multiple-pymethods-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+nightly-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+nightly-devel %{_description}
This package contains library source intended for building other packages which
use the "nightly" feature of the "%{crate}" crate.
%files -n %{name}+nightly-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+num-bigint-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+num-bigint-devel %{_description}
This package contains library source intended for building other packages which
use the "num-bigint" feature of the "%{crate}" crate.
%files -n %{name}+num-bigint-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+num-complex-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+num-complex-devel %{_description}
This package contains library source intended for building other packages which
use the "num-complex" feature of the "%{crate}" crate.
%files -n %{name}+num-complex-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+pyo3-macros-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+pyo3-macros-devel %{_description}
This package contains library source intended for building other packages which
use the "pyo3-macros" feature of the "%{crate}" crate.
%files -n %{name}+pyo3-macros-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+rust_decimal-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+rust_decimal-devel %{_description}
This package contains library source intended for building other packages which
use the "rust_decimal" feature of the "%{crate}" crate.
%files -n %{name}+rust_decimal-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+serde-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+serde-devel %{_description}
This package contains library source intended for building other packages which
use the "serde" feature of the "%{crate}" crate.
%files -n %{name}+serde-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+unindent-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+unindent-devel %{_description}
This package contains library source intended for building other packages which
use the "unindent" feature of the "%{crate}" crate.
%files -n %{name}+unindent-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version} -p1
# drop files that are not useful
rm -r emscripten/ newsfragments/
# drop the tests for which dependencies were removed
rm tests/test_pep_587.rs
%cargo_prep
%generate_buildrequires
# unit tests require optional dependencies
%cargo_generate_buildrequires -a
%build
%cargo_build
%install
%cargo_install
%if %{with check}
%check
# * unit tests require an UTF-8 locale
# * unit tests require the "auto-initialize" feature
export LANG=C.utf8
%cargo_test -f auto-initialize -- -- --skip doc_test::guide_migration_md
%endif
%changelog
* Sun Jan 05 2025 Arkady L. Shane <tigro@msvsphere-os.ru> - 0.19.2-4
- Rebuilt for MSVSphere 10
## START: Generated by rpmautospec
* Wed Jun 26 2024 Fabio Valentini <decathorpe@gmail.com> - 0.19.2-4
- Backport support for Python 3.13
* Fri Apr 05 2024 Fabio Valentini <decathorpe@gmail.com> - 0.19.2-3
- Drop deny(warnings) from doctests to fix building with recent Rust
* Tue Jan 23 2024 Fabio Valentini <decathorpe@gmail.com> - 0.19.2-2
- Skip a doctest that does not compile with Rust 1.74+
* Mon Nov 13 2023 Fabio Valentini <decathorpe@gmail.com> - 0.19.2-1
- Initial import (pyo3 0.19 compat package)
## END: Generated by rpmautospec
Loading…
Cancel
Save