File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ Syntax::
396396 add2virtualenv directory1 directory2 ...
397397
398398Sometimes it is desirable to share installed packages that are not in
399- the system ``site-pacakges `` directory and which should not be
399+ the system ``site-packages `` directory and which should not be
400400installed in each virtualenv. One possible solution is to symlink the
401401source into the environment ``site-packages `` directory, but it is
402402also easy to add extra directories to the PYTHONPATH by including them
Original file line number Diff line number Diff line change @@ -110,6 +110,15 @@ function virtualenvwrapper_expandpath {
110110 fi
111111}
112112
113+ function virtualenvwrapper_absolutepath {
114+ if [ " $1 " = " " ]; then
115+ return 1
116+ else
117+ " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.abspath(\" $1 \" )+'\n')"
118+ return 0
119+ fi
120+ }
121+
113122function virtualenvwrapper_derive_workon_home {
114123 typeset workon_home_dir=" $WORKON_HOME "
115124
@@ -402,6 +411,10 @@ function mkvirtualenv {
402411 -i)
403412 i=$(( $i + 1 )) ;
404413 packages=" $packages ${in_args[$i]} " ;;
414+ -p|--python)
415+ i=$(( $i + 1 )) ;
416+ interpreter=" ${in_args[$i]} " ;
417+ interpreter=$( virtualenvwrapper_absolutepath " $interpreter " ) ;;
405418 -r)
406419 i=$(( $i + 1 )) ;
407420 requirements=" ${in_args[$i]} " ;
@@ -417,6 +430,11 @@ function mkvirtualenv {
417430 i=$(( $i + 1 ))
418431 done
419432
433+ if [ ! -z $interpreter ]
434+ then
435+ out_args=( " --python=$interpreter " ${out_args[@]} )
436+ fi ;
437+
420438 set -- " ${out_args[@]} "
421439
422440 eval " envname=\$ $# "
@@ -740,7 +758,7 @@ function add2virtualenv {
740758
741759 for pydir in " $@ "
742760 do
743- absolute_path=$( " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.abspath( \" $pydir \" )+'\n') " )
761+ absolute_path=$( virtualenvwrapper_absolutepath " $pydir " )
744762 if [ " $absolute_path " != " $pydir " ]
745763 then
746764 echo " Warning: Converting \" $pydir \" to \" $absolute_path \" " 1>&2
You can’t perform that action at this time.
0 commit comments