Ales Zoulek avatar Ales Zoulek committed 07041d5

virtualenvwrapper.sh supports alternative venv binary name

Comments (0)

Files changed (1)

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" && 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.