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::
396
396
add2virtualenv directory1 directory2 ...
397
397
398
398
Sometimes 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
400
400
installed in each virtualenv. One possible solution is to symlink the
401
401
source into the environment ``site-packages `` directory, but it is
402
402
also 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 {
110
110
fi
111
111
}
112
112
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
+
113
122
function virtualenvwrapper_derive_workon_home {
114
123
typeset workon_home_dir=" $WORKON_HOME "
115
124
@@ -402,6 +411,10 @@ function mkvirtualenv {
402
411
-i)
403
412
i=$(( $i + 1 )) ;
404
413
packages=" $packages ${in_args[$i]} " ;;
414
+ -p|--python)
415
+ i=$(( $i + 1 )) ;
416
+ interpreter=" ${in_args[$i]} " ;
417
+ interpreter=$( virtualenvwrapper_absolutepath " $interpreter " ) ;;
405
418
-r)
406
419
i=$(( $i + 1 )) ;
407
420
requirements=" ${in_args[$i]} " ;
@@ -417,6 +430,11 @@ function mkvirtualenv {
417
430
i=$(( $i + 1 ))
418
431
done
419
432
433
+ if [ ! -z $interpreter ]
434
+ then
435
+ out_args=( " --python=$interpreter " ${out_args[@]} )
436
+ fi ;
437
+
420
438
set -- " ${out_args[@]} "
421
439
422
440
eval " envname=\$ $# "
@@ -740,7 +758,7 @@ function add2virtualenv {
740
758
741
759
for pydir in " $@ "
742
760
do
743
- absolute_path=$( " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.abspath( \" $pydir \" )+'\n') " )
761
+ absolute_path=$( virtualenvwrapper_absolutepath " $pydir " )
744
762
if [ " $absolute_path " != " $pydir " ]
745
763
then
746
764
echo " Warning: Converting \" $pydir \" to \" $absolute_path \" " 1>&2
You can’t perform that action at this time.
0 commit comments