From db4a2fccd131b87d5b3f1a90813b150e13ce0f90 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Mon, 9 Dec 2024 14:23:20 +0100 Subject: [PATCH] Initial import (pyo3 0.22 compat package) --- .gitignore | 1 + ...nterpreter-support-available-via-cfg.patch | 25 + README.md | 3 - pyo3-fix-metadata.diff | 28 + rust-pyo3_0.22.spec | 497 ++++++++++++++++++ rust2rpm.toml | 21 + sources | 1 + 7 files changed, 573 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch delete mode 100644 README.md create mode 100644 pyo3-fix-metadata.diff create mode 100644 rust-pyo3_0.22.spec create mode 100644 rust2rpm.toml create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bcebd6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/pyo3-0.22.6.crate diff --git a/0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch b/0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch new file mode 100644 index 0000000..ffcdfb6 --- /dev/null +++ b/0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch @@ -0,0 +1,25 @@ +From d59176bc05aa37838fd4a8dd253f47c962f61118 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Tue, 23 Jul 2024 14:41:04 +0200 +Subject: [PATCH] Make unsafe subinterpreter support available via cfg flag + +--- + src/impl_/pymodule.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/impl_/pymodule.rs b/src/impl_/pymodule.rs +index b05652b..94555ff 100644 +--- a/src/impl_/pymodule.rs ++++ b/src/impl_/pymodule.rs +@@ -107,7 +107,7 @@ impl ModuleDef { + // that static data is not reused across interpreters. + // + // PyPy does not have subinterpreters, so no need to check interpreter ID. +- #[cfg(not(any(PyPy, GraalPy)))] ++ #[cfg(not(any(PyPy, GraalPy, pyo3_unsafe_allow_subinterpreters)))] + { + // PyInterpreterState_Get is only available on 3.9 and later, but is missing + // from python3.dll for Windows stable API on 3.9 +-- +2.45.2 + diff --git a/README.md b/README.md deleted file mode 100644 index 3e572b5..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rust-pyo3_0.22 - -The rust-pyo3_0.22 package diff --git a/pyo3-fix-metadata.diff b/pyo3-fix-metadata.diff new file mode 100644 index 0000000..ca73295 --- /dev/null +++ b/pyo3-fix-metadata.diff @@ -0,0 +1,28 @@ +--- pyo3-0.22.6/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ pyo3-0.22.6/Cargo.toml 2024-12-09T13:18:06.269935+00:00 +@@ -248,7 +248,7 @@ + default-features = false + + [dependencies.chrono-tz] +-version = ">= 0.6, < 0.10" ++version = ">= 0.6, < 0.11" + optional = true + default-features = false + +@@ -328,7 +328,7 @@ + version = "0.4.25" + + [dev-dependencies.chrono-tz] +-version = ">= 0.6, < 0.10" ++version = ">= 0.6, < 0.11" + + [dev-dependencies.futures] + version = "0.3.28" +@@ -423,7 +423,6 @@ + "serde", + "smallvec", + ] +-generate-import-lib = ["pyo3-ffi/generate-import-lib"] + gil-refs = ["pyo3-macros/gil-refs"] + macros = [ + "pyo3-macros", diff --git a/rust-pyo3_0.22.spec b/rust-pyo3_0.22.spec new file mode 100644 index 0000000..a41fe02 --- /dev/null +++ b/rust-pyo3_0.22.spec @@ -0,0 +1,497 @@ +# Generated by rust2rpm 27 +%bcond check 1 +%global debug_package %{nil} + +%global crate pyo3 + +Name: rust-pyo3_0.22 +Version: 0.22.6 +Release: %autorelease +Summary: Bindings to Python interpreter + +License: MIT OR Apache-2.0 +URL: https://crates.io/crates/pyo3 +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# * relax chrono-tz dependency to allow building with 0.6..=0.10 +# * drop MSVC- and MinGW-only features +Patch: pyo3-fix-metadata.diff +# * make unsafe subinterpreter support available via cfg flag: +# https://bugzilla.redhat.com/show_bug.cgi?id=2298403 +Patch2: 0001-Make-unsafe-subinterpreter-support-available-via-cfg.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-APACHE +%license %{crate_instdir}/LICENSE-MIT +%license %{crate_instdir}/pyo3-runtime/LICENSE-APACHE +%license %{crate_instdir}/pyo3-runtime/LICENSE-MIT +%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-py312-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+abi3-py312-devel %{_description} + +This package contains library source intended for building other packages which +use the "abi3-py312" feature of the "%{crate}" crate. + +%files -n %{name}+abi3-py312-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}+chrono-tz-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+chrono-tz-devel %{_description} + +This package contains library source intended for building other packages which +use the "chrono-tz" feature of the "%{crate}" crate. + +%files -n %{name}+chrono-tz-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+either-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+either-devel %{_description} + +This package contains library source intended for building other packages which +use the "either" feature of the "%{crate}" crate. + +%files -n %{name}+either-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+experimental-async-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+experimental-async-devel %{_description} + +This package contains library source intended for building other packages which +use the "experimental-async" feature of the "%{crate}" crate. + +%files -n %{name}+experimental-async-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}+gil-refs-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+gil-refs-devel %{_description} + +This package contains library source intended for building other packages which +use the "gil-refs" feature of the "%{crate}" crate. + +%files -n %{name}+gil-refs-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}+num-rational-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+num-rational-devel %{_description} + +This package contains library source intended for building other packages which +use the "num-rational" feature of the "%{crate}" crate. + +%files -n %{name}+num-rational-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+py-clone-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+py-clone-devel %{_description} + +This package contains library source intended for building other packages which +use the "py-clone" feature of the "%{crate}" crate. + +%files -n %{name}+py-clone-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}+smallvec-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+smallvec-devel %{_description} + +This package contains library source intended for building other packages which +use the "smallvec" feature of the "%{crate}" crate. + +%files -n %{name}+smallvec-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 +%cargo_prep +# drop files that are not useful +rm -r emscripten/ newsfragments/ + +%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 +%endif + +%changelog +%autochangelog diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..da9b47c --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,21 @@ +[package] +cargo-toml-patch-comments = [ + "relax chrono-tz dependency to allow building with 0.6..=0.10", + "drop MSVC- and MinGW-only features", +] +doc-files.exclude = [".towncrier.template.md"] + +[[package.extra-patches]] +number = 2 +file = "0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch" +comments = ["""\ +make unsafe subinterpreter support available via cfg flag: +https://bugzilla.redhat.com/show_bug.cgi?id=2298403""", +] + +[scripts] +prep.post = [ + "# drop files that are not useful", + "rm -r emscripten/ newsfragments/", +] + diff --git a/sources b/sources new file mode 100644 index 0000000..90cbac8 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (pyo3-0.22.6.crate) = d746007eae22f5b7bbf173759c61cbd2aa893898d88b8be5680a0237deec4d113246edf5f62fbbec3579ad4bd7307499b94b887ec306112ffe3df5190fe70e44