Skip to content

Commit

Permalink
Raise minimum cryptography version to 2.2.1, drop python 2.6 (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaine authored and alex committed Mar 21, 2018
1 parent 993c4e4 commit 1ae7cb6
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 47 deletions.
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion doc/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def find_meta(meta):
'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',
Expand All @@ -95,16 +94,14 @@ def find_meta(meta):
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",
Expand Down
18 changes: 4 additions & 14 deletions src/OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@
'Connection'
]

try:
_memoryview = memoryview
except NameError:
class _memoryview(object):
pass

try:
_buffer = buffer
except NameError:
Expand Down Expand Up @@ -1702,7 +1696,7 @@ def send(self, buf, flags=0):
# 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)
Expand All @@ -1729,7 +1723,7 @@ def sendall(self, buf, flags=0):
"""
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)
Expand Down Expand Up @@ -1802,12 +1796,8 @@ def recv_into(self, buffer, nbytes=None, flags=None):
# 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

Expand Down
12 changes: 1 addition & 11 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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
Expand Down Expand Up @@ -99,10 +99,6 @@


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):
Expand Down Expand Up @@ -2867,7 +2863,6 @@ def test_text(self):
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,
Expand Down Expand Up @@ -3004,15 +2999,13 @@ def test_peek(self):
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
in the receive buffer is written to it.
"""
self._no_length_test(_make_memoryview)

@skip_if_py26
def test_memoryview_respects_length(self):
"""
When called with a `memoryview` instance, `Connection.recv_into`
Expand All @@ -3021,7 +3014,6 @@ def test_memoryview_respects_length(self):
"""
self._respects_length_test(_make_memoryview)

@skip_if_py26
def test_memoryview_doesnt_overfill(self):
"""
When called with a `memoryview` instance, `Connection.recv_into`
Expand All @@ -3030,7 +3022,6 @@ def test_memoryview_doesnt_overfill(self):
"""
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
Expand Down Expand Up @@ -3078,7 +3069,6 @@ def test_text(self):
) == 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,
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand All @@ -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.
Expand Down

0 comments on commit 1ae7cb6

Please sign in to comment.