You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
debug!("No downloads are available for {request}");
141
+
returnErr(err);
142
+
}
143
+
None
144
+
}
145
+
Err(err) | Ok(Err(err)) => {
146
+
if downloads_enabled {
147
+
// We failed to determine the platform information
148
+
returnErr(err.into());
149
+
}
150
+
None
151
+
}
152
+
};
153
+
154
+
letSome(download) = download else{
155
+
// N.B. We should only be in this case when downloads are disabled; when downloads are
156
+
// enabled, we should fail eagerly when something goes wrong with the download.
157
+
debug_assert!(!downloads_enabled);
129
158
returnErr(err);
130
159
};
131
160
132
-
debug!("Requested Python not found, checking for available download...");
133
-
matchSelf::fetch(
134
-
request.fill()?,
161
+
// If the download is available, but not usable, we should hint why and return the original
162
+
// error.
163
+
// TODO(zanieb): Attach these as actual hints to the error, instead of just logging.
164
+
if !downloads_enabled {
165
+
match python_downloads {
166
+
PythonDownloads::Automatic => {}
167
+
PythonDownloads::Manual => {
168
+
returnErr(err.with_missing_python_hint(format!(
169
+
"A managed Python download is available for {request}, but Python downloads are set to 'manual', use `uv python install {request}` to install the required version"
170
+
)));
171
+
}
172
+
PythonDownloads::Never => {
173
+
returnErr(err.with_missing_python_hint(format!(
174
+
"A managed Python download is available for {request}, but Python downloads are set to 'never'"
175
+
)));
176
+
}
177
+
}
178
+
179
+
match preference {
180
+
PythonPreference::OnlySystem => {
181
+
returnErr(err.with_missing_python_hint(format!(
182
+
"A managed Python download is available for {request}, but the Python preference is set to 'only system'"
183
+
)));
184
+
}
185
+
PythonPreference::Managed
186
+
| PythonPreference::OnlyManaged
187
+
| PythonPreference::System => {}
188
+
}
189
+
190
+
if !client_builder.connectivity.is_online(){
191
+
returnErr(err.with_missing_python_hint(format!(
192
+
"A managed Python download is available for request `{request}`, but uv is set to offline mode"
193
+
)));
194
+
}
195
+
196
+
returnErr(err);
197
+
}
198
+
199
+
Self::fetch(
200
+
download,
135
201
client_builder,
136
202
cache,
137
203
reporter,
138
204
python_install_mirror,
139
205
pypy_install_mirror,
140
-
python_downloads_json_url,
141
206
preview,
142
207
)
143
208
.await
144
-
{
145
-
Ok(installation) => Ok(installation),
146
-
// Throw the original error if we couldn't find a download
0 commit comments