From 5c698a5ed76e208fe01fb141b695729e2e1bc64f Mon Sep 17 00:00:00 2001 From: Josh Stern Date: Mon, 29 Jul 2024 18:45:20 -0400 Subject: [PATCH] Remove linuxbrew from path when detecting shell Addresses issue: pypa#6197 This updates the check to only look at the path after linuxbrew if it is present. --- news/6197.bugfix.rst | 1 + pipenv/shells.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 news/6197.bugfix.rst diff --git a/news/6197.bugfix.rst b/news/6197.bugfix.rst new file mode 100644 index 0000000000..67def678c9 --- /dev/null +++ b/news/6197.bugfix.rst @@ -0,0 +1 @@ +Remove linuxbrew from path when detecting shells. diff --git a/pipenv/shells.py b/pipenv/shells.py index 89467cddb8..c12cccfcea 100644 --- a/pipenv/shells.py +++ b/pipenv/shells.py @@ -35,6 +35,11 @@ def _get_activate_script(cmd, venv): This is POSIX-only at the moment since the compat (pexpect-based) shell does not work elsewhere anyway. """ + + # Split on linuxbrew in case users have installed there shell using it. + # Otherwise the `nu` substring will trigger the nu shell path. + cmd = cmd.split(".linuxbrew")[-1] + # Suffix and source command for other shells. # Support for fish shell. if "fish" in cmd: