-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PR
Description
Problem
In pyenvUtils.ts, the calculation of versionsPath and envsPaths is incorrect on Windows due to the pyenv-win directory structure.
Current Code
// pyenvUtils.ts L128-130
const versionsPath = normalizePath(path.join(path.dirname(path.dirname(pyenv)), 'versions'));
const envsPaths = normalizePath(path.join(path.dirname(versionsPath), 'envs'));Issue
On Windows, pyenv is located at ~/.pyenv/pyenv-win/bin/pyenv.bat. The current logic calculates:
path.dirname(path.dirname(pyenv))→~/.pyenv/pyenv-win❌- Should be
~/.pyenvto findversionsfolder properly
This causes:
- Environment grouping (
PYENV_VERSIONSvsPYENV_ENVIRONMENTS) to fail - Environments not being associated with the correct manager
PET Server Reference
The PET server handles this correctly with platform-specific code in pet-pyenv/src/environment_locations.rs:
#[cfg(windows)]
pub fn get_home_pyenv_dir(env_vars: &EnvVariables) -> Option<PathBuf> {
let home = env_vars.home.clone()?;
Some(norm_case(home.join(".pyenv").join("pyenv-win")))
}Suggested Fix
Add Windows-specific handling when calculating the versions and envs paths:
const pyenvDir = isWindows()
? path.dirname(path.dirname(path.dirname(pyenv))) // Go up 3 levels on Windows
: path.dirname(path.dirname(pyenv));
const versionsPath = normalizePath(path.join(pyenvDir, 'versions'));Affected File
src/managers/pyenv/pyenvUtils.ts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PR