File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 22Release History
33===============
44
5+ dev
6+
7+ - Incorporated patch to add ``-d `` option to
8+ :ref: `command-add2virtualenv `, contributed by :bbuser: `miracle2k `.
9+
5102.9
611
712 - Change the shell function shell definition syntax so that ksh will
Original file line number Diff line number Diff line change @@ -28,12 +28,17 @@ test_add2virtualenv () {
2828 cdsitepackages
2929 # Check contents of path file
3030 path_file=" ./_virtualenv_path_extensions.pth"
31- assertTrue " No $full_path in ` cat $path_file ` " " grep $full_path $path_file "
32- assertTrue " No path insert code in ` cat $path_file ` " " grep sys.__egginsert $path_file "
31+ assertTrue " No $full_path in $( cat $path_file ) " " grep $full_path $path_file "
32+ assertTrue " No path insert code in $( cat $path_file ) " " grep sys.__egginsert $path_file "
3333 # Check the path we inserted is actually at the top
3434 expected=$full_path
3535 actual=$( $WORKON_HOME /pathtest/bin/python -c " import sys; print sys.path[1]" )
3636 assertSame " $expected " " $actual "
37+
38+ # Make sure the temporary file created
39+ # during the edit was removed
40+ assertFalse " Temporary file ${path_file} .tmp still exists" " [ -f ${path_file} .tmp ]"
41+
3742 cd -
3843}
3944
Original file line number Diff line number Diff line change @@ -579,7 +579,6 @@ function virtualenvwrapper_get_site_packages_dir {
579579# site-packages directory; if this file does not exist, it will be
580580# created first.
581581function add2virtualenv {
582-
583582 virtualenvwrapper_verify_workon_home || return 1
584583 virtualenvwrapper_verify_active_environment || return 1
585584
@@ -630,10 +629,13 @@ function add2virtualenv {
630629
631630 if [ $remove -eq 1 ]
632631 then
633- sed -i " \:^$absolute_path $: d" " $path_file "
632+ sed -i.tmp " \:^$absolute_path $: d" " $path_file "
634633 else
635- sed -i " 1a $absolute_path " " $path_file "
634+ sed -i.tmp ' 1 a\
635+ ' $absolute_path '
636+ ' " $path_file "
636637 fi
638+ rm -f " ${path_file} .tmp"
637639 done
638640 return 0
639641}
You can’t perform that action at this time.
0 commit comments