Skip to content

Commit b6982e8

Browse files
authored
PYTHON-3498 Error installing virtual environment on zseries hosts (#1101)
1 parent 79c51a3 commit b6982e8

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

.evergreen/run-tests.sh

+11-18
Original file line numberDiff line numberDiff line change
@@ -72,35 +72,28 @@ fi
7272
. .evergreen/utils.sh
7373

7474
if [ -z "$PYTHON_BINARY" ]; then
75-
VIRTUALENV=$(command -v virtualenv) || true
76-
if [ -z "$VIRTUALENV" ]; then
77-
PYTHON=$(command -v python || command -v python3) || true
78-
if [ -z "$PYTHON" ]; then
79-
echo "Cannot test without python or python3 installed!"
80-
exit 1
81-
fi
82-
else
83-
$VIRTUALENV --never-download pymongotestvenv
84-
. pymongotestvenv/bin/activate
85-
PYTHON=python
86-
trap "deactivate; rm -rf pymongotestvenv" EXIT HUP
75+
PYTHON=$(command -v python || command -v python3) || true
76+
if [ -z "$PYTHON" ]; then
77+
echo "Cannot test without python or python3 installed!"
78+
exit 1
8779
fi
80+
createvirtualenv $PYTHON pymongotestvenv
81+
PYTHON=python
82+
trap "deactivate; rm -rf pymongotestvenv" EXIT HUP
83+
8884
elif [ "$COMPRESSORS" = "snappy" ]; then
89-
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download snappytest
90-
. snappytest/bin/activate
85+
createvirtualenv $PYTHON_BINARY snappytest
9186
trap "deactivate; rm -rf snappytest" EXIT HUP
9287
# 0.5.2 has issues in pypy3(.5)
9388
pip install python-snappy==0.5.1
9489
PYTHON=python
9590
elif [ "$COMPRESSORS" = "zstd" ]; then
96-
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download zstdtest
97-
. zstdtest/bin/activate
91+
createvirtualenv $PYTHON_BINARY zstdtest
9892
trap "deactivate; rm -rf zstdtest" EXIT HUP
9993
pip install zstandard
10094
PYTHON=python
10195
elif [ -n "$SETDEFAULTENCODING" ]; then
102-
$PYTHON_BINARY -m virtualenv --system-site-packages --never-download encodingtest
103-
. encodingtest/bin/activate
96+
createvirtualenv $PYTHON_BINARY encodingtest
10497
trap "deactivate; rm -rf encodingtest" EXIT HUP
10598
mkdir test-sitecustomize
10699
cat <<EOT > test-sitecustomize/sitecustomize.py

.evergreen/utils.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ createvirtualenv () {
1717
echo "Cannot test without virtualenv"
1818
exit 1
1919
fi
20-
$VIRTUALENV $VENVPATH
20+
# Workaround for bug in older versions of virtualenv.
21+
$VIRTUALENV $VENVPATH || $PYTHON -m venv $VENVPATH
2122
if [ "Windows_NT" = "$OS" ]; then
2223
. $VENVPATH/Scripts/activate
2324
else

0 commit comments

Comments
 (0)