Skip to content

Commit 2157dc5

Browse files
committed
PYTHON-2148 Test PyOpenSSL support on Windows
1 parent e485c07 commit 2157dc5

File tree

3 files changed

+75
-12
lines changed

3 files changed

+75
-12
lines changed

.evergreen/config.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,12 @@ axes:
12881288
batchtime: 10080 # 7 days
12891289
variables:
12901290
libmongocrypt_url: https://s3.amazonaws.com/mciuploads/libmongocrypt/windows-test/master/latest/libmongocrypt.tar.gz
1291+
- id: windows-64-vsMulti-small
1292+
display_name: "Windows 64"
1293+
run_on: windows-64-vsMulti-small
1294+
batchtime: 10080 # 7 days
1295+
variables:
1296+
libmongocrypt_url: https://s3.amazonaws.com/mciuploads/libmongocrypt/windows-test/master/latest/libmongocrypt.tar.gz
12911297

12921298
# Test with authentication?
12931299
- id: auth
@@ -1399,23 +1405,27 @@ axes:
13991405
- id: "win-vs2010-3.4"
14001406
display_name: "Python 3.4"
14011407
variables:
1402-
PYTHON_BINARY: "/cygdrive/c/python/Python34/python.exe"
1408+
PYTHON_BINARY: "C:/python/Python34/python.exe"
14031409
- id: "win-vs2015-2.7"
14041410
display_name: "Python 2.7"
14051411
variables:
1406-
PYTHON_BINARY: "/cygdrive/c/python/Python27/python.exe"
1412+
PYTHON_BINARY: "C:/python/Python27/python.exe"
14071413
- id: "win-vs2015-3.5"
14081414
display_name: "Python 3.5"
14091415
variables:
1410-
PYTHON_BINARY: "/cygdrive/c/python/Python35/python.exe"
1416+
PYTHON_BINARY: "C:/python/Python35/python.exe"
14111417
- id: "win-vs2015-3.6"
14121418
display_name: "Python 3.6"
14131419
variables:
1414-
PYTHON_BINARY: "/cygdrive/c/python/Python36/python.exe"
1420+
PYTHON_BINARY: "C:/python/Python36/python.exe"
14151421
- id: "win-vs2015-3.7"
14161422
display_name: "Python 3.7"
14171423
variables:
1418-
PYTHON_BINARY: "/cygdrive/c/python/Python37/python.exe"
1424+
PYTHON_BINARY: "C:/python/Python37/python.exe"
1425+
- id: "win-vs2015-3.8"
1426+
display_name: "Python 3.8"
1427+
variables:
1428+
PYTHON_BINARY: "C:/python/Python38/python.exe"
14191429

14201430
# Choice of mod_wsgi version
14211431
- id: mod-wsgi-version
@@ -1729,7 +1739,7 @@ buildvariants:
17291739
python-version: ["2.7", "3.4", "3.5", "3.6", "3.7", "pypy", "pypy3.5"]
17301740
auth: "*"
17311741
ssl: "ssl"
1732-
display_name: "PyOpenSSL ${python-version} ${platform} ${auth}"
1742+
display_name: "PyOpenSSL ${platform} ${python-version} ${auth}"
17331743
tasks:
17341744
- "pyopenssl"
17351745

@@ -1740,7 +1750,7 @@ buildvariants:
17401750
- rhel70 # CPython 2.7.5
17411751
auth: "*"
17421752
ssl: "ssl"
1743-
display_name: "PyOpenSSL Pre-2.7.9 Python ${platform} ${auth}"
1753+
display_name: "PyOpenSSL ${platform} Pre-2.7.9 Python ${auth}"
17441754
tasks:
17451755
- "pyopenssl"
17461756

@@ -1753,6 +1763,16 @@ buildvariants:
17531763
tasks:
17541764
- "pyopenssl"
17551765

1766+
- matrix_name: "tests-pyopenssl-windows"
1767+
matrix_spec:
1768+
platform: windows-64-vsMulti-small
1769+
python-version: ["win-vs2015-2.7", "win-vs2010-3.4", "win-vs2015-3.5", "win-vs2015-3.6", "win-vs2015-3.7", "win-vs2015-3.8"]
1770+
auth: "*"
1771+
ssl: "ssl"
1772+
display_name: "PyOpenSSL ${platform} ${python-version} ${auth}"
1773+
tasks:
1774+
- "pyopenssl"
1775+
17561776
- matrix_name: "tests-python-version-rhel62-test-encryption"
17571777
matrix_spec:
17581778
platform: rhel62

.evergreen/run-ocsp-tests.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,42 @@ set -o errexit
55

66
if [ -z "$PYTHON_BINARY" ]; then
77
echo "No python binary specified"
8-
PYTHON_BINARY=$(command -v python || command -v python3) || true
8+
PYTHON=$(command -v python || command -v python3) || true
99
if [ -z "$PYTHON_BINARY" ]; then
1010
echo "Cannot test without python or python3 installed!"
1111
exit 1
1212
fi
13+
else
14+
PYTHON="$PYTHON_BINARY"
1315
fi
1416

15-
$PYTHON_BINARY -m virtualenv --never-download --no-wheel ocsptest
16-
. ocsptest/bin/activate
17+
if $PYTHON -m virtualenv --version; then
18+
VIRTUALENV="$PYTHON -m virtualenv"
19+
elif command -v virtualenv; then
20+
# We can remove this fallback after:
21+
# https://github.com/10gen/mongo-python-toolchain/issues/8
22+
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
23+
else
24+
echo "Cannot test without virtualenv"
25+
exit 1
26+
fi
27+
28+
$VIRTUALENV --never-download --no-wheel ocsptest
29+
if [ "Windows_NT" = "$OS" ]; then
30+
. ocsptest/Scripts/activate
31+
else
32+
. ocsptest/bin/activate
33+
fi
1734
trap "deactivate; rm -rf ocsptest" EXIT HUP
1835

1936
IS_PYTHON_2=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (3,) else '0')")
2037
if [ $IS_PYTHON_2 = "1" ]; then
2138
echo "Using a Python 2"
39+
# Upgrade pip to install the cryptography wheel and not the tar.
40+
# <20.1 because 20.0.2 says a future release may drop support for 2.7.
41+
pip install --upgrade 'pip<20.1'
42+
# Upgrade setuptools because cryptography requires 18.5+.
43+
# <45 because 45.0 dropped support for 2.7.
2244
pip install --upgrade 'setuptools<45'
2345
fi
2446

.evergreen/run-pyopenssl-tests.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export CLIENT_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
99
export CA_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
1010

1111
if [ -z "$PYTHON_BINARY" ]; then
12+
echo "No python binary specified"
1213
PYTHON=$(command -v python || command -v python3) || true
1314
if [ -z "$PYTHON" ]; then
1415
echo "Cannot test without python or python3 installed!"
@@ -18,13 +19,33 @@ else
1819
PYTHON="$PYTHON_BINARY"
1920
fi
2021

21-
$PYTHON -m virtualenv pyopenssltest
22-
. pyopenssltest/bin/activate
22+
if $PYTHON -m virtualenv --version; then
23+
VIRTUALENV="$PYTHON -m virtualenv"
24+
elif command -v virtualenv; then
25+
# We can remove this fallback after:
26+
# https://github.com/10gen/mongo-python-toolchain/issues/8
27+
VIRTUALENV="$(command -v virtualenv) -p $PYTHON"
28+
else
29+
echo "Cannot test without virtualenv"
30+
exit 1
31+
fi
32+
33+
$VIRTUALENV pyopenssltest
34+
if [ "Windows_NT" = "$OS" ]; then
35+
. pyopenssltest/Scripts/activate
36+
else
37+
. pyopenssltest/bin/activate
38+
fi
2339
trap "deactivate; rm -rf pyopenssltest" EXIT HUP
2440

2541
IS_PYTHON_2=$(python -c "import sys; sys.stdout.write('1' if sys.version_info < (3,) else '0')")
2642
if [ $IS_PYTHON_2 = "1" ]; then
2743
echo "Using a Python 2"
44+
# Upgrade pip to install the cryptography wheel and not the tar.
45+
# <20.1 because 20.0.2 says a future release may drop support for 2.7.
46+
pip install --upgrade 'pip<20.1'
47+
# Upgrade setuptools because cryptography requires 18.5+.
48+
# <45 because 45.0 dropped support for 2.7.
2849
pip install --upgrade 'setuptools<45'
2950
fi
3051

0 commit comments

Comments
 (0)