Skip to content

remove python2 from startup logic for finding the python interpreter #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions virtualenvwrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,21 @@
#

# Locate the global Python where virtualenvwrapper is installed.
# Use the highest Python version
if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ]
then
for NAME in python3 python2 python
do
python_executable="$(which $NAME 2>/dev/null)"
if ! [ -z "$python_executable" ]
then
if $python_executable -m 'virtualenvwrapper.hook_loader' --help >/dev/null 2>&1
then
VIRTUALENVWRAPPER_PYTHON=$python_executable
break
fi
fi
done
if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ]
_virtualenvwrapper_python_executable="$(which python3 2>/dev/null)"
if [ -n "$_virtualenvwrapper_python_executable" ] && $_virtualenvwrapper_python_executable -m 'virtualenvwrapper.hook_loader' --help >/dev/null 2>&1
then
echo -e "ERROR: Python with virtualenvwrapper module not found!
Either, install virtualenvwrapper module for standard python2
or python3 or set VIRTUALENVWRAPPER_PYTHON variable manually." 1>&2
return 1
VIRTUALENVWRAPPER_PYTHON=$_virtualenvwrapper_python_executable
fi
fi
if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ]
then
echo -e "ERROR: Python with virtualenvwrapper module not found!
Either, install virtualenvwrapper module for the default python3 interpreter
or set VIRTUALENVWRAPPER_PYTHON to the interpreter to use." 1>&2
return 1
fi

# Set the name of the virtualenv app to use.
if [ "${VIRTUALENVWRAPPER_VIRTUALENV:-}" = "" ]
Expand Down