Bug Description
On Windows, the pyenv locator fails to detect pyenv-win from PATH because it looks for pyenv.exe, but pyenv-win provides pyenv.bat instead.
Location
crates/pet-pyenv/src/environment_locations.rs in get_binary_from_known_paths():
pub fn get_binary_from_known_paths(env_vars: &EnvVariables) -> Option<PathBuf> {
for known_path in &env_vars.known_global_search_locations {
let exe = if cfg!(windows) {
known_path.join("pyenv.exe") // <-- BUG: should be pyenv.bat
} else {
known_path.join("pyenv")
};
if exe.is_file() {
return Some(norm_case(exe));
}
}
None
}
pyenv-win Actual Files
According to the pyenv-win repository, the bin/ folder contains:
pyenv.bat - Main Windows batch file
pyenv.ps1 - PowerShell script
pyenv - Shell script for cygwin/git-bash
There is no pyenv.exe file.
Expected Behavior
The code should look for pyenv.bat on Windows when searching PATH directories.
Suggested Fix
pub fn get_binary_from_known_paths(env_vars: &EnvVariables) -> Option<PathBuf> {
for known_path in &env_vars.known_global_search_locations {
if cfg!(windows) {
// pyenv-win provides pyenv.bat, not pyenv.exe
let exe = known_path.join("pyenv.bat");
if exe.is_file() {
return Some(norm_case(exe));
}
} else {
let exe = known_path.join("pyenv");
if exe.is_file() {
return Some(norm_case(exe));
}
}
}
None
}
Related Issue
microsoft/vscode-python-environments#590
Bug Description
On Windows, the pyenv locator fails to detect pyenv-win from PATH because it looks for
pyenv.exe, but pyenv-win providespyenv.batinstead.Location
crates/pet-pyenv/src/environment_locations.rsinget_binary_from_known_paths():pyenv-win Actual Files
According to the pyenv-win repository, the
bin/folder contains:pyenv.bat- Main Windows batch filepyenv.ps1- PowerShell scriptpyenv- Shell script for cygwin/git-bashThere is no
pyenv.exefile.Expected Behavior
The code should look for
pyenv.baton Windows when searching PATH directories.Suggested Fix
Related Issue
microsoft/vscode-python-environments#590