Skip to content

Commit

Permalink
Drop support for Python 2.6 and 3.1-3.3 (#60)
Browse files Browse the repository at this point in the history
Also stop supporting Python <2.7.9
  • Loading branch information
webknjaz committed Dec 2, 2017
2 parents 02007ef + 2656bf8 commit 2fd065f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ jobs:
steps:
- checkout
- run: pip install tox
- run: tox -e py27,py33,py34,py35,py36
- run: tox -e py27,py34,py35,py36
16 changes: 0 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ sudo: false
language: python

python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5
- &pypy2 pypy2.7-5.8.0
Expand Down Expand Up @@ -88,27 +86,13 @@ jobs:
# mainstream here (3.6)
- <<: *pure_python_base_priority
python: nightly
- <<: *osx_python_base
<<: *manual_run_or_cron
python: 2.6
env:
- PYTHON_VERSION=2.6.9
- *env_pyenv
- *env_path
- <<: *osx_python_base
<<: *manual_run_or_cron
python: 2.7
env:
- PYTHON_VERSION=2.7.13
- *env_pyenv
- *env_path
- <<: *osx_python_base
<<: *manual_run_or_cron
python: 3.3
env:
- PYTHON_VERSION=3.3.6
- *env_pyenv
- *env_path
- <<: *osx_python_base
<<: *manual_run_or_cron
python: 3.4
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v6.0.0
======

- Drop support for Python 2.6, 3.1, 3.2, and 3.3.
- Also drop built-in SSL support for Python 2.7 earlier
than 2.7.9.

v5.10.0
======

Expand Down
7 changes: 1 addition & 6 deletions cheroot/makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

import socket

try:
# prefer slower Python-based io module
import _pyio as io
except ImportError:
# Python 2.6
import io
import _pyio as io

import six

Expand Down
32 changes: 11 additions & 21 deletions cheroot/ssl/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class BuiltinSSLAdapter(Adapter):
"""The filename of the certificate chain file."""

context = None
"""The ssl.SSLContext that will be used to wrap sockets where available
(on Python > 2.7.9 / 3.3)
"""
"""The ssl.SSLContext that will be used to wrap sockets."""

ciphers = None
"""The ciphers list of SSL."""
Expand All @@ -55,14 +53,13 @@ def __init__(
super(BuiltinSSLAdapter, self).__init__(
certificate, private_key, certificate_chain, ciphers)

if hasattr(ssl, 'create_default_context'):
self.context = ssl.create_default_context(
purpose=ssl.Purpose.CLIENT_AUTH,
cafile=certificate_chain
)
self.context.load_cert_chain(certificate, private_key)
if self.ciphers is not None:
self.context.set_ciphers(ciphers)
self.context = ssl.create_default_context(
purpose=ssl.Purpose.CLIENT_AUTH,
cafile=certificate_chain
)
self.context.load_cert_chain(certificate, private_key)
if self.ciphers is not None:
self.context.set_ciphers(ciphers)

def bind(self, sock):
"""Wrap and return the given socket."""
Expand All @@ -71,16 +68,9 @@ def bind(self, sock):
def wrap(self, sock):
"""Wrap and return the given socket, plus WSGI environ entries."""
try:
if self.context is not None:
s = self.context.wrap_socket(
sock, do_handshake_on_connect=True, server_side=True)
else:
s = ssl.wrap_socket(sock, do_handshake_on_connect=True,
server_side=True,
certfile=self.certificate,
keyfile=self.private_key,
ssl_version=ssl.PROTOCOL_SSLv23,
ca_certs=self.certificate_chain)
s = self.context.wrap_socket(
sock, do_handshake_on_connect=True, server_side=True,
)
except ssl.SSLError as ex:
if ex.errno == ssl.SSL_ERROR_EOF:
# This is almost certainly due to the cherrypy engine
Expand Down
21 changes: 2 additions & 19 deletions cheroot/test/webtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from six.moves import range, http_client, map, urllib_parse
import six

from more_itertools.more import always_iterable


def interface(host):
"""Return an IP address for a client connection given the server host.
Expand Down Expand Up @@ -647,22 +649,3 @@ def server_error(exc=None):
print('')
print(''.join(traceback.format_exception(*exc)))
return True


def always_iterable(obj, base_type=(six.text_type, six.binary_type)):
"""
Copy of always_iterable from more_itertools.more.
Replace with dependency when Python 2.6 compatibility is
no longer required.
"""
if obj is None:
return iter(())

if (base_type is not None) and isinstance(obj, base_type):
return iter((obj,))

try:
return iter(obj)
except TypeError:
return iter((obj,))
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
name.split('.')[:-1] if nspkg_technique == 'managed'
else []
),
python_requires='>=2.6,!=3.0.*',
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
install_requires=[
'six>=1.11.0',
'more_itertools>=2.6',
],
extras_require={
'docs': [
Expand Down Expand Up @@ -72,12 +73,8 @@
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down

0 comments on commit 2fd065f

Please sign in to comment.