@@ -57,6 +57,10 @@ impl Config {
5757}
5858
5959fn create_config ( file : Option < PathBuf > , env : & EnvVariables ) -> Option < Config > {
60+ if let Some ( file) = & file {
61+ trace ! ( "Parsing Poetry config file => {:?}" , file) ;
62+ }
63+
6064 let cfg = file. clone ( ) . and_then ( |f| parse ( & f) ) ;
6165 let cache_dir = get_cache_dir ( & cfg, env) ;
6266 let virtualenvs_path_from_env_var = env
@@ -65,7 +69,6 @@ fn create_config(file: Option<PathBuf>, env: &EnvVariables) -> Option<Config> {
6569 . map ( |p| resolve_virtualenvs_path ( & p, & cache_dir) ) ;
6670
6771 if let Some ( virtualenvs_path) = & cfg. clone ( ) . and_then ( |cfg| cfg. virtualenvs_path ) {
68- trace ! ( "Poetry virtualenvs path => {:?}" , virtualenvs_path) ;
6972 let virtualenvs_path = resolve_virtualenvs_path ( & virtualenvs_path. clone ( ) , & cache_dir) ;
7073
7174 return Some ( Config :: new (
@@ -113,24 +116,29 @@ fn resolve_virtualenvs_path(virtualenvs_path: &Path, cache_dir: &Option<PathBuf>
113116 return virtualenvs_path;
114117 }
115118 }
119+ trace ! ( "Poetry virtualenvs path => {:?}" , virtualenvs_path) ;
116120 virtualenvs_path. to_path_buf ( )
117121}
118122/// Maps to DEFAULT_CACHE_DIR in poetry
119123fn get_cache_dir ( cfg : & Option < ConfigToml > , env : & EnvVariables ) -> Option < PathBuf > {
120124 // Cache dir in env variables takes precedence
121125 if let Some ( cache_dir) = env. poetry_cache_dir . clone ( ) {
122126 if cache_dir. is_dir ( ) {
127+ trace ! ( "Poetry cache dir from env variable: {:?}" , cache_dir) ;
123128 return Some ( cache_dir) ;
124129 }
125130 }
126131 // Check cache dir in config.
127132 if let Some ( cache_dir) = cfg. as_ref ( ) . and_then ( |cfg| cfg. cache_dir . clone ( ) ) {
128133 if cache_dir. is_dir ( ) {
134+ trace ! ( "Poetry cache dir from config: {:?}" , cache_dir) ;
129135 return Some ( cache_dir) ;
130136 }
131137 }
132138
133- Platformdirs :: new ( _APP_NAME. into ( ) , false ) . user_cache_path ( )
139+ let default_cache_dir = Platformdirs :: new ( _APP_NAME. into ( ) , false ) . user_cache_path ( ) ;
140+ trace ! ( "Poetry cache (default): {:?}" , default_cache_dir) ;
141+ default_cache_dir
134142}
135143
136144/// Maps to CONFIG_DIR in poetry
@@ -163,7 +171,9 @@ struct ConfigToml {
163171
164172fn parse ( file : & Path ) -> Option < ConfigToml > {
165173 let contents = fs:: read_to_string ( file) . ok ( ) ?;
166- parse_contents ( & contents)
174+ let cfg = parse_contents ( & contents) ;
175+ trace ! ( "Poetry config file for {:?} is {:?}" , file, cfg) ;
176+ cfg
167177}
168178
169179fn parse_contents ( contents : & str ) -> Option < ConfigToml > {
0 commit comments