Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-maturin for openSUSE:Factory checked in at 2025-10-08 18:12:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-maturin (Old) and /work/SRC/openSUSE:Factory/.python-maturin.new.11973 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-maturin" Wed Oct 8 18:12:43 2025 rev:54 rq:1309680 version:1.9.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-maturin/python-maturin.changes 2025-09-03 21:07:20.804422092 +0200 +++ /work/SRC/openSUSE:Factory/.python-maturin.new.11973/python-maturin.changes 2025-10-08 18:13:19.703400366 +0200 @@ -1,0 +2,21 @@ +Tue Oct 7 10:56:44 UTC 2025 - Nico Krapp <[email protected]> + +- Update to 1.9.5 + * Bump tracing-subscriber from 0.3.19 to 0.3.20 by @dependabot[bot] in #2728 + * search_lib_dir: Only recurse into build* if it is a directory. + by @xhochy in #2734 + * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2729 + * Bump actions/checkout from 4 to 5 by @dependabot[bot] in #2730 + * Bump actions/attest-build-provenance from 2 to 3 + by @dependabot[bot] in #2732 + * Bump actions/download-artifact from 4 to 5 by @dependabot[bot] in #2731 + * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2739 + * Add freebsd 14.2 amd64 sysconfig by @konstin in #2741 + * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2742 + * Update console dependency from 0.15.4 to 0.16.0 by @musicinmybrain in #2688 + * update conda versions in test by @davidhewitt in #2752 + * Only select Windows Python interpreters with matching CPU pointer widths + and architectures by @tonybaloney in #2750 + * release: 1.9.5 by @davidhewitt in #2753 + +------------------------------------------------------------------- Old: ---- maturin-1.9.4.tar.gz New: ---- maturin-1.9.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-maturin.spec ++++++ --- /var/tmp/diff_new_pack.haGbYO/_old 2025-10-08 18:13:21.359469850 +0200 +++ /var/tmp/diff_new_pack.haGbYO/_new 2025-10-08 18:13:21.363470018 +0200 @@ -23,7 +23,7 @@ %endif %{?sle15_python_module_pythons} Name: python-maturin -Version: 1.9.4 +Version: 1.9.5 Release: 0 Summary: Rust/Python Interoperability License: Apache-2.0 OR MIT ++++++ maturin-1.9.4.tar.gz -> maturin-1.9.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/.pre-commit-config.yaml new/maturin-1.9.5/.pre-commit-config.yaml --- old/maturin-1.9.4/.pre-commit-config.yaml 2025-08-27 13:23:56.000000000 +0200 +++ new/maturin-1.9.5/.pre-commit-config.yaml 2025-10-04 08:40:55.000000000 +0200 @@ -56,12 +56,12 @@ ) - id: mixed-line-ending - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.10 + rev: v0.13.0 hooks: - id: ruff-format - id: ruff - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.17.1 + rev: v1.18.1 hooks: - id: mypy entry: mypy maturin/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/Cargo.lock new/maturin-1.9.5/Cargo.lock --- old/maturin-1.9.4/Cargo.lock 2025-08-27 13:23:56.000000000 +0200 +++ new/maturin-1.9.5/Cargo.lock 2025-10-04 08:40:55.000000000 +0200 @@ -493,7 +493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ - "encode_unicode", + "encode_unicode 0.3.6", "lazy_static", "libc", "unicode-width 0.1.13", @@ -501,6 +501,19 @@ ] [[package]] +name = "console" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e09ced7ebbccb63b4c65413d821f2e00ce54c5ca4514ddc6b3c892fdbcbc69d" +dependencies = [ + "encode_unicode 1.0.0", + "libc", + "once_cell", + "unicode-width 0.2.0", + "windows-sys 0.60.2", +] + +[[package]] name = "content_inspector" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -634,7 +647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" dependencies = [ - "console", + "console 0.15.8", "shell-words", "thiserror 1.0.69", "zeroize", @@ -719,6 +732,12 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] name = "encoding_rs" version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -983,8 +1002,8 @@ "aho-corasick", "bstr", "log", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1194,7 +1213,7 @@ "globset", "log", "memchr", - "regex-automata 0.4.9", + "regex-automata", "same-file", "walkdir", "winapi-util", @@ -1217,7 +1236,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" dependencies = [ - "console", + "console 0.15.8", "number_prefix", "portable-atomic", "unicode-width 0.2.0", @@ -1236,7 +1255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "154934ea70c58054b556dd430b99a98c2a7ff5309ac9891597e339b5c28f4371" dependencies = [ - "console", + "console 0.15.8", "once_cell", "similar", ] @@ -1427,16 +1446,16 @@ [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] name = "maturin" -version = "1.9.4" +version = "1.9.5" dependencies = [ "anyhow", "base64 0.21.7", @@ -1451,7 +1470,7 @@ "clap", "clap_complete_command", "configparser", - "console", + "console 0.16.0", "dialoguer", "dirs", "dunce", @@ -1637,12 +1656,11 @@ [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" dependencies = [ - "overload", - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -1724,12 +1742,6 @@ ] [[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] name = "parking_lot" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2034,17 +2046,8 @@ dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -2055,17 +2058,11 @@ dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" @@ -2790,14 +2787,14 @@ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "serde", "serde_json", "sharded-slab", @@ -3175,6 +3172,15 @@ ] [[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.2", +] + +[[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3198,7 +3204,7 @@ "windows_aarch64_gnullvm 0.52.5", "windows_aarch64_msvc 0.52.5", "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.5", "windows_i686_msvc 0.52.5", "windows_x86_64_gnu 0.52.5", "windows_x86_64_gnullvm 0.52.5", @@ -3206,6 +3212,22 @@ ] [[package]] +name = "windows-targets" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3218,6 +3240,12 @@ checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3230,6 +3258,12 @@ checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3242,12 +3276,24 @@ checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] name = "windows_i686_gnullvm" version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3260,6 +3306,12 @@ checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3272,6 +3324,12 @@ checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3284,6 +3342,12 @@ checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3296,6 +3360,12 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] name = "winnow" version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/Cargo.toml new/maturin-1.9.5/Cargo.toml --- old/maturin-1.9.4/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/maturin-1.9.5/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +1,7 @@ [package] authors = ["konstin <[email protected]>", "messense <[email protected]>"] name = "maturin" -version = "1.9.4" +version = "1.9.5" description = "Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages" exclude = [ "test-crates/**/*", @@ -105,11 +105,11 @@ # log tracing = "0.1.36" -tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } +tracing-subscriber = { version = "0.3.20", features = ["env-filter"] } # project scaffolding, maturin new/init/generate-ci dialoguer = { version = "0.11.0", default-features = false, optional = true } -console = { version = "0.15.4", optional = true } +console = { version = "0.16.0", optional = true } minijinja = { version = "2.5.0", optional = true } # upload diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/Changelog.md new/maturin-1.9.5/Changelog.md --- old/maturin-1.9.4/Changelog.md 2025-08-27 13:23:56.000000000 +0200 +++ new/maturin-1.9.5/Changelog.md 2025-10-04 08:40:55.000000000 +0200 @@ -1,5 +1,11 @@ # Changelog +## [1.9.5] + +* Add builtin sysconfig for FreeBSD 14.2 amd64 +* Fix issue searching lib dir containing Python 3.14 `build-details.json` +* Fix detection of compatible interpreters on Windows ARM64 + ## [1.9.4] * Add a `use-base-python` option to `pyproject.toml` with the same behaviour as `MATURIN_PEP517_USE_BASE_PYTHON`. @@ -1098,7 +1104,8 @@ * Initial Release -[Unreleased]: https://github.com/pyo3/maturin/compare/v1.9.4...HEAD +[Unreleased]: https://github.com/pyo3/maturin/compare/v1.9.5...HEAD +[1.9.5]: https://github.com/pyo3/maturin/compare/v1.9.4...v1.9.5 [1.9.4]: https://github.com/pyo3/maturin/compare/v1.9.3...v1.9.4 [1.9.3]: https://github.com/pyo3/maturin/compare/v1.9.2...v1.9.3 [1.9.2]: https://github.com/pyo3/maturin/compare/v1.9.1...v1.9.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/PKG-INFO new/maturin-1.9.5/PKG-INFO --- old/maturin-1.9.4/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/maturin-1.9.5/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: maturin -Version: 1.9.4 +Version: 1.9.5 Classifier: Topic :: Software Development :: Build Tools Classifier: Programming Language :: Rust Classifier: Programming Language :: Python :: Implementation :: CPython diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/src/cross_compile.rs new/maturin-1.9.5/src/cross_compile.rs --- old/maturin-1.9.4/src/cross_compile.rs 2025-08-27 13:23:56.000000000 +0200 +++ new/maturin-1.9.5/src/cross_compile.rs 2025-10-04 08:40:55.000000000 +0200 @@ -153,7 +153,9 @@ for f in fs::read_dir(path.as_ref())? { let sysc = match &f { Ok(f) if starts_with(f, "_sysconfigdata") && ends_with(f, "py") => vec![f.path()], - Ok(f) if starts_with(f, "build") => search_lib_dir(f.path(), target)?, + Ok(f) if starts_with(f, "build") && f.path().is_dir() => { + search_lib_dir(f.path(), target)? + } Ok(f) if starts_with(f, "lib.") => { let name = f.file_name(); // check if right target os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-1.9.4/src/python_interpreter/mod.rs new/maturin-1.9.5/src/python_interpreter/mod.rs --- old/maturin-1.9.4/src/python_interpreter/mod.rs 2025-08-27 13:23:56.000000000 +0200 +++ new/maturin-1.9.5/src/python_interpreter/mod.rs 2025-10-04 08:40:55.000000000 +0200 @@ -1,5 +1,6 @@ pub use self::config::InterpreterConfig; use crate::auditwheel::PlatformTag; +use crate::target::Arch; use crate::{BridgeModel, BuildContext, Target}; use anyhow::{bail, ensure, format_err, Context, Result}; use pep440_rs::{Version, VersionSpecifiers}; @@ -29,8 +30,8 @@ fn windows_interpreter_no_build( major: usize, minor: usize, - target_width: usize, - pointer_width: usize, + target: &Target, + platform: String, min_python_minor: usize, requires_python: Option<&VersionSpecifiers>, ) -> bool { @@ -46,17 +47,34 @@ } } - // There can be 32-bit installations on a 64-bit machine, but we can't link - // those for 64-bit targets - if pointer_width != target_width { + let python_arch = match platform.as_str() { + "win32" => Arch::X86, + "win-amd64" => Arch::X86_64, + "win-arm64" => Arch::Aarch64, + _ => { + eprintln!("⚠️ Warning: {major}.{minor} reports unknown platform '{platform}'. This may fail to build."); + // false => build it anyway + return false; + } + }; + + let target_arch = target.target_arch(); + + if python_arch != target.target_arch() { eprintln!( - "👽 {major}.{minor} is installed as {pointer_width}-bit, while the target is {target_width}-bit. Skipping." + "👽 {major}.{minor} reports a platform '{platform}' (architecture '{python_arch}'), while the Rust target is '{target_arch}'. Skipping." ); return true; } false } +struct WindowsPythonInfo { + major: usize, + minor: usize, + platform: String, // e.g. win32, win-amd64, win-arm64 +} + /// On windows regular Python installs are supported along with environments /// being managed by `conda`. /// @@ -132,45 +150,44 @@ .parse::<usize>() .context("Expected a digit for minor version")?; if !versions_found.contains(&(major, minor)) { - let pointer_width = capture - .get(5) - .map(|m| m.as_str()) - .filter(|m| !m.is_empty()) - .unwrap_or("64") - .parse::<usize>() - .context("Expected a digit for pointer width")?; - - if windows_interpreter_no_build( - major, - minor, - target.pointer_width(), - pointer_width, - min_python_minor, - requires_python, - ) { + let executable = capture.get(6).unwrap().as_str(); + let executable_path = Path::new(&executable); + // Skip non-existing paths + if !executable_path.exists() { continue; } + if let Some(python_info) = windows_python_info(executable_path)? { + if windows_interpreter_no_build( + major, + minor, + target, + python_info.platform, + min_python_minor, + requires_python, + ) { + continue; + } - let executable = capture.get(6).unwrap().as_str(); - let output = Command::new(executable).args(["-c", code]).output(); - let output = match output { - Ok(output) => output, - Err(err) => { + let output = Command::new(executable).args(["-c", code]).output(); + let output = match output { + Ok(output) => output, + Err(err) => { + eprintln!( + "⚠️ Warning: failed to determine the path to python for `{executable}`: {err}" + ); + continue; + } + }; + let path = str::from_utf8(&output.stdout).unwrap().trim(); + if !output.status.success() || path.trim().is_empty() { eprintln!( - "⚠️ Warning: failed to determine the path to python for `{executable}`: {err}" + "⚠️ Warning: couldn't determine the path to python for `{executable}`" ); continue; } - }; - let path = str::from_utf8(&output.stdout).unwrap().trim(); - if !output.status.success() || path.trim().is_empty() { - eprintln!( - "⚠️ Warning: couldn't determine the path to python for `{executable}`" - ); - continue; + interpreter.push(path.to_string()); + versions_found.insert((major, minor)); } - interpreter.push(path.to_string()); - versions_found.insert((major, minor)); } } } @@ -205,8 +222,8 @@ if windows_interpreter_no_build( python_info.major, python_info.minor, - target.pointer_width(), - python_info.pointer_width.unwrap(), + target, + python_info.platform, min_python_minor, requires_python, ) { @@ -226,8 +243,8 @@ if windows_interpreter_no_build( python_info.major, python_info.minor, - target.pointer_width(), - python_info.pointer_width.unwrap(), + target, + python_info.platform, min_python_minor, requires_python, ) { @@ -247,16 +264,10 @@ Ok(interpreter) } -struct WindowsPythonInfo { - major: usize, - minor: usize, - pointer_width: Option<usize>, -} - fn windows_python_info(executable: &Path) -> Result<Option<WindowsPythonInfo>> { let python_info = Command::new(executable) .arg("-c") - .arg("import sys; print(sys.version)") + .arg("import sys, sysconfig; print(sys.version_info.major, sys.version_info.minor, sysconfig.get_platform())") .output(); let python_info = match python_info { @@ -275,23 +286,25 @@ }; let version_info = str::from_utf8(&python_info.stdout).unwrap(); - let expr = Regex::new(r"(\d).(\d).(\d+)").unwrap(); - if let Some(capture) = expr.captures(version_info) { - let major = capture.get(1).unwrap().as_str().parse::<usize>().unwrap(); - let minor = capture.get(2).unwrap().as_str().parse::<usize>().unwrap(); - let pointer_width = if version_info.contains("64 bit (AMD64)") { - 64 - } else { - 32 - }; - Ok(Some(WindowsPythonInfo { - major, - minor, - pointer_width: Some(pointer_width), - })) - } else { - Ok(None) - } + + // Split into 3 segments: major, minor, platform by spaces + let segments: Vec<&str> = version_info.splitn(3, ' ').collect(); + let [major, minor, platform] = segments.as_slice() else { + bail!( + "Unexpected output for Python version info from {}: '{}'", + executable.display(), + version_info + ); + }; + // can then parse each substring + let major = major.parse::<usize>().ok().unwrap_or(0); + let minor = minor.parse::<usize>().ok().unwrap_or(0); + + Ok(Some(WindowsPythonInfo { + major, + minor, + platform: platform.to_string(), + })) } #[derive(Debug, Clone, Copy, Eq, PartialEq, Deserialize, clap::ValueEnum)] @@ -1180,4 +1193,137 @@ assert_eq!(calculate_abi_tag(ext_suffix).as_deref(), expected); } } + + #[test] + fn test_windows_interpreter_no_build() { + use pep440_rs::VersionSpecifiers; + use std::str::FromStr; + + // Test cases for different scenarios + let target_x64 = Target::from_resolved_target_triple("x86_64-pc-windows-msvc").unwrap(); + let target_x86 = Target::from_resolved_target_triple("i686-pc-windows-msvc").unwrap(); + let target_arm64 = Target::from_resolved_target_triple("aarch64-pc-windows-msvc").unwrap(); + + // Test Python 2.x should be rejected + assert!(windows_interpreter_no_build( + 2, + 7, + &target_x64, + "win-amd64".to_string(), + 7, + None + )); + + // Test Python 3.x but below minimum version + assert!(windows_interpreter_no_build( + 3, + 6, + &target_x64, + "win-amd64".to_string(), + 7, + None + )); + + // Test valid Python version with matching platform and architecture + assert!(!windows_interpreter_no_build( + 3, + 10, + &target_x64, + "win-amd64".to_string(), + 7, + None + )); + + // Test 32-bit Python on 64-bit target (should be rejected) + assert!(windows_interpreter_no_build( + 3, + 10, + &target_x64, + "win32".to_string(), + 7, + None + )); + + // Test 32-bit Python on 32-bit target (should be accepted) + assert!(!windows_interpreter_no_build( + 3, + 10, + &target_x86, + "win32".to_string(), + 7, + None + )); + + // Test mismatched architectures + assert!(windows_interpreter_no_build( + 3, + 10, + &target_x64, + "win-arm64".to_string(), + 7, + None + )); + + assert!(windows_interpreter_no_build( + 3, + 10, + &target_arm64, + "win-amd64".to_string(), + 7, + None + )); + + // Test correct architecture matches + assert!(!windows_interpreter_no_build( + 3, + 10, + &target_arm64, + "win-arm64".to_string(), + 7, + None + )); + + // Test requires-python constraints + let requires_python = VersionSpecifiers::from_str(">=3.8,<3.12").unwrap(); + + // Should reject Python 3.7 due to requires-python + assert!(windows_interpreter_no_build( + 3, + 7, + &target_x64, + "win-amd64".to_string(), + 7, + Some(&requires_python) + )); + + // Should accept Python 3.10 within requires-python range + assert!(!windows_interpreter_no_build( + 3, + 10, + &target_x64, + "win-amd64".to_string(), + 7, + Some(&requires_python) + )); + + // Should reject Python 3.12 due to requires-python upper bound + assert!(windows_interpreter_no_build( + 3, + 12, + &target_x64, + "win-amd64".to_string(), + 7, + Some(&requires_python) + )); + + // Test edge case with unknown platform (should not match any specific architecture) + assert!(!windows_interpreter_no_build( + 3, + 10, + &target_x64, + "unknown-platform".to_string(), + 7, + None + )); + } } ++++++ vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/python-maturin/vendor.tar.xz /work/SRC/openSUSE:Factory/.python-maturin.new.11973/vendor.tar.xz differ: char 15, line 1
