Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
827c4c36
Commit
827c4c36
authored
Jan 16, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor find_ca_bundle to simplify branching logic.
parent
f64c8f72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
setuptools/ssl_support.py
setuptools/ssl_support.py
+12
-17
No files found.
setuptools/ssl_support.py
View file @
827c4c36
...
...
@@ -3,7 +3,7 @@ import socket
import
atexit
import
re
from
setuptools.extern.six.moves
import
urllib
,
http_client
,
map
from
setuptools.extern.six.moves
import
urllib
,
http_client
,
map
,
filter
import
pkg_resources
from
pkg_resources
import
ResolutionError
,
ExtractionError
...
...
@@ -237,21 +237,16 @@ def get_win_certfile():
def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
ca_bundle_path = None
extant_cert_paths = filter(os.path.isfile, cert_paths)
return (
get_win_certfile()
or next(extant_cert_paths, None)
or _certifi_where()
)
if os.name == '
nt
':
ca_bundle_path = get_win_certfile()
else:
for cert_path in cert_paths:
if os.path.isfile(cert_path):
ca_bundle_path = cert_path
break
if ca_bundle_path is None:
try:
import certifi
ca_bundle_path = certifi.where()
except (ImportError, ResolutionError, ExtractionError):
pass
return ca_bundle_path
def _certifi_where():
try:
return __import__('
certifi
').where()
except (ImportError, ResolutionError, ExtractionError):
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment