Skip to content

Commit

Permalink
Re-add support for pyenv shims
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Mar 18, 2024
1 parent 653327b commit 4505cb5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/uv-interpreter/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ impl InterpreterInfo {
let output = Command::new(interpreter)
.arg("-m")
.arg("python.get_interpreter_info")
.current_dir(tempdir.path().simplified())
.env("PYTHONPATH", tempdir.path())
.env("PYTHONSAFEPATH", "1")
.output()
.map_err(|err| Error::PythonSubcommandLaunch {
interpreter: interpreter.to_path_buf(),
Expand Down Expand Up @@ -508,6 +509,8 @@ impl InterpreterInfo {
executable.display()
);

println!("Got interpreter info: {:?}", info);

// If `executable` is a pyenv shim, a bash script that redirects to the activated
// python executable at another path, we're not allowed to cache the interpreter info.
if same_file::is_same_file(executable, &info.sys_executable).unwrap_or(false) {
Expand All @@ -519,6 +522,11 @@ impl InterpreterInfo {
data: info.clone(),
})?,
)?;
} else {
println!(
"Skipping caching of pyenv shim: {}",
executable.simplified_display()
);
}

Ok(info)
Expand Down

0 comments on commit 4505cb5

Please sign in to comment.