diff --git a/crates/pet-poetry/src/config.rs b/crates/pet-poetry/src/config.rs index 612cb667..8b4f8632 100644 --- a/crates/pet-poetry/src/config.rs +++ b/crates/pet-poetry/src/config.rs @@ -57,6 +57,10 @@ impl Config { } fn create_config(file: Option, env: &EnvVariables) -> Option { + if let Some(file) = &file { + trace!("Parsing Poetry config file => {:?}", file); + } + let cfg = file.clone().and_then(|f| parse(&f)); let cache_dir = get_cache_dir(&cfg, env); let virtualenvs_path_from_env_var = env @@ -65,7 +69,6 @@ fn create_config(file: Option, env: &EnvVariables) -> Option { .map(|p| resolve_virtualenvs_path(&p, &cache_dir)); if let Some(virtualenvs_path) = &cfg.clone().and_then(|cfg| cfg.virtualenvs_path) { - trace!("Poetry virtualenvs path => {:?}", virtualenvs_path); let virtualenvs_path = resolve_virtualenvs_path(&virtualenvs_path.clone(), &cache_dir); return Some(Config::new( @@ -113,6 +116,7 @@ fn resolve_virtualenvs_path(virtualenvs_path: &Path, cache_dir: &Option return virtualenvs_path; } } + trace!("Poetry virtualenvs path => {:?}", virtualenvs_path); virtualenvs_path.to_path_buf() } /// Maps to DEFAULT_CACHE_DIR in poetry @@ -120,17 +124,21 @@ fn get_cache_dir(cfg: &Option, env: &EnvVariables) -> Option Option { let contents = fs::read_to_string(file).ok()?; - parse_contents(&contents) + let cfg = parse_contents(&contents); + trace!("Poetry config file for {:?} is {:?}", file, cfg); + cfg } fn parse_contents(contents: &str) -> Option { diff --git a/crates/pet-poetry/src/environment_locations.rs b/crates/pet-poetry/src/environment_locations.rs index d25fd6b3..5895be66 100644 --- a/crates/pet-poetry/src/environment_locations.rs +++ b/crates/pet-poetry/src/environment_locations.rs @@ -40,11 +40,6 @@ pub fn list_environments( }) .collect::>(); - // We're only interested in directories that have a pyproject.toml - if workspace_dirs.is_empty() { - return None; - } - let mut envs = vec![]; let global_config = Config::find_global(env); @@ -53,6 +48,10 @@ pub fn list_environments( global_envs = list_all_environments_from_config(&config).unwrap_or_default(); } + if workspace_dirs.is_empty() { + trace!("pyproject.toml not found in any workspace directory"); + } + for (workspace_dir, pyproject_toml) in workspace_dirs { let virtualenv_prefix = generate_env_name(&pyproject_toml.name, workspace_dir); trace!(