From 430529414dec7264d11400d2c1bd8a207ee76904 Mon Sep 17 00:00:00 2001 From: pje Date: Sun, 5 May 2013 14:35:27 -0400 Subject: Add support for fallback to 'certifi' module, if installed+active. (grafted from 4a183cf275264653005072be25a644273463ba83) --HG-- branch : setuptools-0.6 extra : source : 4a183cf275264653005072be25a644273463ba83 --- setuptools/ssl_support.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'setuptools') 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 -- cgit v1.2.3