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 2
2
Release History
3
3
===============
4
4
5
+ dev
6
+
7
+ - Incorporated patch to add ``-d `` option to
8
+ :ref: `command-add2virtualenv `, contributed by :bbuser: `miracle2k `.
9
+
5
10
2.9
6
11
7
12
- 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 () {
28
28
cdsitepackages
29
29
# Check contents of path file
30
30
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 "
33
33
# Check the path we inserted is actually at the top
34
34
expected=$full_path
35
35
actual=$( $WORKON_HOME /pathtest/bin/python -c " import sys; print sys.path[1]" )
36
36
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
+
37
42
cd -
38
43
}
39
44
Original file line number Diff line number Diff line change @@ -579,7 +579,6 @@ function virtualenvwrapper_get_site_packages_dir {
579
579
# site-packages directory; if this file does not exist, it will be
580
580
# created first.
581
581
function add2virtualenv {
582
-
583
582
virtualenvwrapper_verify_workon_home || return 1
584
583
virtualenvwrapper_verify_active_environment || return 1
585
584
@@ -630,10 +629,13 @@ function add2virtualenv {
630
629
631
630
if [ $remove -eq 1 ]
632
631
then
633
- sed -i " \:^$absolute_path $: d" " $path_file "
632
+ sed -i.tmp " \:^$absolute_path $: d" " $path_file "
634
633
else
635
- sed -i " 1a $absolute_path " " $path_file "
634
+ sed -i.tmp ' 1 a\
635
+ ' $absolute_path '
636
+ ' " $path_file "
636
637
fi
638
+ rm -f " ${path_file} .tmp"
637
639
done
638
640
return 0
639
641
}
You can’t perform that action at this time.
0 commit comments