diff --git a/Changelog.md b/Changelog.md index c01f32ae2..efe8c34b8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add 64-bit RISC-V support by felixonmars in [#1001](https://github.com/PyO3/maturin/pull/1001) * Add support for invoking with `python3 -m maturin` in [#1008](https://github.com/PyO3/maturin/pull/1008) * Fix detection of optional dependencies when declaring `features` in `pyproject.toml` in [#1014](https://github.com/PyO3/maturin/pull/1014) +* Respect user specified Rust target in `maturin develop` in [#1016](https://github.com/PyO3/maturin/pull/1016) ## [0.13.0] - 2022-07-09 diff --git a/src/develop.rs b/src/develop.rs index 495f3f113..ff24576b0 100644 --- a/src/develop.rs +++ b/src/develop.rs @@ -22,27 +22,29 @@ pub fn develop( strip: bool, extras: Vec, ) -> Result<()> { - let target = Target::from_target_triple(None)?; - let mut target_triple = None; + let mut target_triple = cargo_options.target.as_ref().map(|x| x.to_string()); + let target = Target::from_target_triple(cargo_options.target)?; let python = target.get_venv_python(&venv_dir); // check python platform and architecture - match Command::new(&python) - .arg("-c") - .arg("import sysconfig; print(sysconfig.get_platform(), end='')") - .output() - { - Ok(output) if output.status.success() => { - let platform = String::from_utf8_lossy(&output.stdout); - if platform.contains("macos") { - if platform.contains("x86_64") && target.target_arch() != Arch::X86_64 { - target_triple = Some("x86_64-apple-darwin".to_string()); - } else if platform.contains("arm64") && target.target_arch() != Arch::Aarch64 { - target_triple = Some("aarch64-apple-darwin".to_string()); + if !target.user_specified { + match Command::new(&python) + .arg("-c") + .arg("import sysconfig; print(sysconfig.get_platform(), end='')") + .output() + { + Ok(output) if output.status.success() => { + let platform = String::from_utf8_lossy(&output.stdout); + if platform.contains("macos") { + if platform.contains("x86_64") && target.target_arch() != Arch::X86_64 { + target_triple = Some("x86_64-apple-darwin".to_string()); + } else if platform.contains("arm64") && target.target_arch() != Arch::Aarch64 { + target_triple = Some("aarch64-apple-darwin".to_string()); + } } } + _ => eprintln!("⚠️ Warning: Failed to determine python platform"), } - _ => eprintln!("⚠️ Warning: Failed to determine python platform"), } // Store wheel in a unique location so we don't get name clashes with parallel runs