Commits

Doug Hellmann  committed 6bb2505

fixes issue #73 by changing virtualenvwrapper_get_python_version to only include the major and minor numbers

  • Participants
  • Parent commits eb58e93

Comments (0)

Files changed (5)

+2010-12-27  Doug Hellmann  <dhellmann@racemi.com>
+
+	* virtualenvwrapper.sh (virtualenvwrapper_get_python_version):
+	Only include the major and minor numbers, not the patch level.
+
 2010-12-26  Doug Hellmann  <dhellmann@racemi.com>
 
 	* virtualenvwrapper/user_scripts.py (make_hook): Do not specify

File docs/en/history.rst

 Release History
 ===============
 
+2.6.1
+
+  - Fixed virtualenvwrapper_get_python_version (:bbissue:`73`).
+
 2.6
 
   - Fixed a problem with hook script line endings under Cygwin

File tests/test_ls.sh

     rm -f "$test_dir/catch_output"
 }
 
+test_get_site_packages_dir () {
+    mkvirtualenv "lssitepackagestest"
+    d=$(virtualenvwrapper_get_site_packages_dir)
+    echo "site-packages in $d"
+    assertTrue "site-packages dir $d does not exist" "[ -d $d ]"
+    deactivate
+}
+
 test_lssitepackages () {
     mkvirtualenv "lssitepackagestest"
     contents="$(lssitepackages)"    
-    assertTrue "No easy-install.pth in $contents" "echo $contents | grep easy-install.pth"
+    actual=$(echo $contents | grep easy-install.pth)
+    expected=$(echo $contents)
+    assertSame "$expected" "$actual"
+    deactivate
 }
 
 test_lssitepackages_add2virtualenv () {
     base_dir=$(basename $(pwd))
     add2virtualenv "../$base_dir"
     contents="$(lssitepackages)"    
-    assertTrue "No $base_dir in $contents" "echo $contents | grep $base_dir"
+    actual=$(echo $contents | grep $base_dir)
+    expected=$(echo $contents)
+    assertSame "$expected" "$actual"
+    deactivate
 }
 
 test_no_workon_home () {
     WORKON_HOME="$old_home"
 }
 
-test_get_site_packages_dir () {
-    d=$(virtualenvwrapper_get_site_packages_dir)
-    assertTrue "[ -d $d ]"
-}
-
 
 . "$test_dir/shunit2"

File tests/test_support.sh

     rm -rf "$WORKON_HOME"
     mkdir -p "$WORKON_HOME"
     source "$test_dir/../virtualenvwrapper.sh"
-    mkvirtualenv testing
 }
 
 oneTimeTearDown() {
 }
 
 test_get_python_version () {
-    expected="$($VIRTUAL_ENV/bin/python -V 2>&1 | cut -f2 -d' ')"
+    expected="$(python -c 'import sys; print ".".join([str(p) for p in sys.version_info[:2]])')"
     echo "Expecting: $expected"
     vers=$(virtualenvwrapper_get_python_version)
     echo "Got      : $vers"

File virtualenvwrapper.sh

     # Uses the Python from the virtualenv because we're trying to
     # determine the version installed there so we can build
     # up the path to the site-packages directory.
-    python -V 2>&1 | cut -f2 -d' '
+    python -V 2>&1 | cut -f2 -d' ' | cut -f-2 -d.
 }
 
 # Prints the path to the site-packages directory for the current environment.