mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-19 11:15:01 +00:00
Add support for configuring python-downloads
with UV_PYTHON_DOWNLOADS
(#6436)
Part of https://github.com/astral-sh/uv/issues/6406 Replaces #6416
This commit is contained in:
parent
99d278f9f5
commit
7502a963e1
7 changed files with 74 additions and 45 deletions
|
@ -89,6 +89,19 @@ pub enum PythonDownloads {
|
|||
Never,
|
||||
}
|
||||
|
||||
impl FromStr for PythonDownloads {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_ascii_lowercase().as_str() {
|
||||
"auto" | "automatic" | "true" | "1" => Ok(PythonDownloads::Automatic),
|
||||
"manual" => Ok(PythonDownloads::Manual),
|
||||
"never" | "false" | "0" => Ok(PythonDownloads::Never),
|
||||
_ => Err(format!("Invalid value for `python-download`: '{s}'")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for PythonDownloads {
|
||||
fn from(value: bool) -> Self {
|
||||
if value {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue