Skip to content

Commit

Permalink
Use Scripts folder for virtualenv activation prompt (astral-sh#2690)
Browse files Browse the repository at this point in the history
## Summary

We shouldn't assume that you're on Unix when using Nushell.

Closes astral-sh#2687.
  • Loading branch information
charliermarsh authored Mar 27, 2024
1 parent 8c7a603 commit 15c9a5c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions crates/uv/src/commands/venv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,28 +231,25 @@ async fn venv_impl(
None => None,
Some(Shell::Bash | Shell::Zsh) => Some(format!(
"source {}",
shlex_posix(path.join("bin").join("activate"))
shlex_posix(venv.scripts().join("activate"))
)),
Some(Shell::Fish) => Some(format!(
"source {}",
shlex_posix(path.join("bin").join("activate.fish"))
shlex_posix(venv.scripts().join("activate.fish"))
)),
Some(Shell::Nushell) => Some(format!(
"overlay use {}",
shlex_posix(path.join("bin").join("activate.nu"))
shlex_posix(venv.scripts().join("activate.nu"))
)),
Some(Shell::Csh) => Some(format!(
"source {}",
shlex_posix(path.join("bin").join("activate.csh"))
shlex_posix(venv.scripts().join("activate.csh"))
)),
Some(Shell::Powershell) => Some(shlex_windows(
path.join("Scripts").join("activate"),
venv.scripts().join("activate"),
Shell::Powershell,
)),
Some(Shell::Cmd) => Some(shlex_windows(
path.join("Scripts").join("activate"),
Shell::Cmd,
)),
Some(Shell::Cmd) => Some(shlex_windows(venv.scripts().join("activate"), Shell::Cmd)),
};
if let Some(act) = activation {
writeln!(printer.stderr(), "Activate with: {}", act.green()).into_diagnostic()?;
Expand Down

0 comments on commit 15c9a5c

Please sign in to comment.