Commits

Ales Zoulek  committed 07041d5

virtualenvwrapper.sh supports alternative venv binary name

  • Participants
  • Parent commits 49436b6

Comments (0)

Files changed (1)

File virtualenvwrapper.sh

 # Locate the global Python where virtualenvwrapper is installed.
 if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ]
 then
-    VIRTUALENVWRAPPER_PYTHON="$(\which python)"
+    VIRTUALENVWRAPPER_PYTHON="$(\which python2)"
+fi
+
+if [ "$VIRTUALENV_BINARY" = "" ]
+then
+    VIRTUALENV_BINARY="virtualenv"
 fi
 
 virtualenvwrapper_derive_workon_home() {
 
 # Verify that virtualenv is installed and visible
 virtualenvwrapper_verify_virtualenv () {
-    typeset venv=$(\which virtualenv | (unset GREP_OPTIONS; \grep -v "not found"))
+    typeset venv=$(\which $VIRTUALENV_BINARY | (unset GREP_OPTIONS; \grep -v "not found"))
     if [ "$venv" = "" ]
     then
         echo "ERROR: virtualenvwrapper could not find virtualenv in your path" >&2
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_virtualenv || return 1
     (cd "$WORKON_HOME" &&
-        virtualenv "$@" &&
+        $VIRTUALENV_BINARY "$@" &&
         [ -d "$WORKON_HOME/$envname" ] && virtualenvwrapper_run_hook "pre_mkvirtualenv" "$envname"
         )
     typeset RC=$?
         \chmod a+x "$script"
     done
 
-    virtualenv "$target_env" --relocatable
+    $VIRTUALENV_BINARY "$target_env" --relocatable
     \sed "s/VIRTUAL_ENV\(.*\)$env_name/VIRTUAL_ENV\1$new_env/g" < "$source_env/bin/activate" > "$target_env/bin/activate"
 
     (cd "$WORKON_HOME" &&