mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +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-subscriber",
|
||||
"uv-cache",
|
||||
"uv-fs",
|
||||
"uv-interpreter",
|
||||
"which",
|
||||
]
|
||||
|
|
|
@ -23,6 +23,7 @@ workspace = true
|
|||
[dependencies]
|
||||
platform-host = { path = "../platform-host" }
|
||||
uv-cache = { path = "../uv-cache" }
|
||||
uv-fs = { path = "../uv-fs" }
|
||||
uv-interpreter = { path = "../uv-interpreter" }
|
||||
|
||||
anstream = { workspace = true }
|
||||
|
|
|
@ -9,6 +9,7 @@ use camino::{FromPathBufError, Utf8Path, Utf8PathBuf};
|
|||
use fs_err as fs;
|
||||
use fs_err::File;
|
||||
use tracing::info;
|
||||
use uv_fs::Normalized;
|
||||
|
||||
use uv_interpreter::Interpreter;
|
||||
|
||||
|
@ -183,9 +184,16 @@ pub fn create_bare_venv(
|
|||
// cross-platform.
|
||||
for (name, template) in ACTIVATE_TEMPLATES {
|
||||
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("{{ VIRTUAL_PROMPT }}", prompt.as_deref().unwrap_or(""))
|
||||
.replace(
|
||||
"{{ VIRTUAL_PROMPT }}",
|
||||
prompt.as_deref().unwrap_or_default(),
|
||||
)
|
||||
.replace(
|
||||
"{{ RELATIVE_SITE_PACKAGES }}",
|
||||
&format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue