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 2022-11-25 13:12:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-maturin (Old) and /work/SRC/openSUSE:Factory/.python-maturin.new.1597 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-maturin" Fri Nov 25 13:12:57 2022 rev:19 rq:1038001 version:0.14.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-maturin/python-maturin.changes 2022-11-20 19:47:16.781329966 +0100 +++ /work/SRC/openSUSE:Factory/.python-maturin.new.1597/python-maturin.changes 2022-11-25 13:22:55.167603546 +0100 @@ -1,0 +2,25 @@ +Fri Nov 25 01:16:04 UTC 2022 - Mia Herkt <[email protected]> + +- Update to v0.14.2: + * Tighten src-layout detection logic + gh#PyO3/maturin#1282 + * Update cargo_metadata to 0.15.2 + gh#PyO3/maturin#1284 + * Tell people about setting RUST_LOG=maturin=debug when making + bug reports + gh#PyO3/maturin#1286 + * Fix generating pep517 sdist for src-layout + gh#PyO3/maturin#1288 + * Deprecate python-source option in Cargo.toml + gh#PyO3/maturin#1291 + * Fix auditwheel with read-only libraries + gh#PyO3/maturin#1292 + * CI: Try nextest double spawn feature + gh#PyO3/maturin#1294 + * Update wasmtime dependency version to 3.0.0 + gh#PyO3/maturin#1295 +- Changes in v0.14.1: + * Downgrade cargo_metadata to 0.15.0 + gh#PyO3/maturin#1279 + +------------------------------------------------------------------- Old: ---- maturin-0.14.0.tar.gz New: ---- maturin-0.14.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-maturin.spec ++++++ --- /var/tmp/diff_new_pack.aPQywR/_old 2022-11-25 13:22:56.123608704 +0100 +++ /var/tmp/diff_new_pack.aPQywR/_new 2022-11-25 13:22:56.127608726 +0100 @@ -17,7 +17,7 @@ Name: python-maturin -Version: 0.14.0 +Version: 0.14.2 Release: 0 Summary: Rust/Python Interoperability License: Apache-2.0 OR MIT ++++++ maturin-0.14.0.tar.gz -> maturin-0.14.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/Cargo.lock new/maturin-0.14.2/Cargo.lock --- old/maturin-0.14.0/Cargo.lock 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/Cargo.lock 2022-11-24 08:09:36.000000000 +0100 @@ -51,9 +51,9 @@ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -249,9 +249,9 @@ [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bytesize" @@ -365,9 +365,9 @@ [[package]] name = "cargo_metadata" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406c859255d568f4f742b3146d51851f3bfd49f734a2c289d9107c4395ee0062" +checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" dependencies = [ "camino", "cargo-platform", @@ -397,9 +397,9 @@ [[package]] name = "cc" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cfb" @@ -703,22 +703,22 @@ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] @@ -1475,7 +1475,7 @@ [[package]] name = "maturin" -version = "0.14.0" +version = "0.14.2" dependencies = [ "anyhow", "base64", @@ -1553,6 +1553,15 @@ ] [[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1655,7 +1664,7 @@ "cc", "cfg-if", "libc", - "memoffset", + "memoffset 0.6.5", ] [[package]] @@ -1808,9 +1817,9 @@ [[package]] name = "openssl" -version = "0.10.42" +version = "0.10.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +checksum = "020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376" dependencies = [ "bitflags", "cfg-if", @@ -1849,9 +1858,9 @@ [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132" dependencies = [ "autocfg", "cc", @@ -1873,9 +1882,9 @@ [[package]] name = "os_str_bytes" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "os_type" @@ -2464,9 +2473,9 @@ [[package]] name = "serde_json" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa", "ryu", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/Cargo.toml new/maturin-0.14.2/Cargo.toml --- old/maturin-0.14.0/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/maturin-0.14.2/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 = "0.14.0" +version = "0.14.2" description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages" exclude = ["test-crates/**/*", "sysconfig/*", "test-data/*", "ci/*", "tests/*", "guide/*", ".github/*"] homepage = "https://github.com/pyo3/maturin" @@ -23,7 +23,7 @@ anyhow = "1.0.63" base64 = "0.13.0" glob = "0.3.0" -cargo_metadata = "0.15.0" +cargo_metadata = "0.15.2" cargo-options = "0.5.2" cargo-zigbuild = "0.14.1" cargo-xwin = { version = "0.12.2", default-features = false } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/Changelog.md new/maturin-0.14.2/Changelog.md --- old/maturin-0.14.0/Changelog.md 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/Changelog.md 2022-11-24 08:09:36.000000000 +0100 @@ -7,6 +7,17 @@ ## [Unreleased] +## [0.14.2] - 2022-11-24 + +* Tighten src-layout detection logic in [#1281](https://github.com/PyO3/maturin/pull/1282) +* Fix generating pep517 sdist for src-layout in [#1288](https://github.com/PyO3/maturin/pull/1288) +* Deprecate `python-source` option in `Cargo.toml` in favor of the one in `pyproject.toml` in [#1291](https://github.com/PyO3/maturin/pull/1291) +* Fix auditwheel with read-only libraries in [#1292](https://github.com/PyO3/maturin/pull/1292) + +## [0.14.1] - 2022-11-20 + +* Downgrade `cargo_metadata` to 0.15.0 to fix `maturin build` on old Rust versions like 1.48.0 in [#1279](https://github.com/PyO3/maturin/pull/1279) + ## [0.14.0] - 2022-11-19 * **Breaking Change**: Remove support for specifying python package metadata in `Cargo.toml` in [#1200](https://github.com/PyO3/maturin/pull/1200). @@ -744,7 +755,9 @@ * Initial Release -[Unreleased]: https://github.com/pyo3/maturin/compare/v0.14.0...HEAD +[Unreleased]: https://github.com/pyo3/maturin/compare/v0.14.2...HEAD +[0.14.2]: https://github.com/pyo3/maturin/compare/v0.14.1...v0.14.2 +[0.14.1]: https://github.com/pyo3/maturin/compare/v0.14.0...v0.14.1 [0.14.0]: https://github.com/pyo3/maturin/compare/v0.13.7...v0.14.0 [0.13.7]: https://github.com/pyo3/maturin/compare/v0.13.6...v0.13.7 [0.13.6]: https://github.com/pyo3/maturin/compare/v0.13.5...v0.13.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/PKG-INFO new/maturin-0.14.2/PKG-INFO --- old/maturin-0.14.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/maturin-0.14.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +1,15 @@ Metadata-Version: 2.1 Name: maturin -Version: 0.14.0 +Version: 0.14.2 Classifier: Topic :: Software Development :: Build Tools Classifier: Programming Language :: Rust Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Dist: tomli>=1.1.0 ; python_version<'3.11' -Requires-Dist: ziglang~=0.10.0; extra == 'zig' Requires-Dist: patchelf; extra == 'patchelf' -Provides-Extra: zig +Requires-Dist: ziglang~=0.10.0; extra == 'zig' Provides-Extra: patchelf +Provides-Extra: zig Summary: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages Keywords: python,cffi,packaging,pypi,pyo3 Home-Page: https://github.com/pyo3/maturin @@ -18,10 +18,10 @@ License: MIT OR Apache-2.0 Requires-Python: >=3.7 Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM -Project-URL: Source Code, https://github.com/PyO3/maturin -Project-URL: Changelog, https://maturin.rs/changelog.html -Project-URL: Documentation, https://maturin.rs Project-URL: Issues, https://github.com/PyO3/maturin/issues +Project-URL: Documentation, https://maturin.rs +Project-URL: Changelog, https://maturin.rs/changelog.html +Project-URL: Source Code, https://github.com/PyO3/maturin # Maturin @@ -139,8 +139,7 @@   âââ lib.rs ``` -You can specify a different python source directory in `pyproject.toml` by setting `tool.maturin.python-source` -or in `Cargo.toml` by setting `package.metadata.maturin.python-source`, for example +You can specify a different python source directory in `pyproject.toml` by setting `tool.maturin.python-source`, for example **pyproject.toml** @@ -149,13 +148,6 @@ python-source = "python" ``` -**Cargo.toml** - -```toml -[package.metadata.maturin] -python-source = "python" -``` - then the project structure would look like this: ``` @@ -227,7 +219,7 @@ ```toml [build-system] -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=0.14,<0.15"] build-backend = "maturin" ``` @@ -243,7 +235,7 @@ ```toml [build-system] -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=0.14,<0.15"] build-backend = "maturin" [tool.maturin] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/README.md new/maturin-0.14.2/README.md --- old/maturin-0.14.0/README.md 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/README.md 2022-11-24 08:09:36.000000000 +0100 @@ -114,8 +114,7 @@   âââ lib.rs ``` -You can specify a different python source directory in `pyproject.toml` by setting `tool.maturin.python-source` -or in `Cargo.toml` by setting `package.metadata.maturin.python-source`, for example +You can specify a different python source directory in `pyproject.toml` by setting `tool.maturin.python-source`, for example **pyproject.toml** @@ -124,13 +123,6 @@ python-source = "python" ``` -**Cargo.toml** - -```toml -[package.metadata.maturin] -python-source = "python" -``` - then the project structure would look like this: ``` @@ -202,7 +194,7 @@ ```toml [build-system] -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=0.14,<0.15"] build-backend = "maturin" ``` @@ -218,7 +210,7 @@ ```toml [build-system] -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=0.14,<0.15"] build-backend = "maturin" [tool.maturin] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/build_context.rs new/maturin-0.14.2/src/build_context.rs --- old/maturin-0.14.0/src/build_context.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/build_context.rs 2022-11-24 08:09:36.000000000 +0100 @@ -130,7 +130,7 @@ // Having the wasmtime version hardcoded is not ideal, it's easy enough to overwrite metadata21 .requires_dist - .push("wasmtime>=2.0.0,<3.0.0".to_string()); + .push("wasmtime>=3.0.0,<4.0.0".to_string()); } Ok(metadata21) @@ -392,6 +392,12 @@ fs::copy(&lib_path, &dest_path)?; libs_copied.insert(lib_path); + // fs::copy copies permissions as well, and the original + // file may have been read-only + let mut perms = fs::metadata(&dest_path)?.permissions(); + perms.set_readonly(false); + fs::set_permissions(&dest_path, perms)?; + patchelf::set_soname(&dest_path, &new_soname)?; if !lib.rpath.is_empty() || !lib.runpath.is_empty() { patchelf::set_rpath(&dest_path, &libs_dir)?; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/compile.rs new/maturin-0.14.2/src/compile.rs --- old/maturin-0.14.0/src/compile.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/compile.rs 2022-11-24 08:09:36.000000000 +0100 @@ -10,6 +10,7 @@ use std::path::{Path, PathBuf}; use std::process::Stdio; use std::str; +use tracing::{debug, trace}; /// The first version of pyo3 that supports building Windows abi3 wheel /// without `PYO3_NO_PYTHON` environment variable @@ -77,6 +78,8 @@ } else { "cdylib" }; + debug!("Building an universal2 {}", build_type); + let mut aarch64_context = context.clone(); aarch64_context.target = Target::from_target_triple(Some("aarch64-apple-darwin".to_string()))?; @@ -189,6 +192,7 @@ // `--crate-type` is stable since Rust 1.64.0 // See https://github.com/rust-lang/cargo/pull/10838 if target.rustc_version.semver >= RUST_1_64_0 { + debug!("Setting crate_type to cdylib for Rust >= 1.64.0"); cargo_rustc.crate_type = vec!["cdylib".to_string()]; } } @@ -209,6 +213,7 @@ // We must only do this for libraries as it breaks binaries // For some reason this value is ignored when passed as rustc argument if context.target.is_musl_target() { + debug!("Setting `-C target-features=-crt-static` for musl dylib"); rust_flags .get_or_insert_with(Default::default) .push(" -C target-feature=-crt-static"); @@ -239,6 +244,7 @@ "-C".to_string(), macos_dylib_install_name, ]; + debug!("Setting additional linker args for macOS: {:?}", mac_args); cargo_rustc.args.extend(mac_args); } } else if target.is_emscripten() { @@ -265,6 +271,10 @@ emscripten_args.push("-C".to_string()); emscripten_args.push("link-arg=-sWASM_BIGINT".to_string()); } + debug!( + "Setting additional linker args for Emscripten: {:?}", + emscripten_args + ); cargo_rustc.args.extend(emscripten_args); } @@ -400,6 +410,8 @@ build_command.env("MACOSX_DEPLOYMENT_TARGET", format!("{}.{}", major, minor)); } + debug!("Running {:?}", build_command); + let mut cargo_build = build_command .spawn() .context("Failed to run `cargo rustc`")?; @@ -412,7 +424,9 @@ .take() .expect("Cargo build should have a stdout"); for message in cargo_metadata::Message::parse_stream(BufReader::new(stream)) { - match message.context("Failed to parse message coming from cargo")? { + let message = message.context("Failed to parse cargo metadata message")?; + trace!("cargo message: {:?}", message); + match message { cargo_metadata::Message::CompilerArtifact(artifact) => { let package_in_metadata = context .cargo_metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/develop.rs new/maturin-0.14.2/src/develop.rs --- old/maturin-0.14.0/src/develop.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/develop.rs 2022-11-24 08:09:36.000000000 +0100 @@ -126,13 +126,13 @@ } if !output.stderr.is_empty() { eprintln!( - "â ï¸ Warning: pip raised a warning running {:?}:\n{}", + "â ï¸ Warning: pip raised a warning running {:?}:\n{}", &command, String::from_utf8_lossy(&output.stderr).trim(), ); } println!( - "ð Installed {}-{}", + "ð Installed {}-{}", build_context.metadata21.name, build_context.metadata21.version ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/lib.rs new/maturin-0.14.2/src/lib.rs --- old/maturin-0.14.0/src/lib.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/lib.rs 2022-11-24 08:09:36.000000000 +0100 @@ -52,7 +52,6 @@ mod metadata; mod module_writer; mod new_project; -mod polyfill; mod project_layout; pub mod pyproject_toml; mod python_interpreter; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/main.rs new/maturin-0.14.2/src/main.rs --- old/maturin-0.14.0/src/main.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/main.rs 2022-11-24 08:09:36.000000000 +0100 @@ -197,14 +197,9 @@ /// The sdist_directory argument to build_sdist #[arg(long = "sdist-directory")] sdist_directory: PathBuf, - #[arg( - short = 'm', - long = "manifest-path", - default_value = "Cargo.toml", - value_name = "PATH" - )] + #[arg(short = 'm', long = "manifest-path", value_name = "PATH")] /// The path to the Cargo.toml - manifest_path: PathBuf, + manifest_path: Option<PathBuf>, }, } @@ -292,7 +287,7 @@ let build_options = BuildOptions { out: Some(sdist_directory), cargo: CargoOptions { - manifest_path: Some(manifest_path), + manifest_path, ..Default::default() }, ..Default::default() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/polyfill.rs new/maturin-0.14.2/src/polyfill.rs --- old/maturin-0.14.0/src/polyfill.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/polyfill.rs 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -use cargo_metadata::{Metadata, MetadataCommand}; -use std::process::Stdio; - -pub trait MetadataCommandExt { - /// Runs configured `cargo metadata` and returns parsed `Metadata`. - /// Inherits stderr from parent process. - fn exec_inherit_stderr(&self) -> Result<Metadata, cargo_metadata::Error>; -} - -impl MetadataCommandExt for MetadataCommand { - fn exec_inherit_stderr(&self) -> Result<Metadata, cargo_metadata::Error> { - let mut command = self.cargo_command(); - command.stderr(Stdio::inherit()); - let output = command.output()?; - if !output.status.success() { - return Err(cargo_metadata::Error::CargoMetadata { - stderr: String::from_utf8(output.stderr)?, - }); - } - let stdout = std::str::from_utf8(&output.stdout)? - .lines() - .find(|line| line.starts_with('{')) - .ok_or(cargo_metadata::Error::NoJson)?; - Self::parse(stdout) - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/project_layout.rs new/maturin-0.14.2/src/project_layout.rs --- old/maturin-0.14.0/src/project_layout.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/project_layout.rs 2022-11-24 08:09:36.000000000 +0100 @@ -1,5 +1,4 @@ use crate::build_options::{extract_cargo_metadata_args, CargoOptions}; -use crate::polyfill::MetadataCommandExt; use crate::{CargoToml, Metadata21, PyProjectToml}; use anyhow::{bail, format_err, Context, Result}; use cargo_metadata::{Metadata, MetadataCommand}; @@ -7,6 +6,7 @@ use std::env; use std::io; use std::path::{Path, PathBuf}; +use tracing::debug; const PYPROJECT_TOML: &str = "pyproject.toml"; @@ -136,14 +136,24 @@ manifest_dir }; let py_root = match pyproject.and_then(|x| x.python_source()) { - Some(py_src) => py_src.to_path_buf(), + Some(py_src) => project_root.join(py_src), None => match extra_metadata.python_source.as_ref() { - Some(py_src) => manifest_dir.join(py_src), + Some(py_src) => { + println!("â ï¸ Warning: specify python-source in Cargo.toml is deprecated, use python-source in [tool.maturin] section in pyproject.toml instead"); + manifest_dir.join(py_src) + } None => match pyproject.and_then(|x| x.project_name()) { Some(project_name) => { // Detect src layout let import_name = project_name.replace('-', "_"); - if project_root.join("src").join(import_name).is_dir() { + let rust_cargo_toml_found = + project_root.join("rust").join("Cargo.toml").is_file(); + let python_src_found = project_root + .join("src") + .join(import_name) + .join("__init__.py") + .is_file(); + if rust_cargo_toml_found && python_src_found { project_root.join("src") } else { project_root.to_path_buf() @@ -193,6 +203,10 @@ // use command line argument if specified if let Some(path) = cargo_manifest_path { let path = path.normalize()?.into_path_buf(); + debug!( + "Using cargo manifest path from command line argument: {:?}", + path + ); let workspace_root = Self::resolve_cargo_metadata(&path, cargo_options)?.workspace_root; let workspace_parent = workspace_root.parent().unwrap_or(&workspace_root); for parent in path.ancestors().skip(1) { @@ -202,10 +216,12 @@ } let pyproject_file = parent.join(PYPROJECT_TOML); if pyproject_file.is_file() { + debug!("Found pyproject.toml at {:?}", pyproject_file); return Ok((path, pyproject_file)); } } let pyproject_file = path.parent().unwrap().join(PYPROJECT_TOML); + debug!("Trying pyproject.toml at {:?}", pyproject_file); return Ok((path, pyproject_file)); } // check `manifest-path` option in pyproject.toml @@ -215,6 +231,10 @@ .into_path_buf(); let pyproject_file = current_dir.join(PYPROJECT_TOML); if pyproject_file.is_file() { + debug!( + "Found pyproject.toml in working directory at {:?}", + pyproject_file + ); let pyproject = PyProjectToml::new(&pyproject_file).context("pyproject.toml is invalid")?; if let Some(path) = pyproject.manifest_path() { @@ -227,6 +247,7 @@ if !manifest_dir.starts_with(¤t_dir) { bail!("Cargo.toml can not be placed outside of the directory containing pyproject.toml"); } + debug!("Using cargo manifest path from pyproject.toml {:?}", path); return Ok((path.normalize()?.into_path_buf(), pyproject_file)); } else { // Detect src layout: @@ -243,14 +264,20 @@ // âââ src // âââ lib.rs let path = current_dir.join("rust").join("Cargo.toml"); - if path.exists() { + if path.is_file() { + debug!("Python first src-layout detected"); if pyproject.python_source().is_some() { // python source directory is specified in pyproject.toml return Ok((path, pyproject_file)); } else if let Some(project_name) = pyproject.project_name() { // Check if python source directory in `src/<project_name>` let import_name = project_name.replace('-', "_"); - if current_dir.join("src").join(import_name).is_dir() { + if current_dir + .join("src") + .join(import_name) + .join("__init__.py") + .is_file() + { return Ok((path, pyproject_file)); } } @@ -260,6 +287,10 @@ // check Cargo.toml in current directory let path = current_dir.join("Cargo.toml"); if path.exists() { + debug!( + "Using cargo manifest path from working directory: {:?}", + path + ); Ok((path, current_dir.join(PYPROJECT_TOML))) } else { Err(format_err!( @@ -274,11 +305,13 @@ manifest_path: &Path, cargo_options: &CargoOptions, ) -> Result<Metadata> { + debug!("Resolving cargo metadata from {:?}", manifest_path); let cargo_metadata_extra_args = extract_cargo_metadata_args(cargo_options)?; let result = MetadataCommand::new() .manifest_path(manifest_path) + .verbose(true) .other_options(cargo_metadata_extra_args) - .exec_inherit_stderr(); + .exec(); let cargo_metadata = match result { Ok(cargo_metadata) => cargo_metadata, @@ -322,6 +355,13 @@ module_name.to_string(), ) }; + debug!( + project_root = %project_root.display(), + rust_module = %rust_module.display(), + python_module = %python_module.display(), + extension_name = %extension_name, + "Project layout resolved" + ); let data = if let Some(data) = data { if !data.is_dir() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maturin-0.14.0/src/source_distribution.rs new/maturin-0.14.2/src/source_distribution.rs --- old/maturin-0.14.0/src/source_distribution.rs 2022-11-19 15:58:46.000000000 +0100 +++ new/maturin-0.14.2/src/source_distribution.rs 2022-11-24 08:09:36.000000000 +0100 @@ -1,5 +1,4 @@ use crate::module_writer::{add_data, ModuleWriter}; -use crate::polyfill::MetadataCommandExt; use crate::{pyproject_toml::Format, BuildContext, PyProjectToml, SDistWriter}; use anyhow::{bail, Context, Result}; use cargo_metadata::{Metadata, MetadataCommand}; @@ -467,9 +466,10 @@ // thus we need to find out its workspace root from `cargo metadata` let path_dep_metadata = MetadataCommand::new() .manifest_path(path_dep) + .verbose(true) // We don't need to resolve the dependency graph .no_deps() - .exec_inherit_stderr() + .exec() .with_context(|| { format!( "Cargo metadata failed for {} at '{}'", ++++++ vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/python-maturin/vendor.tar.xz /work/SRC/openSUSE:Factory/.python-maturin.new.1597/vendor.tar.xz differ: char 26, line 1
