aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/ssl_support.py
diff options
context:
space:
mode:
authorpje <none@none>2013-05-05 14:35:27 -0400
committerpje <none@none>2013-05-05 14:35:27 -0400
commit430529414dec7264d11400d2c1bd8a207ee76904 (patch)
treecf1d2740b2e1de1e67d35ae4c64cedc75fabd7ec /setuptools/ssl_support.py
parentd6faaf34a953d9c30c9c64c4038470881958ddc1 (diff)
downloadexternal_python_setuptools-430529414dec7264d11400d2c1bd8a207ee76904.tar.gz
external_python_setuptools-430529414dec7264d11400d2c1bd8a207ee76904.tar.bz2
external_python_setuptools-430529414dec7264d11400d2c1bd8a207ee76904.zip
Add support for fallback to 'certifi' module, if installed+active.
(grafted from 4a183cf275264653005072be25a644273463ba83) --HG-- branch : setuptools-0.6 extra : source : 4a183cf275264653005072be25a644273463ba83
Diffstat (limited to 'setuptools/ssl_support.py')
-rw-r--r--setuptools/ssl_support.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py
index fe9d5df2..f1d8c920 100644
--- a/setuptools/ssl_support.py
+++ b/setuptools/ssl_support.py
@@ -1,4 +1,5 @@
import sys, os, socket, urllib2, atexit, re
+from pkg_resources import ResolutionError, ExtractionError
try:
import ssl
@@ -38,7 +39,6 @@ is_available = ssl is not None and object not in (HTTPSHandler, HTTPSConnection)
-
try:
from socket import create_connection
except ImportError:
@@ -225,7 +225,8 @@ def get_win_certfile():
_wincerts = MyCertFile(stores=['CA', 'ROOT'])
return _wincerts.name
-
+
+
def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
if os.name=='nt':
@@ -234,11 +235,10 @@ def find_ca_bundle():
for cert_path in cert_paths:
if os.path.isfile(cert_path):
return cert_path
-
-
-
-
-
+ try:
+ return pkg_resources.resource_filename('certifi', 'cacert.pem')
+ except (ImportError, ResolutionError, ExtractionError):
+ return None