1. Doug Hellmann
  2. virtualenvwrapper

Commits

Radu Voicilas  committed e41f4f1

Fix --python switch for virtualenv.

When using mkvirtualenv and pass in the --python (or the shorter -p version),
virtualenv will fail to find the correct interpreter path if that path is relative to the
working dir, because virtualenvwrapper switches the current directory right before calling virtualenv.

  • Participants
  • Parent commits ae236e2
  • Branches master

Comments (0)

Files changed (1)

File virtualenvwrapper.sh

View file
  • Ignore whitespace
             -i)
                 i=$(( $i + 1 ));
                 packages="$packages ${in_args[$i]}";;
+            -p|--python)
+                i=$(( $i + 1 ));
+                interpreter="${in_args[$i]}";
+                interpreter=$(realpath "$interpreter");;
             -r)
                 i=$(( $i + 1 ));
                 requirements="${in_args[$i]}";
         i=$(( $i + 1 ))
     done
 
+    if [ ! -z $interpreter ]
+    then
+        out_args=( "--python=$interpreter" ${out_args[@]} )
+    fi;
+
     set -- "${out_args[@]}"
 
     eval "envname=\$$#"