From 1ae7cb68cd285fe822c84d8e3198aff9716cf4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Wed, 21 Mar 2018 14:49:42 +0100 Subject: Raise minimum cryptography version to 2.2.1, drop python 2.6 (#742) --- .travis.yml | 9 +-------- CHANGELOG.rst | 3 ++- doc/introduction.rst | 2 +- setup.cfg | 5 ----- setup.py | 7 ++----- src/OpenSSL/SSL.py | 18 ++++-------------- tests/test_ssl.py | 12 +----------- tox.ini | 4 ++-- 8 files changed, 13 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9dc734c..6a5f3f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,9 +20,7 @@ matrix: os: osx osx_image: xcode8.3 env: TOXENV=py27 OPENSSL=1.1.0 - - python: "2.6" # these are just to make travis's UI a bit prettier - env: TOXENV=py26 - - python: "2.7" + - python: "2.7" # these are just to make travis's UI a bit prettier env: TOXENV=py27 - python: "3.4" env: TOXENV=py34 @@ -33,8 +31,6 @@ matrix: - env: TOXENV=pypy # Also run the tests against cryptography master. - - python: "2.6" - env: TOXENV=py26-cryptographyMaster - python: "2.7" env: TOXENV=py27-cryptographyMaster - python: "3.4" @@ -46,8 +42,6 @@ matrix: - env: TOXENV=pypy-cryptographyMaster # And current minimum cryptography version. - - python: "2.6" - env: TOXENV=py26-cryptographyMinimum - python: "2.7" env: TOXENV=py27-cryptographyMinimum - python: "3.4" @@ -82,7 +76,6 @@ matrix: # Let the cryptography master builds fail because they might be caused by # cryptography changes that are beyond our control. allow_failures: - - env: TOXENV=py26-cryptographyMaster - env: TOXENV=py27-cryptographyMaster - env: TOXENV=py34-cryptographyMaster - env: TOXENV=py35-cryptographyMaster diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2447414..080b30e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,7 +11,8 @@ The third digit is only for regressions. Backward-incompatible changes: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -*none* +* The minimum ``cryptography`` version is now 2.2.1. +* Support for Python 2.6 has been dropped. Deprecations: diff --git a/doc/introduction.rst b/doc/introduction.rst index beededf..a810fbb 100644 --- a/doc/introduction.rst +++ b/doc/introduction.rst @@ -14,7 +14,7 @@ Other OpenSSL wrappers for Python at the time were also limited, though in diffe Later it was maintained by `Jean-Paul Calderone`_ who among other things managed to make pyOpenSSL a pure Python project which the current maintainers are *very* grateful for. Over the time the standard library's ``ssl`` module improved, never reaching the completeness of pyOpenSSL's API coverage. -Despite `PEP 466`_ many useful features remain Python 3-only and pyOpenSSL remains the only alternative for full-featured TLS code across all noteworthy Python versions from 2.6 through 3.5 and PyPy_. +Despite `PEP 466`_ many useful features remain Python 3-only and pyOpenSSL remains the only alternative for full-featured TLS code across all noteworthy Python versions from 2.7 through 3.5 and PyPy_. Development diff --git a/setup.cfg b/setup.cfg index c22cb95..138d91c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,11 +3,6 @@ minversion = 3.0.1 strict = true testpaths = tests -[sdist] -# Forcibly regenerate the manifest on Python 2.6. This is default behavior on -# 2.7+ making this option deprecated. This should be removed once we drop 2.6. -force_manifest = 1 - [bdist_wheel] # We are a pure-Python project so a single wheel is enough. universal = 1 diff --git a/setup.py b/setup.py index 85252e9..5e80f0c 100755 --- a/setup.py +++ b/setup.py @@ -77,7 +77,6 @@ if __name__ == "__main__": 'Operating System :: POSIX', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', @@ -95,16 +94,14 @@ if __name__ == "__main__": package_dir={"": "src"}, install_requires=[ # Fix cryptographyMinimum in tox.ini when changing this! - "cryptography>=2.1.4", + "cryptography>=2.2.1", "six>=1.5.2" ], extras_require={ "test": [ "flaky", "pretend", - # pytest 3.3 doesn't support Python 2.6 anymore. - # Remove this pin once we drop Python 2.6 too. - "pytest>=3.0.1,<3.3.0", + "pytest>=3.0.1", ], "docs": [ "sphinx", diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py index b5dd442..f3c9db0 100644 --- a/src/OpenSSL/SSL.py +++ b/src/OpenSSL/SSL.py @@ -112,12 +112,6 @@ __all__ = [ 'Connection' ] -try: - _memoryview = memoryview -except NameError: - class _memoryview(object): - pass - try: _buffer = buffer except NameError: @@ -1702,7 +1696,7 @@ class Connection(object): # Backward compatibility buf = _text_to_bytes_and_warn("buf", buf) - if isinstance(buf, _memoryview): + if isinstance(buf, memoryview): buf = buf.tobytes() if isinstance(buf, _buffer): buf = str(buf) @@ -1729,7 +1723,7 @@ class Connection(object): """ buf = _text_to_bytes_and_warn("buf", buf) - if isinstance(buf, _memoryview): + if isinstance(buf, memoryview): buf = buf.tobytes() if isinstance(buf, _buffer): buf = str(buf) @@ -1802,12 +1796,8 @@ class Connection(object): # This strange line is all to avoid a memory copy. The buffer protocol # should allow us to assign a CFFI buffer to the LHS of this line, but # on CPython 3.3+ that segfaults. As a workaround, we can temporarily - # wrap it in a memoryview, except on Python 2.6 which doesn't have a - # memoryview type. - try: - buffer[:result] = memoryview(_ffi.buffer(buf, result)) - except NameError: - buffer[:result] = _ffi.buffer(buf, result) + # wrap it in a memoryview. + buffer[:result] = memoryview(_ffi.buffer(buf, result)) return result diff --git a/tests/test_ssl.py b/tests/test_ssl.py index 03dd935..1d6bb9f 100644 --- a/tests/test_ssl.py +++ b/tests/test_ssl.py @@ -11,7 +11,7 @@ import uuid from gc import collect, get_referrers from errno import ECONNREFUSED, EINPROGRESS, EWOULDBLOCK, EPIPE, ESHUTDOWN -from sys import platform, getfilesystemencoding, version_info +from sys import platform, getfilesystemencoding from socket import MSG_PEEK, SHUT_RDWR, error, socket from os import makedirs from os.path import join @@ -99,10 +99,6 @@ V7H54LmltOT/hEh6QWsJqb6BQgH65bswvV/XkYGja8/T0GzvbaVzAgEC skip_if_py3 = pytest.mark.skipif(PY3, reason="Python 2 only") -skip_if_py26 = pytest.mark.skipif( - version_info[0:2] == (2, 6), - reason="Python 2.7 and later only" -) def join_bytes_or_unicode(prefix, suffix): @@ -2867,7 +2863,6 @@ class TestConnectionSend(object): assert count == 2 assert client.recv(2) == b'xy' - @skip_if_py26 def test_short_memoryview(self): """ When passed a memoryview onto a small number of bytes, @@ -3004,7 +2999,6 @@ class TestConnectionRecvInto(object): assert client.recv_into(output_buffer, flags=MSG_PEEK) == 2 assert output_buffer == bytearray(b'xy\x00\x00\x00') - @skip_if_py26 def test_memoryview_no_length(self): """ `Connection.recv_into` can be passed a `memoryview` instance and data @@ -3012,7 +3006,6 @@ class TestConnectionRecvInto(object): """ self._no_length_test(_make_memoryview) - @skip_if_py26 def test_memoryview_respects_length(self): """ When called with a `memoryview` instance, `Connection.recv_into` @@ -3021,7 +3014,6 @@ class TestConnectionRecvInto(object): """ self._respects_length_test(_make_memoryview) - @skip_if_py26 def test_memoryview_doesnt_overfill(self): """ When called with a `memoryview` instance, `Connection.recv_into` @@ -3030,7 +3022,6 @@ class TestConnectionRecvInto(object): """ self._doesnt_overfill_test(_make_memoryview) - @skip_if_py26 def test_memoryview_really_doesnt_overfill(self): """ When called with a `memoryview` instance and an `nbytes` value that is @@ -3078,7 +3069,6 @@ class TestConnectionSendall(object): ) == str(w[-1].message)) assert client.recv(1) == b"x" - @skip_if_py26 def test_short_memoryview(self): """ When passed a memoryview onto a small number of bytes, diff --git a/tox.ini b/tox.ini index bcb2f48..cbf6693 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {pypy,py26,py27,py34,py35,py36}{,-cryptographyMaster,-cryptographyMinimum},py27-twistedMaster,pypi-readme,check-manifest,flake8,docs,coverage-report +envlist = {pypy,py27,py34,py35,py36}{,-cryptographyMaster,-cryptographyMinimum},py27-twistedMaster,pypi-readme,check-manifest,flake8,docs,coverage-report [testenv] whitelist_externals = @@ -10,7 +10,7 @@ extras = deps = coverage>=4.2 cryptographyMaster: git+https://github.com/pyca/cryptography.git - cryptographyMinimum: cryptography==2.1.4 + cryptographyMinimum: cryptography==2.2.1 setenv = # Do not allow the executing environment to pollute the test environment # with extra packages. -- cgit v1.2.1