Commits

Radu Voicilas committed ab606e5

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.

Comments (0)

Files changed (1)

virtualenvwrapper.sh

             -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=\$$#"