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 7272 export VIRTUALENVWRAPPER_PROJECT_FILENAME=" .project"
7373fi
7474
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+
7584function virtualenvwrapper_derive_workon_home {
7685 typeset workon_home_dir=" $WORKON_HOME "
7786
@@ -99,7 +108,7 @@ function virtualenvwrapper_derive_workon_home {
99108 # - Removing extra slashes (e.g., when TMPDIR ends in a slash)
100109 # - Expanding variables (e.g., $foo)
101110 # - 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 " )
103112 fi
104113
105114 echo " $workon_home_dir "
@@ -344,7 +353,8 @@ function mkvirtualenv {
344353 packages=" $packages ${in_args[$i]} " ;;
345354 -r)
346355 i=$(( $i + 1 )) ;
347- requirements=" ${in_args[$i]} " ;;
356+ requirements=" ${in_args[$i]} " ;
357+ requirements=$( virtualenvwrapper_expandpath " $requirements " ) ;;
348358 * )
349359 if [ ${# out_args} -gt 0 ]
350360 then
You can’t perform that action at this time.
0 commit comments