Skip to content

Commit 381df9c

Browse files
authored
Additional search paths for condarc (#121)
1 parent a7903f2 commit 381df9c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

crates/pet-conda/src/environment_locations.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,22 @@ pub fn get_conda_environment_paths(
6161
}
6262

6363
/**
64-
* Get the list of conda environments found in other locations such as
65-
* <user home>/.conda/envs
66-
* <user home>/AppData/Local/conda/conda/envs
64+
* Get the list of conda environments found in conda rc files
65+
* as well as the directories where conda rc files can be found.
6766
*/
6867
fn get_conda_environment_paths_from_conda_rc(env_vars: &EnvVariables) -> Vec<PathBuf> {
6968
// Use the conda rc directories as well.
7069
let mut env_dirs = vec![];
7170
for rc_file_dir in get_conda_rc_search_paths(env_vars) {
71+
if let Some(conda_rc) = Condarc::from_path(&rc_file_dir) {
72+
trace!(
73+
"Conda environments in .condarc {:?} {:?}",
74+
conda_rc.files,
75+
conda_rc.env_dirs
76+
);
77+
env_dirs.append(&mut conda_rc.env_dirs.clone());
78+
}
79+
7280
if rc_file_dir.is_dir() {
7381
env_dirs.push(rc_file_dir);
7482
} else if rc_file_dir.is_file() {
@@ -79,7 +87,11 @@ fn get_conda_environment_paths_from_conda_rc(env_vars: &EnvVariables) -> Vec<Pat
7987
}
8088

8189
if let Some(conda_rc) = Condarc::from(env_vars) {
82-
trace!("Conda environments in .condarc {:?}", conda_rc.env_dirs);
90+
trace!(
91+
"Conda environments in .condarc {:?} {:?}",
92+
conda_rc.files,
93+
conda_rc.env_dirs
94+
);
8395
env_dirs.append(&mut conda_rc.env_dirs.clone());
8496
} else {
8597
trace!("No Conda environments in .condarc");

0 commit comments

Comments
 (0)