Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bfc723c

Browse filesBrowse files
jklymakmeeseeksmachine
authored andcommitted
Backport PR #18225: Use certifi when downloading bundled build requirements.
1 parent c0addc9 commit bfc723c
Copy full SHA for bfc723c

File tree

Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def build_extensions(self):
275275

276276
python_requires='>={}'.format('.'.join(str(n) for n in min_version)),
277277
setup_requires=[
278+
"certifi>=2020.06.20",
278279
"numpy>=1.15",
279280
],
280281
install_requires=[

‎setupext.py

Copy file name to clipboardExpand all lines: setupext.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ def _get_hash(data):
4242
return hasher.hexdigest()
4343

4444

45+
@functools.lru_cache()
46+
def _get_ssl_context():
47+
import certifi
48+
import ssl
49+
return ssl.create_default_context(cafile=certifi.where())
50+
51+
4552
def download_or_cache(url, sha):
4653
"""
4754
Get bytes from the given url or local cache.
@@ -73,7 +80,8 @@ def download_or_cache(url, sha):
7380
# default User-Agent, but not (for example) wget; so I don't feel too
7481
# bad passing in an empty User-Agent.
7582
with urllib.request.urlopen(
76-
urllib.request.Request(url, headers={"User-Agent": ""})) as req:
83+
urllib.request.Request(url, headers={"User-Agent": ""}),
84+
context=_get_ssl_context()) as req:
7785
data = req.read()
7886

7987
file_sha = _get_hash(data)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.