Workaround for Ubuntu/Debian's brilliant decision to partially backport patches from python 2.7.9 to 2.7.8

This commit is contained in:
Kovid Goyal 2014-12-18 17:33:52 +05:30
parent 77c0113031
commit d102bc256c
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ py3 = sys.version_info[0] > 2
enc = getattr(sys.stdout, 'encoding', 'UTF-8') or 'utf-8'
calibre_version = signature = None
urllib = __import__('urllib.request' if py3 else 'urllib', fromlist=1)
has_ssl_verify = hasattr(ssl, 'PROTOCOL_TLSv1_2')
has_ssl_verify = hasattr(ssl, 'PROTOCOL_TLSv1_2') and sys.version_info[:3] > (2, 7, 8)
if py3:
unicode = str

View File

@ -6,12 +6,12 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import ssl, socket, re
import ssl, socket, re, sys
from contextlib import closing
from calibre import get_proxies
from calibre.constants import ispy3
has_ssl_verify = hasattr(ssl, 'PROTOCOL_TLSv1_2')
has_ssl_verify = hasattr(ssl, 'PROTOCOL_TLSv1_2') and sys.version_info[:3] > (2, 7, 8)
class HTTPError(ValueError):