mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Add EXTERNALLY-MANAGED
markers to managed toolchains (#4312)
Closes #4240 e.g. ``` ❯ cargo run -q -- pip install anyio --python "/Users/zb/Library/Application Support/uv/toolchains/cpython-3.12.0-macos-aarch64-none/install/bin/python3" error: The interpreter at /Users/zb/Library/Application Support/uv/toolchains/cpython-3.12.0-macos-aarch64-none/install is externally managed, and indicates the following: This toolchain is managed by uv and should not be modified. Consider creating a virtual environment with `uv venv`. ```
This commit is contained in:
parent
e264637b63
commit
67f1285ce3
4 changed files with 30 additions and 3 deletions
|
@ -8,7 +8,7 @@ use uv_toolchain::ToolchainRequest;
|
|||
|
||||
use uv_fs::Simplified;
|
||||
use uv_toolchain::downloads::{DownloadResult, Error, PythonDownload, PythonDownloadRequest};
|
||||
use uv_toolchain::managed::InstalledToolchains;
|
||||
use uv_toolchain::managed::{InstalledToolchain, InstalledToolchains};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
pub(crate) struct FetchPythonArgs {
|
||||
|
@ -73,6 +73,11 @@ pub(crate) async fn fetch_python(args: FetchPythonArgs) -> Result<()> {
|
|||
results.push((version, path));
|
||||
}
|
||||
|
||||
for (_, path) in results {
|
||||
let installed = InstalledToolchain::new(path)?;
|
||||
installed.ensure_externally_managed()?;
|
||||
}
|
||||
|
||||
if downloaded > 0 {
|
||||
let s = if downloaded == 1 { "" } else { "s" };
|
||||
info!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue