From 1f0eb218fcecc60143919132625866a3978ab59b Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 10 May 2022 12:34:59 +0800 Subject: [PATCH] Improve the UX of found interpreters message --- src/build_options.rs | 24 +++++++++++++++--------- src/python_interpreter/mod.rs | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/build_options.rs b/src/build_options.rs index 70a623fd0..3a1f1e58e 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -701,6 +701,7 @@ pub fn find_interpreter( ) -> Result> { match bridge { BridgeModel::Bindings(binding_name, _) => { + let mut native_interpreters = false; let mut interpreters = Vec::new(); if let Some(config_file) = env::var_os("PYO3_CONFIG_FILE") { if !binding_name.starts_with("pyo3") { @@ -788,7 +789,10 @@ pub fn find_interpreter( } } else { match find_interpreter_in_host(bridge, interpreter, target, min_python_minor) { - Ok(host_interps) => interpreters = host_interps, + Ok(host_interps) => { + interpreters = host_interps; + native_interpreters = true; + } Err(err) => { if !interpreter.is_empty() && binding_name.starts_with("pyo3") @@ -803,14 +807,16 @@ pub fn find_interpreter( } } - println!( - "🐍 Found {}", - interpreters - .iter() - .map(ToString::to_string) - .collect::>() - .join(", ") - ); + let interpreters_str = interpreters + .iter() + .map(ToString::to_string) + .collect::>() + .join(", "); + if native_interpreters { + println!("🐍 Found {}", interpreters_str); + } else { + println!("🐍 Found cross compiling target {}", interpreters_str); + } Ok(interpreters) } diff --git a/src/python_interpreter/mod.rs b/src/python_interpreter/mod.rs index 4d736af37..04936d1cd 100644 --- a/src/python_interpreter/mod.rs +++ b/src/python_interpreter/mod.rs @@ -678,7 +678,7 @@ impl fmt::Display for PythonInterpreter { } else { write!( f, - "cross compiling target {} {}.{}{}", + "{} {}.{}{}", self.config.interpreter_kind, self.config.major, self.config.minor,