Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions crates/pet-global-virtualenvs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,20 @@ fn get_global_virtualenv_dirs(
}

pub fn list_global_virtual_envs_paths(
virtual_env_env_var: Option<String>,
work_on_home_env_var: Option<String>,
xdg_data_home: Option<String>,
user_home: Option<PathBuf>,
) -> Vec<PathBuf> {
let mut python_envs: Vec<PathBuf> = vec![];

if let Some(virtual_env) = virtual_env_env_var {
let virtual_env = norm_case(expand_path(PathBuf::from(virtual_env)));
if virtual_env.exists() {
python_envs.push(virtual_env);
}
}

for root_dir in &get_global_virtualenv_dirs(work_on_home_env_var, xdg_data_home, user_home) {
if let Ok(dirs) = fs::read_dir(root_dir) {
python_envs.append(
Expand Down
1 change: 1 addition & 0 deletions crates/pet/src/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ pub fn find_and_report_envs(

let search_paths: Vec<PathBuf> = [
list_global_virtual_envs_paths(
environment.get_env_var("VIRTUAL_ENV".into()),
environment.get_env_var("WORKON_HOME".into()),
environment.get_env_var("XDG_DATA_HOME".into()),
environment.get_user_home(),
Expand Down