mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Fetch managed toolchains if necessary in uv tool install
and uv tool run
(#4717)
Hey we should download toolchains here if we need to, right!?
This commit is contained in:
parent
c0a06a2c1b
commit
ad5151cda8
2 changed files with 19 additions and 18 deletions
|
@ -10,7 +10,7 @@ use tracing::debug;
|
||||||
use distribution_types::Name;
|
use distribution_types::Name;
|
||||||
use pypi_types::Requirement;
|
use pypi_types::Requirement;
|
||||||
use uv_cache::Cache;
|
use uv_cache::Cache;
|
||||||
use uv_client::Connectivity;
|
use uv_client::{BaseClientBuilder, Connectivity};
|
||||||
use uv_configuration::{Concurrency, PreviewMode, Reinstall};
|
use uv_configuration::{Concurrency, PreviewMode, Reinstall};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use uv_fs::replace_symlink;
|
use uv_fs::replace_symlink;
|
||||||
|
@ -40,7 +40,7 @@ pub(crate) async fn install(
|
||||||
settings: ResolverInstallerSettings,
|
settings: ResolverInstallerSettings,
|
||||||
preview: PreviewMode,
|
preview: PreviewMode,
|
||||||
toolchain_preference: ToolchainPreference,
|
toolchain_preference: ToolchainPreference,
|
||||||
_toolchain_fetch: ToolchainFetch,
|
toolchain_fetch: ToolchainFetch,
|
||||||
connectivity: Connectivity,
|
connectivity: Connectivity,
|
||||||
concurrency: Concurrency,
|
concurrency: Concurrency,
|
||||||
native_tls: bool,
|
native_tls: bool,
|
||||||
|
@ -51,16 +51,19 @@ pub(crate) async fn install(
|
||||||
warn_user_once!("`uv tool install` is experimental and may change without warning.");
|
warn_user_once!("`uv tool install` is experimental and may change without warning.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(zanieb): Use `find_or_fetch` here
|
let client_builder = BaseClientBuilder::new()
|
||||||
let interpreter = Toolchain::find(
|
.connectivity(connectivity)
|
||||||
&python
|
.native_tls(native_tls);
|
||||||
.as_deref()
|
|
||||||
.map(ToolchainRequest::parse)
|
let interpreter = Toolchain::find_or_fetch(
|
||||||
.unwrap_or_default(),
|
python.as_deref().map(ToolchainRequest::parse),
|
||||||
EnvironmentPreference::OnlySystem,
|
EnvironmentPreference::OnlySystem,
|
||||||
toolchain_preference,
|
toolchain_preference,
|
||||||
|
toolchain_fetch,
|
||||||
|
&client_builder,
|
||||||
cache,
|
cache,
|
||||||
)?
|
)
|
||||||
|
.await?
|
||||||
.into_interpreter();
|
.into_interpreter();
|
||||||
|
|
||||||
// Initialize any shared state.
|
// Initialize any shared state.
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub(crate) async fn run(
|
||||||
_isolated: bool,
|
_isolated: bool,
|
||||||
preview: PreviewMode,
|
preview: PreviewMode,
|
||||||
toolchain_preference: ToolchainPreference,
|
toolchain_preference: ToolchainPreference,
|
||||||
_toolchain_fetch: ToolchainFetch,
|
toolchain_fetch: ToolchainFetch,
|
||||||
connectivity: Connectivity,
|
connectivity: Connectivity,
|
||||||
concurrency: Concurrency,
|
concurrency: Concurrency,
|
||||||
native_tls: bool,
|
native_tls: bool,
|
||||||
|
@ -77,17 +77,15 @@ pub(crate) async fn run(
|
||||||
debug!("Syncing ephemeral environment.");
|
debug!("Syncing ephemeral environment.");
|
||||||
|
|
||||||
// Discover an interpreter.
|
// Discover an interpreter.
|
||||||
// Note we force preview on during `uv tool run` for now since the entire interface is in preview
|
let interpreter = Toolchain::find_or_fetch(
|
||||||
// TODO(zanieb): We should use `find_or_fetch` here
|
python.as_deref().map(ToolchainRequest::parse),
|
||||||
let interpreter = Toolchain::find(
|
|
||||||
&python
|
|
||||||
.as_deref()
|
|
||||||
.map(ToolchainRequest::parse)
|
|
||||||
.unwrap_or_default(),
|
|
||||||
EnvironmentPreference::OnlySystem,
|
EnvironmentPreference::OnlySystem,
|
||||||
toolchain_preference,
|
toolchain_preference,
|
||||||
|
toolchain_fetch,
|
||||||
|
&client_builder,
|
||||||
cache,
|
cache,
|
||||||
)?
|
)
|
||||||
|
.await?
|
||||||
.into_interpreter();
|
.into_interpreter();
|
||||||
|
|
||||||
// Create a virtual environment.
|
// Create a virtual environment.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue