Skip to content

Commit bd479fb

Browse files
committed
use the version of python in the virtualenv instead of depending on the PATH
1 parent 77929e8 commit bd479fb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

tests/test_support.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ setUp () {
2222
}
2323

2424
test_get_python_version () {
25-
expected="$($VIRTUALENVWRAPPER_PYTHON -c 'import sys; sys.stdout.write("%s.%s\n" % sys.version_info[:2])')"
25+
expected="$($VIRTUAL_ENV/bin/python -c 'import sys; sys.stdout.write("%s.%s\n" % sys.version_info[:2])')"
2626
echo "Expecting: $expected"
2727
vers=$(virtualenvwrapper_get_python_version)
2828
echo "Got : $vers"

virtualenvwrapper.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,11 @@ function workon {
591591

592592
# Prints the Python version string for the current interpreter.
593593
function virtualenvwrapper_get_python_version {
594-
# Uses the Python from the virtualenv because we're trying to
595-
# determine the version installed there so we can build
596-
# up the path to the site-packages directory.
597-
python -V 2>&1 | cut -f2 -d' ' | cut -f-2 -d.
594+
# Uses the Python from the virtualenv rather than
595+
# VIRTUALENVWRAPPER_PYTHON because we're trying to determine the
596+
# version installed there so we can build up the path to the
597+
# site-packages directory.
598+
"$VIRTUAL_ENV/bin/python" -V 2>&1 | cut -f2 -d' ' | cut -f-2 -d.
598599
}
599600

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

0 commit comments

Comments
 (0)