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().
This commit is contained in:
@@ -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()
|
||||
13
maturin/0003-allow-msys-too.patch
Normal file
13
maturin/0003-allow-msys-too.patch
Normal file
@@ -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 ಠ_ಠ",
|
||||
@@ -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 <<END
|
||||
|
||||
[patch.crates-io]
|
||||
getrandom = { path = "../getrandom-0.2.15" }
|
||||
tar = { path = "../tar-0.4.43" }
|
||||
END
|
||||
# https://github.com/PyO3/maturin/pull/2819
|
||||
patch -Np1 -i ../608963e067b905940658b5cb06d7fc04595a0536.patch
|
||||
patch -Np1 -i ../0003-allow-msys-too.patch
|
||||
|
||||
# All these can removed once the next release is out
|
||||
cargo update -p xattr@1.3.1 --precise 1.5.0
|
||||
cargo update -p tempfile@3.11.0 --precise 3.18.0
|
||||
cargo update -p which@7.0.0 --precise 7.0.3
|
||||
cargo update -p clap@4.5.7 --precise 4.5.19
|
||||
cargo update -p psm@0.1.21 --precise 0.1.26
|
||||
cargo update -p target-lexicon@0.13.1 --precise 0.13.3
|
||||
|
||||
cargo fetch --locked --target 'x86_64-pc-cygwin'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -87,6 +87,7 @@ cfg_if! {
|
||||
target_os = "freebsd",
|
||||
target_os = "hurd",
|
||||
target_os = "illumos",
|
||||
+ target_os = "cygwin",
|
||||
// Check for target_arch = "arm" to only include the 3DS. Does not
|
||||
// include the Nintendo Switch (which is target_arch = "aarch64").
|
||||
all(target_os = "horizon", target_arch = "arm"),
|
||||
diff --git a/src/util_libc.rs b/src/util_libc.rs
|
||||
index 80003013..24c53c0c 100644
|
||||
--- a/src/util_libc.rs
|
||||
+++ b/src/util_libc.rs
|
||||
@@ -2,7 +2,7 @@ use crate::Error;
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
cfg_if! {
|
||||
- if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] {
|
||||
+ if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android", target_os = "cygwin"))] {
|
||||
use libc::__errno as errno_location;
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox", target_os = "dragonfly"))] {
|
||||
use libc::__errno_location as errno_location;
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
[dev-dependencies]
|
||||
expect-test = "1.4.1"
|
||||
-fs4 = { version = "0.12.0", features = ["fs-err3"] }
|
||||
+fs4 = { version = "0.13.1", features = ["fs-err3"] }
|
||||
indoc = "2.0.3"
|
||||
insta = "1.34.0"
|
||||
pretty_assertions = "1.3.0"
|
||||
@@ -1,9 +0,0 @@
|
||||
--- a/Cargo.toml.orig
|
||||
+++ b/Cargo.toml
|
||||
@@ -78,5 +78,5 @@
|
||||
version = "0.2"
|
||||
|
||||
[target."cfg(unix)".dependencies.xattr]
|
||||
-version = "1.1.3"
|
||||
+version = "1.5.0"
|
||||
optional = true
|
||||
Reference in New Issue
Block a user