Skip to content

Commit 18fbcaa

Browse files
authored
Merge pull request scikit-build#85 from scikit-build/update-travis-python3-version
Fix SSL import when using pip or twine on Travis
2 parents 38f13e6 + 3728b21 commit 18fbcaa

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ matrix:
1111
- os: osx
1212
language: generic
1313
env:
14-
- PYTHON_VERSION=3.7.2
14+
- PYTHON_VERSION=3.7.4
1515

1616
- os: osx
1717
language: generic
@@ -20,12 +20,13 @@ matrix:
2020

2121
cache:
2222
directories:
23-
- $HOME/.pyenv/versions/3.7.2
23+
- $HOME/.pyenv/versions/3.7.4
2424
- $HOME/.pyenv/versions/2.7.15
2525
- $HOME/downloads
2626

2727
before_install:
2828
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python; fi
29+
- python scripts/ssl-check.py
2930
- python -m pip install --disable-pip-version-check --upgrade pip
3031
- pip install -U scikit-ci scikit-ci-addons
3132
- ci_addons --install ../addons

scikit-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ before_install:
2020
SETUP_BDIST_WHEEL_ARGS: --plat-name macosx-10.6-x86_64
2121
commands:
2222
- python ../addons/travis/install_pyenv.py
23+
- python scripts/ssl-check.py
2324
- python ../addons/travis/install_cmake.py 3.12.0
2425

2526
install:

scripts/ssl-check.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# cf. https://github.com/pypa/manylinux/issues/53
2+
3+
import sys
4+
5+
GOOD_SSL = "https://google.com"
6+
BAD_SSL = "https://self-signed.badssl.com"
7+
8+
print("Testing SSL certificate checking for Python:", sys.version)
9+
10+
if (sys.version_info[:2] < (3, 4)):
11+
print("This version never checks SSL certs; skipping tests")
12+
sys.exit(0)
13+
14+
if sys.version_info[0] >= 3:
15+
from urllib.request import urlopen
16+
EXC = OSError
17+
else:
18+
from urllib import urlopen
19+
EXC = IOError
20+
21+
print("Connecting to %s should work" % (GOOD_SSL,))
22+
urlopen(GOOD_SSL)
23+
print("...it did, yay.")
24+
25+
print("Connecting to %s should fail" % (BAD_SSL,))
26+
try:
27+
urlopen(BAD_SSL)
28+
# If we get here then we failed:
29+
print("...it DIDN'T!!!!!11!!1one!")
30+
sys.exit(1)
31+
except EXC:
32+
print("...it did, yay.")

0 commit comments

Comments
 (0)