mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-29 21:44:51 +00:00
Normalize VIRTUAL_ENV
path in activation scripts (#1817)
This commit is contained in:
parent
cff16f5736
commit
fac9d843dc
3 changed files with 12 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1293,6 +1293,7 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"uv-cache",
|
"uv-cache",
|
||||||
|
"uv-fs",
|
||||||
"uv-interpreter",
|
"uv-interpreter",
|
||||||
"which",
|
"which",
|
||||||
]
|
]
|
||||||
|
|
|
@ -23,6 +23,7 @@ workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
platform-host = { path = "../platform-host" }
|
platform-host = { path = "../platform-host" }
|
||||||
uv-cache = { path = "../uv-cache" }
|
uv-cache = { path = "../uv-cache" }
|
||||||
|
uv-fs = { path = "../uv-fs" }
|
||||||
uv-interpreter = { path = "../uv-interpreter" }
|
uv-interpreter = { path = "../uv-interpreter" }
|
||||||
|
|
||||||
anstream = { workspace = true }
|
anstream = { workspace = true }
|
||||||
|
|
|
@ -9,6 +9,7 @@ use camino::{FromPathBufError, Utf8Path, Utf8PathBuf};
|
||||||
use fs_err as fs;
|
use fs_err as fs;
|
||||||
use fs_err::File;
|
use fs_err::File;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
use uv_fs::Normalized;
|
||||||
|
|
||||||
use uv_interpreter::Interpreter;
|
use uv_interpreter::Interpreter;
|
||||||
|
|
||||||
|
@ -183,9 +184,16 @@ pub fn create_bare_venv(
|
||||||
// cross-platform.
|
// cross-platform.
|
||||||
for (name, template) in ACTIVATE_TEMPLATES {
|
for (name, template) in ACTIVATE_TEMPLATES {
|
||||||
let activator = template
|
let activator = template
|
||||||
.replace("{{ VIRTUAL_ENV_DIR }}", location.as_str())
|
.replace(
|
||||||
|
"{{ VIRTUAL_ENV_DIR }}",
|
||||||
|
// SAFETY: `unwrap` is guaranteed to succeed because `location` is an `Utf8PathBuf`.
|
||||||
|
location.normalized().to_str().unwrap(),
|
||||||
|
)
|
||||||
.replace("{{ BIN_NAME }}", bin_name)
|
.replace("{{ BIN_NAME }}", bin_name)
|
||||||
.replace("{{ VIRTUAL_PROMPT }}", prompt.as_deref().unwrap_or(""))
|
.replace(
|
||||||
|
"{{ VIRTUAL_PROMPT }}",
|
||||||
|
prompt.as_deref().unwrap_or_default(),
|
||||||
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"{{ RELATIVE_SITE_PACKAGES }}",
|
"{{ RELATIVE_SITE_PACKAGES }}",
|
||||||
&format!(
|
&format!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue