mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-21 15:52:15 +00:00
Add uv python install --default
(#8650)
This pull request is best viewed with [whitespace hidden](https://github.com/astral-sh/uv/pull/8650/files?diff=unified&w=1) Adds a `--default` flag to `uv python install` in preview. This includes a `python` and `python{major}` executable in addition to the `python{major}.{minor}` executable. We will replace uv-managed executables, but externally managed executables require the `--force` flag to overwrite. If you run `uv python install` (without arguments), we include the `--default` flag implicitly to populate `python` and `python3` for the "default" install version. In the future, we should add a warning if the installed executable isn't at the front of the PATH.
This commit is contained in:
parent
97114ebe4b
commit
63443f1984
9 changed files with 500 additions and 125 deletions
|
@ -327,8 +327,8 @@ impl PythonInstallationKey {
|
|||
&self.libc
|
||||
}
|
||||
|
||||
/// Return a canonical name for a versioned executable.
|
||||
pub fn versioned_executable_name(&self) -> String {
|
||||
/// Return a canonical name for a minor versioned executable.
|
||||
pub fn executable_name_minor(&self) -> String {
|
||||
format!(
|
||||
"python{maj}.{min}{var}{exe}",
|
||||
maj = self.major,
|
||||
|
@ -337,6 +337,25 @@ impl PythonInstallationKey {
|
|||
exe = std::env::consts::EXE_SUFFIX
|
||||
)
|
||||
}
|
||||
|
||||
/// Return a canonical name for a major versioned executable.
|
||||
pub fn executable_name_major(&self) -> String {
|
||||
format!(
|
||||
"python{maj}{var}{exe}",
|
||||
maj = self.major,
|
||||
var = self.variant.suffix(),
|
||||
exe = std::env::consts::EXE_SUFFIX
|
||||
)
|
||||
}
|
||||
|
||||
/// Return a canonical name for an un-versioned executable.
|
||||
pub fn executable_name(&self) -> String {
|
||||
format!(
|
||||
"python{var}{exe}",
|
||||
var = self.variant.suffix(),
|
||||
exe = std::env::consts::EXE_SUFFIX
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for PythonInstallationKey {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue