From dac2f6601d1277609a502694acc3ac42e4e98905 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 22 Feb 2018 00:15:42 +0800 Subject: [PATCH] Update activate_virtualenv for Fish 3.0+ Fish 3 removes the `.` command in favour of `source`, so we need to adapt. See fish-shell/fish-shell#4294 and https://github.com/pypa/pipenv/pull/1388#issuecomment-367353694 --- pipenv/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index c672f72f..418fe7cd 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1180,12 +1180,14 @@ def do_lock(verbose=False, system=False, clear=False, pre=False): def activate_virtualenv(source=True): """Returns the string to activate a virtualenv.""" - # Suffix for other shells. + # Suffix and source command for other shells. suffix = '' + command = '.' if source else '' # Support for fish shell. if PIPENV_SHELL and 'fish' in PIPENV_SHELL: suffix = '.fish' + command = 'source' # Support for csh shell. if PIPENV_SHELL and 'csh' in PIPENV_SHELL: @@ -1196,7 +1198,7 @@ def activate_virtualenv(source=True): venv_location = project.virtualenv_location.replace(' ', r'\ ') if source: - return '. {0}/bin/activate{1}'.format(venv_location, suffix) + return '{2} {0}/bin/activate{1}'.format(venv_location, suffix, command) else: return '{0}/bin/activate'.format(venv_location)