From 894e5fdbab22025774159020d622ac829fc405ee Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sun, 2 Nov 2025 16:52:43 +0100 Subject: [PATCH] maturin: clean up; use submitted patch Some patches/updates are not needed without the upload feature which we don't build. Switch to the patch proposed upstream and add a downstream patch to allow "MSYS" in platform.system(). --- maturin/0002-cygwin-support.patch | 110 ------------------------- maturin/0003-allow-msys-too.patch | 13 +++ maturin/PKGBUILD | 38 +++------ maturin/getrandom-support-cygwin.patch | 23 ------ maturin/maturin-update-deps.patch | 11 --- maturin/tar-rs-update-deps.patch | 9 -- 6 files changed, 24 insertions(+), 180 deletions(-) delete mode 100644 maturin/0002-cygwin-support.patch create mode 100644 maturin/0003-allow-msys-too.patch delete mode 100644 maturin/getrandom-support-cygwin.patch delete mode 100644 maturin/maturin-update-deps.patch delete mode 100644 maturin/tar-rs-update-deps.patch diff --git a/maturin/0002-cygwin-support.patch b/maturin/0002-cygwin-support.patch deleted file mode 100644 index ade688c4..00000000 --- a/maturin/0002-cygwin-support.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- maturin-1.9.6/src/target/mod.rs.orig 2025-10-07 14:34:28.000000000 +0200 -+++ maturin-1.9.6/src/target/mod.rs 2025-10-27 18:39:27.311185000 +0100 -@@ -43,6 +43,7 @@ - Wasi, - Aix, - Hurd, -+ Cygwin, - } - - impl fmt::Display for Os { -@@ -63,6 +64,7 @@ - Os::Wasi => write!(f, "Wasi"), - Os::Aix => write!(f, "AIX"), - Os::Hurd => write!(f, "Hurd"), -+ Os::Cygwin => write!(f, "Cygwin"), - } - } - } -@@ -209,6 +211,7 @@ - Os::Emscripten | Os::Wasi => vec![Arch::Wasm32], - Os::Aix => vec![Arch::Powerpc64], - Os::Hurd => vec![Arch::X86, Arch::X86_64], -+ Os::Cygwin => vec![Arch::X86, Arch::X86_64], - } - } - -@@ -283,6 +286,7 @@ - OperatingSystem::Wasi | OperatingSystem::WasiP1 | OperatingSystem::WasiP2 => Os::Wasi, - OperatingSystem::Aix => Os::Aix, - OperatingSystem::Hurd => Os::Hurd, -+ OperatingSystem::Cygwin => Os::Cygwin, - unsupported => bail!("The operating system {:?} is not supported", unsupported), - }; - -@@ -463,6 +467,7 @@ - Os::Wasi => "wasi", - Os::Aix => "aix", - Os::Hurd => "gnu", -+ Os::Cygwin => "cygwin", - } - } - -@@ -558,7 +563,8 @@ - | Os::Emscripten - | Os::Wasi - | Os::Aix -- | Os::Hurd => true, -+ | Os::Hurd -+ | Os::Cygwin => true, - } - } - ---- maturin-1.9.6/src/python_interpreter/mod.rs.orig 2025-10-07 14:34:28.000000000 +0200 -+++ maturin-1.9.6/src/python_interpreter/mod.rs 2025-10-27 18:57:13.775589900 +0100 -@@ -292,6 +292,8 @@ - if bridge != &BridgeModel::Cffi - && target.get_python_os() != message.system - && !target.cross_compiling() -+ && !((target.get_python_os() == "cygwin" && message.system.to_lowercase().starts_with("cygwin")) -+ || (target.get_python_os() == "cygwin" && message.system.to_lowercase().starts_with("msys"))) - { - bail!( - "platform.system() in python, {}, and the rust target, {:?}, don't match ಠ_ಠ", ---- maturin-1.9.6/src/target/mod.rs.orig 2025-10-07 14:34:28.000000000 +0200 -+++ maturin-1.9.6/src/target/mod.rs 2025-10-27 20:03:22.265265400 +0100 -@@ -610,6 +610,12 @@ - self.env == Environment::Msvc - } - -+ /// Returns true if the current platform is cygwin -+ #[inline] -+ pub fn is_cygwin(&self) -> bool { -+ self.os == Os::Cygwin -+ } -+ - /// Returns true if the current platform is illumos - #[inline] - pub fn is_illumos(&self) -> bool { ---- maturin-1.9.6/src/module_writer.rs.orig 2025-10-07 14:34:28.000000000 +0200 -+++ maturin-1.9.6/src/module_writer.rs 2025-10-27 20:04:48.501685200 +0100 -@@ -855,7 +855,11 @@ - let ext_name = &project_layout.extension_name; - let so_filename = if is_abi3 { - if target.is_unix() { -- format!("{ext_name}.abi3.so") -+ if target.is_cygwin() { -+ format!("{ext_name}.abi3.dll") -+ } else { -+ format!("{ext_name}.abi3.so") -+ } - } else { - match python_interpreter { - Some(python_interpreter) if python_interpreter.is_windows_debug() => { ---- maturin-1.9.6/src/build_context.rs.orig 2025-10-28 08:12:15.861576600 +0100 -+++ maturin-1.9.6/src/build_context.rs 2025-10-28 08:12:32.743321400 +0100 -@@ -664,6 +664,14 @@ - (Os::Wasi, Arch::Wasm32) => { - "any".to_string() - } -+ // Cygwin -+ (Os::Cygwin, _) => { -+ format!( -+ "{}_{}", -+ target.target_os().to_string().to_ascii_lowercase(), -+ target.get_platform_arch()?, -+ ) -+ } - // osname_release_machine fallback for any POSIX system - (_, _) => { - let info = PlatformInfo::new() diff --git a/maturin/0003-allow-msys-too.patch b/maturin/0003-allow-msys-too.patch new file mode 100644 index 00000000..f3f72abe --- /dev/null +++ b/maturin/0003-allow-msys-too.patch @@ -0,0 +1,13 @@ +--- a/src/python_interpreter/mod.rs.orig 2025-11-02 16:41:44.189964600 +0100 ++++ a/src/python_interpreter/mod.rs 2025-11-02 16:42:33.331858400 +0100 +@@ -292,8 +292,8 @@ + if bridge != &BridgeModel::Cffi + && target.get_python_os() != message.system + && !target.cross_compiling() +- && !(target.get_python_os() == "cygwin" +- && message.system.to_lowercase().starts_with("cygwin")) ++ && !((target.get_python_os() == "cygwin" && message.system.to_lowercase().starts_with("cygwin")) ++ || (target.get_python_os() == "cygwin" && message.system.to_lowercase().starts_with("msys"))) + { + bail!( + "platform.system() in python, {}, and the rust target, {:?}, don't match ಠ_ಠ", diff --git a/maturin/PKGBUILD b/maturin/PKGBUILD index d0888cc9..5b4aed18 100644 --- a/maturin/PKGBUILD +++ b/maturin/PKGBUILD @@ -3,7 +3,7 @@ pkgbase=maturin pkgname=("python-maturin" "maturin") pkgver=1.9.6 -pkgrel=5 +pkgrel=6 pkgdesc='Build and publish crates with pyo3, rust-cpython and cffi bindings' arch=('x86_64') url='https://www.maturin.rs/' @@ -21,42 +21,26 @@ makedepends=( "pkgconf") options=('!strip') source=("https://pypi.org/packages/source/${pkgbase::1}/${pkgbase}/${pkgbase}-${pkgver}.tar.gz" - "tar-0.4.43.tar.gz::https://crates.io/api/v1/crates/tar/0.4.43/download" - "getrandom-0.2.15.tar.gz::https://crates.io/api/v1/crates/getrandom/0.2.15/download" - "maturin-update-deps.patch" - "tar-rs-update-deps.patch" - "getrandom-support-cygwin.patch" - "0002-cygwin-support.patch") + "https://github.com/PyO3/maturin/commit/608963e067b905940658b5cb06d7fc04595a0536.patch" + "0003-allow-msys-too.patch") sha256sums=('2c2ae37144811d365509889ed7220b0598487f1278c2441829c3abf56cc6324a' - 'c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6' - 'c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7' - '36bb5955216d19aed9a8fb2ec9440e7e3133de2e7d5ed1da2ad2204d449a2095' - '2422ed08564445528695499757258aecde785bb6e95cde2d88f4b2cefe8417d8' - 'acac76aa379bc45285f067524d7c5adceb3100698d72ae150a6b626a137e947d' - 'ac3db306951aa32131b5f793b3cb03b7db8c3629015a5549d7c54acff64d5812') + '5e636be1400a660a83a4ae2b8e5948610a8a3c147be809720d00f2def87d9bfc' + '023b52d6eb2985608f1a7206d1950bf7e428bd4c00a7f2b69a8b3cf18c1b4c0c') prepare() { cp -r "${pkgbase}-${pkgver}" "python-build" && cd "python-build" - patch -Np1 -i ../0002-cygwin-support.patch - - # support cygwin in some deps - patch -d ../getrandom-0.2.15 -p1 -i ../getrandom-support-cygwin.patch - # update deps to add cygwin support - patch -Np1 -i ../maturin-update-deps.patch - patch -d ../tar-0.4.43 -p1 -i ../tar-rs-update-deps.patch - cat >> Cargo.toml <