mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-02 23:04:37 +00:00
Update uv run
and uv tool run
to use Toolchain::find
(#4134)
Extends https://github.com/astral-sh/uv/pull/4121
This commit is contained in:
parent
53035d65a1
commit
0f4f3b4714
2 changed files with 17 additions and 10 deletions
|
@ -108,11 +108,15 @@ pub(crate) async fn run(
|
|||
// Discover an interpreter.
|
||||
let interpreter = if let Some(project_env) = &project_env {
|
||||
project_env.interpreter().clone()
|
||||
} else if let Some(python) = python.as_ref() {
|
||||
Toolchain::find_requested(python, SystemPython::Allowed, preview, cache)?
|
||||
.into_interpreter()
|
||||
} else {
|
||||
Toolchain::find_default(preview, cache)?.into_interpreter()
|
||||
// Note we force preview on during `uv run` for now since the entire interface is in preview
|
||||
Toolchain::find(
|
||||
python.as_deref(),
|
||||
SystemPython::Allowed,
|
||||
PreviewMode::Enabled,
|
||||
cache,
|
||||
)?
|
||||
.into_interpreter()
|
||||
};
|
||||
|
||||
// TODO(charlie): If the environment satisfies the requirements, skip creation.
|
||||
|
|
|
@ -52,13 +52,16 @@ pub(crate) async fn run(
|
|||
debug!("Syncing ephemeral environment.");
|
||||
|
||||
// Discover an interpreter.
|
||||
let interpreter = if let Some(python) = python.as_ref() {
|
||||
Toolchain::find_requested(python, SystemPython::Allowed, preview, cache)?.into_interpreter()
|
||||
} else {
|
||||
Toolchain::find_default(preview, cache)?.into_interpreter()
|
||||
};
|
||||
// Note we force preview on during `uv tool run` for now since the entire interface is in preview
|
||||
let interpreter = Toolchain::find(
|
||||
python.as_deref(),
|
||||
SystemPython::Allowed,
|
||||
PreviewMode::Enabled,
|
||||
cache,
|
||||
)?
|
||||
.into_interpreter();
|
||||
|
||||
// Create a virtual environment
|
||||
// Create a virtual environment1
|
||||
// TODO(zanieb): Move this path derivation elsewhere
|
||||
let uv_state_path = std::env::current_dir()?.join(".uv");
|
||||
fs_err::create_dir_all(&uv_state_path)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue