Skip to content

Commit 4a90bde

Browse files
committed
fixes issue #73 by changing virtualenvwrapper_get_python_version to only include the major and minor numbers
1 parent 9fe5296 commit 4a90bde

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2010-12-27 Doug Hellmann <[email protected]>
2+
3+
* virtualenvwrapper.sh (virtualenvwrapper_get_python_version):
4+
Only include the major and minor numbers, not the patch level.
5+
16
2010-12-26 Doug Hellmann <[email protected]>
27

38
* virtualenvwrapper/user_scripts.py (make_hook): Do not specify

docs/en/history.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Release History
33
===============
44

5+
2.6.1
6+
7+
- Fixed virtualenvwrapper_get_python_version (:bbissue:`73`).
8+
59
2.6
610

711
- Fixed a problem with hook script line endings under Cygwin

tests/test_ls.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,21 @@ setUp () {
2121
rm -f "$test_dir/catch_output"
2222
}
2323

24+
test_get_site_packages_dir () {
25+
mkvirtualenv "lssitepackagestest"
26+
d=$(virtualenvwrapper_get_site_packages_dir)
27+
echo "site-packages in $d"
28+
assertTrue "site-packages dir $d does not exist" "[ -d $d ]"
29+
deactivate
30+
}
31+
2432
test_lssitepackages () {
2533
mkvirtualenv "lssitepackagestest"
2634
contents="$(lssitepackages)"
27-
assertTrue "No easy-install.pth in $contents" "echo $contents | grep easy-install.pth"
35+
actual=$(echo $contents | grep easy-install.pth)
36+
expected=$(echo $contents)
37+
assertSame "$expected" "$actual"
38+
deactivate
2839
}
2940

3041
test_lssitepackages_add2virtualenv () {
@@ -33,7 +44,10 @@ test_lssitepackages_add2virtualenv () {
3344
base_dir=$(basename $(pwd))
3445
add2virtualenv "../$base_dir"
3546
contents="$(lssitepackages)"
36-
assertTrue "No $base_dir in $contents" "echo $contents | grep $base_dir"
47+
actual=$(echo $contents | grep $base_dir)
48+
expected=$(echo $contents)
49+
assertSame "$expected" "$actual"
50+
deactivate
3751
}
3852

3953
test_no_workon_home () {
@@ -44,10 +58,5 @@ test_no_workon_home () {
4458
WORKON_HOME="$old_home"
4559
}
4660

47-
test_get_site_packages_dir () {
48-
d=$(virtualenvwrapper_get_site_packages_dir)
49-
assertTrue "[ -d $d ]"
50-
}
51-
5261

5362
. "$test_dir/shunit2"

tests/test_support.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"
1111
mkdir -p "$WORKON_HOME"
1212
source "$test_dir/../virtualenvwrapper.sh"
13-
mkvirtualenv testing
1413
}
1514

1615
oneTimeTearDown() {
@@ -23,7 +22,7 @@ setUp () {
2322
}
2423

2524
test_get_python_version () {
26-
expected="$($VIRTUAL_ENV/bin/python -V 2>&1 | cut -f2 -d' ')"
25+
expected="$(python -c 'import sys; print ".".join([str(p) for p in sys.version_info[:2]])')"
2726
echo "Expecting: $expected"
2827
vers=$(virtualenvwrapper_get_python_version)
2928
echo "Got : $vers"

virtualenvwrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ virtualenvwrapper_get_python_version () {
407407
# Uses the Python from the virtualenv because we're trying to
408408
# determine the version installed there so we can build
409409
# up the path to the site-packages directory.
410-
python -V 2>&1 | cut -f2 -d' '
410+
python -V 2>&1 | cut -f2 -d' ' | cut -f-2 -d.
411411
}
412412

413413
# Prints the path to the site-packages directory for the current environment.

0 commit comments

Comments
 (0)