diff --git a/Cargo.lock b/Cargo.lock index a5b750ffe..040d95986 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1293,6 +1293,7 @@ dependencies = [ "tracing", "tracing-subscriber", "uv-cache", + "uv-fs", "uv-interpreter", "which", ] diff --git a/crates/gourgeist/Cargo.toml b/crates/gourgeist/Cargo.toml index 91e6b5bd6..2edd705d5 100644 --- a/crates/gourgeist/Cargo.toml +++ b/crates/gourgeist/Cargo.toml @@ -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 } diff --git a/crates/gourgeist/src/bare.rs b/crates/gourgeist/src/bare.rs index 9c368f460..aff617b70 100644 --- a/crates/gourgeist/src/bare.rs +++ b/crates/gourgeist/src/bare.rs @@ -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!(