From cf92465b5f239282f627e57e0c608c6ec409cc02 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 22 Nov 2022 10:11:33 +0800 Subject: [PATCH] Update cargo_metadata to 0.15.2 --- Cargo.lock | 38 ++++++++++++++++++++++++-------------- Cargo.toml | 4 +--- src/lib.rs | 1 - src/polyfill.rs | 26 -------------------------- src/project_layout.rs | 4 ++-- src/source_distribution.rs | 4 ++-- 6 files changed, 29 insertions(+), 48 deletions(-) delete mode 100644 src/polyfill.rs diff --git a/Cargo.lock b/Cargo.lock index 5b666213c..0ea82570a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -249,9 +249,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[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,15 +365,16 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3abb7553d5b9b8421c6de7cb02606ff15e0c6eea7d8eadd75ef013fd636bec36" +checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", + "thiserror", ] [[package]] @@ -396,9 +397,9 @@ dependencies = [ [[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" @@ -702,22 +703,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "96bf8df95e795db1a4aca2957ad884a2df35413b24bbeb3114422f3cc21498e8" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "422f23e724af1240ec469ea1e834d87a4b59ce2efe2c6a96256b0c47e2fd86aa" dependencies = [ "cfg-if", ] @@ -1551,6 +1552,15 @@ dependencies = [ "autocfg", ] +[[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" @@ -1654,7 +1664,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "memoffset", + "memoffset 0.6.5", ] [[package]] @@ -1872,9 +1882,9 @@ dependencies = [ [[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" diff --git a/Cargo.toml b/Cargo.toml index 39a6549b7..03f7eaab0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,9 +23,7 @@ name = "maturin" anyhow = "1.0.63" base64 = "0.13.0" glob = "0.3.0" -# cargo_metadata 0.15.1 breaks `maturin build` on Rust 1.48.0 -# see https://github.com/oli-obk/cargo_metadata/issues/212 -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 --git a/src/lib.rs b/src/lib.rs index 91a37c97a..629058edd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,7 +52,6 @@ mod develop; mod metadata; mod module_writer; mod new_project; -mod polyfill; mod project_layout; pub mod pyproject_toml; mod python_interpreter; diff --git a/src/polyfill.rs b/src/polyfill.rs deleted file mode 100644 index ace8475d6..000000000 --- a/src/polyfill.rs +++ /dev/null @@ -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; -} - -impl MetadataCommandExt for MetadataCommand { - fn exec_inherit_stderr(&self) -> Result { - 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 --git a/src/project_layout.rs b/src/project_layout.rs index c9f954311..8751a91c3 100644 --- a/src/project_layout.rs +++ b/src/project_layout.rs @@ -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}; @@ -307,8 +306,9 @@ impl ProjectResolver { 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, diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 0d37517a5..351ba5fd4 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -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 @@ pub fn source_distribution( // 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 '{}'",