Commit 43052941 authored by pje's avatar pje

Add support for fallback to 'certifi' module, if installed+active.

(grafted from 4a183cf275264653005072be25a644273463ba83)

--HG--
branch : setuptools-0.6
extra : source : 4a183cf275264653005072be25a644273463ba83
parent d6faaf34
......@@ -95,8 +95,10 @@ setup(
"ssl:sys_platform=='win32'": "wincertstore==0.1",
"ssl:sys_platform=='win32' and python_version in '2.3, 2.4'": "ctypes==1.0.2",
"ssl:python_version in '2.3, 2.4, 2.5'":"ssl==1.16",
"certs": "certifi==0.0.8",
},
dependency_links = [
'http://pypi.python.org/packages/source/c/certifi/certifi-0.0.8.tar.gz#md5=dc5f5e7f0b5fc08d27654b17daa6ecec',
'http://pypi.python.org/packages/source/s/ssl/ssl-1.16.tar.gz#md5=fb12d335d56f3c8c7c1fefc1c06c4bfb',
'http://pypi.python.org/packages/source/w/wincertstore/wincertstore-0.1.zip#md5=2f9accbebe8f7b4c06ac7aa83879b81c',
'http://sourceforge.net/projects/ctypes/files/ctypes/1.0.2/ctypes-1.0.2.win32-py2.3.exe/download#md5=9afe4b75240a8808a24df7a76b6081e3',
......@@ -119,5 +121,3 @@ setup(
http://pypi.python.org/packages/source/c/certifi/certifi-0.0.8.tar.gz#md5=dc5f5e7f0b5fc08d27654b17daa6ecec
http://pypi.python.org/packages/source/s/ssl/ssl-1.16.tar.gz#md5=fb12d335d56f3c8c7c1fefc1c06c4bfb
http://pypi.python.org/packages/source/w/wincertstore/wincertstore-0.1.zip#md5=2f9accbebe8f7b4c06ac7aa83879b81c
http://sourceforge.net/projects/ctypes/files/ctypes/1.0.2/ctypes-1.0.2.win32-py2.3.exe/download#md5=9afe4b75240a8808a24df7a76b6081e3
......
......@@ -3,6 +3,9 @@
[ssl:sys_platform=='win32']
wincertstore==0.1
[certs]
certifi==0.0.8
[ssl:sys_platform=='win32' and python_version in '2.3, 2.4']
ctypes==1.0.2
......
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment