@@ -57,6 +57,10 @@ impl Config {
57
57
}
58
58
59
59
fn create_config ( file : Option < PathBuf > , env : & EnvVariables ) -> Option < Config > {
60
+ if let Some ( file) = & file {
61
+ trace ! ( "Parsing Poetry config file => {:?}" , file) ;
62
+ }
63
+
60
64
let cfg = file. clone ( ) . and_then ( |f| parse ( & f) ) ;
61
65
let cache_dir = get_cache_dir ( & cfg, env) ;
62
66
let virtualenvs_path_from_env_var = env
@@ -65,7 +69,6 @@ fn create_config(file: Option<PathBuf>, env: &EnvVariables) -> Option<Config> {
65
69
. map ( |p| resolve_virtualenvs_path ( & p, & cache_dir) ) ;
66
70
67
71
if let Some ( virtualenvs_path) = & cfg. clone ( ) . and_then ( |cfg| cfg. virtualenvs_path ) {
68
- trace ! ( "Poetry virtualenvs path => {:?}" , virtualenvs_path) ;
69
72
let virtualenvs_path = resolve_virtualenvs_path ( & virtualenvs_path. clone ( ) , & cache_dir) ;
70
73
71
74
return Some ( Config :: new (
@@ -113,24 +116,29 @@ fn resolve_virtualenvs_path(virtualenvs_path: &Path, cache_dir: &Option<PathBuf>
113
116
return virtualenvs_path;
114
117
}
115
118
}
119
+ trace ! ( "Poetry virtualenvs path => {:?}" , virtualenvs_path) ;
116
120
virtualenvs_path. to_path_buf ( )
117
121
}
118
122
/// Maps to DEFAULT_CACHE_DIR in poetry
119
123
fn get_cache_dir ( cfg : & Option < ConfigToml > , env : & EnvVariables ) -> Option < PathBuf > {
120
124
// Cache dir in env variables takes precedence
121
125
if let Some ( cache_dir) = env. poetry_cache_dir . clone ( ) {
122
126
if cache_dir. is_dir ( ) {
127
+ trace ! ( "Poetry cache dir from env variable: {:?}" , cache_dir) ;
123
128
return Some ( cache_dir) ;
124
129
}
125
130
}
126
131
// Check cache dir in config.
127
132
if let Some ( cache_dir) = cfg. as_ref ( ) . and_then ( |cfg| cfg. cache_dir . clone ( ) ) {
128
133
if cache_dir. is_dir ( ) {
134
+ trace ! ( "Poetry cache dir from config: {:?}" , cache_dir) ;
129
135
return Some ( cache_dir) ;
130
136
}
131
137
}
132
138
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
134
142
}
135
143
136
144
/// Maps to CONFIG_DIR in poetry
@@ -163,7 +171,9 @@ struct ConfigToml {
163
171
164
172
fn parse ( file : & Path ) -> Option < ConfigToml > {
165
173
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
167
177
}
168
178
169
179
fn parse_contents ( contents : & str ) -> Option < ConfigToml > {
0 commit comments