Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/pet/src/locators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,20 @@ pub fn identify_python_environment_using_locators(
global_env_search_paths: &[PathBuf],
) -> Option<PythonEnvironment> {
let executable = env.executable.clone();
trace!(
"Identifying Python environment using locators: {:?}",
executable
);
if let Some(env) = locators.iter().fold(
None,
|e, loc| if e.is_some() { e } else { loc.try_from(env) },
) {
return Some(env);
}
trace!(
"Failed to identify Python environment using locators, now trying to resolve: {:?}",
executable
);

// Yikes, we have no idea what this is.
// Lets get the actual interpreter info and try to figure this out.
Expand Down
16 changes: 16 additions & 0 deletions crates/pet/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,32 @@ pub fn resolve_environment(
// First check if executable is actually a file or a path.
let mut executable = executable.to_owned();
if executable.is_dir() {
trace!(
"Looking to resolve Python executable in provided directory, {:?}, file = {:?}, sylink = {:?}, metadata = {:?}",
executable,
executable.is_file(),
executable.is_symlink(),
executable.metadata(),
);
executable = match find_executable(&executable) {
Some(exe) => exe,
None => {
warn!("Could not find Python executable in {:?}", executable);
executable
}
};
trace!(
"Found Python executable in provided directory, {:?}",
executable
);
}
// First check if this is a known environment
let env = PythonEnv::new(executable.to_owned(), None, None);
trace!(
"In resolve_environment, looking for Python Env {:?} in {:?}",
env,
executable
);
let global_env_search_paths: Vec<PathBuf> = get_search_paths_from_env_variables(os_environment);

if let Some(env) =
Expand Down
Loading