From b9ab196aac992ab15d8222d921820bcdba6aee56 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 18 Apr 2024 10:04:43 +0200 Subject: [PATCH] Allow unsupported Python versions in RPM builds --- ...ported-Python-versions-in-RPM-builds.patch | 33 +++++++++++++++++++ rust-pyo3-ffi.spec | 7 ++++ 2 files changed, 40 insertions(+) create mode 100644 Allow-unsupported-Python-versions-in-RPM-builds.patch diff --git a/Allow-unsupported-Python-versions-in-RPM-builds.patch b/Allow-unsupported-Python-versions-in-RPM-builds.patch new file mode 100644 index 0000000..739b254 --- /dev/null +++ b/Allow-unsupported-Python-versions-in-RPM-builds.patch @@ -0,0 +1,33 @@ +From af6273b4fbc1c9439a9b1e69761838479ba4bd71 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Thu, 18 Apr 2024 09:48:04 +0200 +Subject: [PATCH] Allow unsupported Python versions in RPM builds + +Downstream-only patch: always allow unsupported versions of Python. +In Fedora, we constantly attempt to integrate alpha and beta releases of Python +and rebuild all dependent packages in Copr. We need to be able to build the +packages that use pyo3-ffi without patching each and every one of them, +hence we explicitly allow to skip version check when building RPMs. +--- + build.rs | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/build.rs b/build.rs +index 286767d..ef666d7 100644 +--- a/build.rs ++++ b/build.rs +@@ -36,6 +36,11 @@ fn ensure_python_version(interpreter_config: &InterpreterConfig) -> Result<()> { + return Ok(()); + } + ++ // Skip version check when building RPMs - we want to build them with unsupported Python versions too ++ if std::env::var("RPM_BUILD_ROOT").as_deref().is_ok() { ++ return Ok(()); ++ } ++ + match interpreter_config.implementation { + PythonImplementation::CPython => { + let versions = SUPPORTED_VERSIONS_CPYTHON; +-- +2.44.0 + diff --git a/rust-pyo3-ffi.spec b/rust-pyo3-ffi.spec index 2743953..b5c0441 100644 --- a/rust-pyo3-ffi.spec +++ b/rust-pyo3-ffi.spec @@ -16,6 +16,13 @@ Source: %{crates_source} # * drop MSVC- and MinGW-only features Patch: pyo3-ffi-fix-metadata.diff +# Downstream-only patch: always allow unsupported versions of Python. +# We constantly attempt to integrate alpha and beta releases of Python +# and need to rebuild all dependent packages in Copr, also those that +# use pyo3-ffi without patching each and every one of them, +# hence we explicitly allow to skip version check when building RPMs. +Patch: Allow-unsupported-Python-versions-in-RPM-builds.patch + BuildRequires: cargo-rpm-macros >= 24 BuildRequires: python3-devel >= 3.7