Commits

Doug Hellmann committed e6c39da Merge

merge fix for relative python interpreter option to mkvirtualenv

Comments (0)

Files changed (2)

docs/source/command_ref.rst

     add2virtualenv directory1 directory2 ...
 
 Sometimes it is desirable to share installed packages that are not in
-the system ``site-pacakges`` directory and which should not be
+the system ``site-packages`` directory and which should not be
 installed in each virtualenv.  One possible solution is to symlink the
 source into the environment ``site-packages`` directory, but it is
 also easy to add extra directories to the PYTHONPATH by including them

virtualenvwrapper.sh

     fi
 }
 
+function virtualenvwrapper_absolutepath {
+    if [ "$1" = "" ]; then
+        return 1
+    else
+        "$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.abspath(\"$1\")+'\n')"
+        return 0
+    fi
+}
+
 function virtualenvwrapper_derive_workon_home {
     typeset workon_home_dir="$WORKON_HOME"
 
             -i)
                 i=$(( $i + 1 ));
                 packages="$packages ${in_args[$i]}";;
+            -p|--python)
+                i=$(( $i + 1 ));
+                interpreter="${in_args[$i]}";
+                interpreter=$(virtualenvwrapper_absolutepath "$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=\$$#"
 
     for pydir in "$@"
     do
-        absolute_path=$("$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.abspath(\"$pydir\")+'\n')")
+        absolute_path=$(virtualenvwrapper_absolutepath "$pydir")
         if [ "$absolute_path" != "$pydir" ]
         then
             echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2
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.