Skip to content

Commit 978a0b9

Browse files
authored
Merge pull request #15 from caktus/update_supported_versions
Support Django 1.11 and Python 3.6, drop some older python versions
2 parents ee19b9b + 576b449 commit 978a0b9

File tree

8 files changed

+66
-33
lines changed

8 files changed

+66
-33
lines changed

.travis.yml

+38-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,50 @@
1+
# Use travis container-based build system for speed
2+
sudo: false
3+
4+
# Ubuntu trusty (14.04) - latest that Travis offers
5+
dist: trusty
6+
7+
# Make sure all the python versions we need are pre-installed
8+
# (apt-get is not available in the container-based build system)
9+
addons:
10+
apt:
11+
sources:
12+
- deadsnakes
13+
packages:
14+
- python2.7
15+
- python3.4
16+
- python3.5
17+
- python3.6
18+
119
language: python
220

21+
# The version of Python that'll be used to invoke tox. Has no effect
22+
# on what version of Python tox uses to run each set of tests.
323
python:
424
- "3.5"
525

26+
# Test a sampling of combinations
627
env:
7-
- TOXENV=py26-1.5,py27-1.5,py33-1.5
8-
- TOXENV=py26-1.6,py27-1.6,py33-1.6
9-
- TOXENV=py27-1.7,py33-1.7,py34-1.7
10-
- TOXENV=py27-1.8,py33-1.8,py34-1.8
11-
- TOXENV=py27-1.9,py34-1.9,py35-1.9
12-
- TOXENV=py27-1.10,py34-1.10,py35-1.10
13-
- TOXENV=py27-trunk,py34-trunk,py35-trunk
28+
- TOXENV=py27-1.7
29+
- TOXENV=py27-1.8
30+
- TOXENV=py27-1.10
31+
- TOXENV=py27-1.11
32+
- TOXENV=py34-1.7
33+
- TOXENV=py34-1.8
34+
- TOXENV=py34-1.11
35+
- TOXENV=py35-1.9
36+
- TOXENV=py35-1.10
37+
- TOXENV=py35-1.11
38+
- TOXENV=py36-1.8
39+
- TOXENV=py36-1.10
40+
- TOXENV=py36-1.11
1441

1542
install:
1643
- pip install tox
1744

1845
script:
1946
- tox
20-
21-
matrix:
22-
allow_failures:
23-
- env: TOXENV=py27-trunk,py33-trunk
47+
#
48+
#matrix:
49+
# allow_failures:
50+
# - env: TOXENV=py27-trunk,py33-trunk

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ email backend such as `django-ses <https://github.com/hmarr/django-ses>`_.
2929
Requirements
3030
-------------------------------
3131

32-
- Python 2.6, 2.7 or 3.3+ (Python 3 support required Django >= 1.5)
33-
- Django >= 1.3
32+
- Python 2.7 or 3.5+
33+
- Django >= 1.8 (supported versions)
3434

3535

3636
Installation

bandit/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'major': 1,
77
'minor': 3,
88
'micro': 0,
9-
'releaselevel': 'dev',
9+
'releaselevel': 'final',
1010
}
1111

1212

bandit/tests.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
from __future__ import unicode_literals
2+
import six
23

34
import asyncore
5+
import platform
46
import smtpd
57
import threading
68
from email import message_from_string
7-
try:
9+
if six.PY3:
810
# Python 3
911
from email.utils import parseaddr
10-
except ImportError:
12+
else:
1113
# Python 2
1214
from email.Utils import parseaddr
1315

@@ -26,13 +28,17 @@ class FakeSMTPServer(smtpd.SMTPServer, threading.Thread):
2628

2729
def __init__(self, *args, **kwargs):
2830
threading.Thread.__init__(self)
31+
if platform.python_version_tuple() >= ("3", "5"):
32+
kwargs.setdefault('decode_data', True)
2933
smtpd.SMTPServer.__init__(self, *args, **kwargs)
3034
self._sink = []
3135
self.active = False
3236
self.active_lock = threading.Lock()
3337
self.sink_lock = threading.Lock()
3438

35-
def process_message(self, peer, mailfrom, rcpttos, data):
39+
def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
40+
# if not isinstance(data, six.text_type):
41+
# data = data.decode('utf-8')
3642
m = message_from_string(data)
3743
maddr = parseaddr(m.get('from'))[1]
3844
if mailfrom != maddr:

docs/releases.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ to a ``DeprecationWarning`` and the following release the feature and it's relat
2626
code will be removed.
2727

2828

29-
v1.3.dev (Not yet released)
30-
-------------------------------
29+
v1.3 (released 2017-10-31)
30+
--------------------------
3131

32-
- <Add changes here>
32+
- Added support and test coverage for Django 1.11
33+
- Added support and test coverage for Python 3.6
34+
- Dropped support for Python 2.6 and Python 3.3.
3335

3436

3537
v1.2 (Released 2016-11-08)

runtests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def runtests():
3636
django.setup()
3737
from django.test.utils import get_runner
3838
TestRunner = get_runner(settings)
39-
test_runner = TestRunner(verbosity=1, interactive=True, failfast=False)
39+
test_runner = TestRunner(verbosity=1, interactive=True, failfast=True)
4040
failures = test_runner.run_tests(['bandit', ])
4141
sys.exit(failures)
4242

setup.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def read_file(filename):
2222
url='https://github.com/caktus/django-email-bandit',
2323
license='BSD',
2424
description=' '.join(__import__('bandit').__doc__.splitlines()).strip(),
25+
install_requires=[
26+
'six'
27+
],
2528
classifiers=[
2629
'Development Status :: 5 - Production/Stable',
2730
'Environment :: Web Environment',
@@ -32,9 +35,8 @@ def read_file(filename):
3235
'Programming Language :: Python',
3336
'Programming Language :: Python :: 2.7',
3437
'Programming Language :: Python :: 3',
35-
'Programming Language :: Python :: 3.3',
36-
'Programming Language :: Python :: 3.4',
3738
'Programming Language :: Python :: 3.5',
39+
'Programming Language :: Python :: 3.6',
3840
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3941
'Topic :: Software Development :: Libraries :: Python Modules',
4042
],

tox.ini

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
[tox]
2-
envlist = py26-{1.5,1.6},
3-
{py27,py33}-{1.5,1.6},
4-
{py27,py33,py34}-{1.7,1.8},
5-
{py27,py34,py35}-{1.9,1.10,trunk},
2+
envlist = py27-{1.5,1.6},
3+
{py27,py34}-{1.7,1.8},
4+
{py27,py35,py36}-{1.8,1.9,1.10,1.11},
65
docs
76

87
[testenv]
9-
commands = {envpython} runtests.py
8+
commands = {envpython} -Wmodule runtests.py
109
basepython =
11-
py26: python2.6
1210
py27: python2.7
13-
py33: python3.3
1411
py34: python3.4
1512
py35: python3.5
13+
py36: python3.6
1614
deps =
17-
1.3: Django>=1.3,<1.4
18-
1.4: Django>=1.4,<1.5
1915
1.5: Django>=1.5,<1.6
2016
1.6: Django>=1.6,<1.7
2117
1.7: Django>=1.7,<1.8
2218
1.8: Django>=1.8,<1.9
2319
1.9: Django>=1.9,<1.10
2420
1.10: Django>=1.10,<1.11
25-
trunk: https://github.com/django/django/archive/master.tar.gz
21+
1.11: Django>=1.11,<2.0
2622

2723
[testenv:docs]
2824
basepython = python3.4

0 commit comments

Comments
 (0)