fix(venv.relocatable): script entrypoints should work if symlinked to (#8079)

Fixes: #8058

## Test Plan

Integration test (but only for Unix, because symlinks on Windows require
admin privs. Plus, they are not really all that idiomatic on Windows)
This commit is contained in:
Pavel Dikov 2024-10-10 13:00:56 +01:00 committed by GitHub
parent f2741220e5
commit bf15ca93cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View file

@ -298,9 +298,7 @@ pub(crate) fn create(
let virtual_env_dir = match (relocatable, name.to_owned()) {
(true, "activate") => {
// Extremely verbose, but should cover all major POSIX shells,
// as well as platforms where `readlink` does not implement `-f`.
r#"'"$(dirname -- "$(CDPATH= cd -- "$(dirname -- "$SCRIPT_PATH")" > /dev/null && echo "$PWD")")"'"#
r#"'"$(dirname -- "$(dirname -- "$(realpath -- "$SCRIPT_PATH")")")"'"#
}
(true, "activate.bat") => r"%~dp0..",
(true, "activate.fish") => {