Skip to content

Commit

Permalink
fix for ticket #14: relative paths don't work with add2virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
dhellmann committed Jul 28, 2009
1 parent 945bd4b commit 552b77f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docsource/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============

1.19

- Fix problem with add2virtualenv and relative paths. Thanks to Doug Latornell for the bug report James Bennett for the suggested fix.

1.18.1

- Incorporate patch from Sascha Brossmann to fix a issue #15. Directory normalization was causing ``WORKON_HOME`` to appear to be a missing directory if there were control characters in the output of ``pwd``.
Expand Down
2 changes: 1 addition & 1 deletion pavement.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# What project are we building?
PROJECT = 'virtualenvwrapper'
VERSION = '1.18.1'
VERSION = '1.19'
os.environ['VERSION'] = VERSION

# Read the long description to give to setup
Expand Down
20 changes: 20 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,24 @@ test_missing_workon_home () {
WORKON_HOME="$save_home"
}

test_add2virtualenv () {
mkvirtualenv "pathtest"
add2virtualenv "/full/path"
cdsitepackages
path_file="./virtualenv_path_extensions.pth"
assertTrue "No /full/path in `cat $path_file`" "grep /full/path $path_file"
cd -
}

test_add2virtualenv_relative () {
mkvirtualenv "pathtest"
parent_dir=$(dirname $(pwd))
base_dir=$(basename $(pwd))
add2virtualenv "../$base_dir"
cdsitepackages
path_file="./virtualenv_path_extensions.pth"
assertTrue "No $parent_dir/$base_dir in \"`cat $path_file`\"" "grep \"$parent_dir/$base_dir\" $path_file"
cd - >/dev/null 2>&1
}

. "$test_dir/shunit2"
7 changes: 6 additions & 1 deletion virtualenvwrapper_bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ function add2virtualenv () {
touch "$path_file"
for pydir in "$@"
do
echo "$pydir" >> "$path_file"
absolute_path=$(python -c "import os; print os.path.abspath(\"$pydir\")")
if [ "$absolute_path" != "$pydir" ]
then
echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2
fi
echo "$absolute_path" >> "$path_file"
done
return 0
}
Expand Down

0 comments on commit 552b77f

Please sign in to comment.