File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ test_dir=$( cd $( dirname $0 ) && pwd)
4
+ source " $test_dir /setup.sh"
5
+ TMP_WORKON_HOME=" $WORKON_HOME "
6
+
7
+ oneTimeSetUp () {
8
+ source " $test_dir /../virtualenvwrapper.sh"
9
+ echo $PYTHONPATH
10
+ }
11
+
12
+ oneTimeTearDown () {
13
+ return 0
14
+ }
15
+
16
+ test_tilde () {
17
+ assertSame " $HOME " " $( virtualenvwrapper_expandpath ~ ) "
18
+ }
19
+
20
+ test_vars () {
21
+ assertSame " $HOME " " $( virtualenvwrapper_expandpath ' $HOME' ) "
22
+ }
23
+
24
+ test_tilde_vars () {
25
+ assertSame " $HOME " " $( virtualenvwrapper_expandpath ' ~$USER' ) "
26
+ }
27
+
28
+ . " $test_dir /shunit2"
Original file line number Diff line number Diff line change 72
72
export VIRTUALENVWRAPPER_PROJECT_FILENAME=" .project"
73
73
fi
74
74
75
+ function virtualenvwrapper_expandpath {
76
+ if [ " $1 " = " " ]; then
77
+ return 1
78
+ else
79
+ " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.realpath(os.path.expanduser(os.path.expandvars(\" $1 \" )))+'\n')"
80
+ return 0
81
+ fi
82
+ }
83
+
75
84
function virtualenvwrapper_derive_workon_home {
76
85
typeset workon_home_dir=" $WORKON_HOME "
77
86
@@ -99,7 +108,7 @@ function virtualenvwrapper_derive_workon_home {
99
108
# - Removing extra slashes (e.g., when TMPDIR ends in a slash)
100
109
# - Expanding variables (e.g., $foo)
101
110
# - Converting ~s to complete paths (e.g., ~/ to /home/brian/ and ~arthur to /home/arthur)
102
- workon_home_dir=$( " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.expandvars(os.path.expanduser( \" $workon_home_dir \" ))+'\n') " )
111
+ workon_home_dir=$( virtualenvwrapper_expandpath " $workon_home_dir " )
103
112
fi
104
113
105
114
echo " $workon_home_dir "
@@ -344,7 +353,8 @@ function mkvirtualenv {
344
353
packages=" $packages ${in_args[$i]} " ;;
345
354
-r)
346
355
i=$(( $i + 1 )) ;
347
- requirements=" ${in_args[$i]} " ;;
356
+ requirements=" ${in_args[$i]} " ;
357
+ requirements=$( virtualenvwrapper_expandpath " $requirements " ) ;;
348
358
* )
349
359
if [ ${# out_args} -gt 0 ]
350
360
then
You can’t perform that action at this time.
0 commit comments