Skip to content

Commit

Permalink
Improve the UX of found interpreters message
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed May 10, 2022
1 parent db515cd commit 1f0eb21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ pub fn find_interpreter(
) -> Result<Vec<PythonInterpreter>> {
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") {
Expand Down Expand Up @@ -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")
Expand All @@ -803,14 +807,16 @@ pub fn find_interpreter(
}
}

println!(
"🐍 Found {}",
interpreters
.iter()
.map(ToString::to_string)
.collect::<Vec<String>>()
.join(", ")
);
let interpreters_str = interpreters
.iter()
.map(ToString::to_string)
.collect::<Vec<String>>()
.join(", ");
if native_interpreters {
println!("🐍 Found {}", interpreters_str);
} else {
println!("🐍 Found cross compiling target {}", interpreters_str);
}

Ok(interpreters)
}
Expand Down
2 changes: 1 addition & 1 deletion src/python_interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1f0eb21

Please sign in to comment.