From cedb2090df67bc5b30d6f7e392cbdb7e4f2a2336 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 27 Mar 2017 11:24:56 +0300 Subject: [PATCH 1/4] Don't install enum34 when it's not required Having enum34 breaks Python 3.6 in some cases. h/t https://hynek.me/articles/conditional-python-dependencies/ --- enumfields/enums.py | 10 +++++++--- setup.py | 15 +++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/enumfields/enums.py b/enumfields/enums.py index 3260b21..5324071 100644 --- a/enumfields/enums.py +++ b/enumfields/enums.py @@ -1,7 +1,11 @@ import inspect -from enum import Enum as BaseEnum -from enum import EnumMeta as BaseEnumMeta -from enum import _EnumDict + +try: + from enum import Enum as BaseEnum + from enum import EnumMeta as BaseEnumMeta + from enum import _EnumDict +except ImportError: # pragma: no cover + raise ImportError('Missing the enum module. Please install enum34.') from django.utils.encoding import python_2_unicode_compatible diff --git a/setup.py b/setup.py index f581ac9..c76e70f 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,11 @@ #!/usr/bin/env python import os -from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand import sys +from setuptools import find_packages, setup +from setuptools.command.test import test as TestCommand + def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() @@ -25,11 +26,6 @@ def run_tests(self): errno = pytest.main(self.test_args) sys.exit(errno) -install_requires = ['six'] -try: - import enum -except ImportError: - install_requires.append('enum34') setup( name='django-enumfields', @@ -57,10 +53,13 @@ def run_tests(self): "Programming Language :: Python :: 3.5", 'Topic :: Internet :: WWW/HTTP', ], - install_requires=install_requires, + install_requires=['six'], tests_require=[ 'pytest-django<3.0', 'Django', ], + extras_require={ + ':python_version<"3.4"': ['enum34'], + }, cmdclass={'test': PyTest}, ) From dc3e482ddd218385027a0f192a4bc7d84e68ae40 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 27 Mar 2017 11:26:43 +0300 Subject: [PATCH 2/4] Update Travis and Tox configuration to also run on Py3.6 --- .travis.yml | 11 ++++++----- tox.ini | 28 ++++++++++++---------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c0963b..9d36276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ sudo: false language: python python: - - 2.6 - - 2.7 - - 3.3 - - 3.4 - - 3.5 + - '2.6' + - '2.7' + - '3.3' + - '3.4' + - '3.5' + - '3.6' install: - pip install -U pip wheel setuptools - pip install tox tox-travis diff --git a/tox.ini b/tox.ini index c0282d9..2ea6a28 100644 --- a/tox.ini +++ b/tox.ini @@ -1,27 +1,23 @@ [tox] envlist = - python35-django110, python35-django19, python35-django18 - python34-django110, python34-django19, python34-django18, python34-django17 - python33-django18, python33-django17, python33-django16 - python27-django110, python27-django19, python27-django18, python27-django17, python27-django16, python27-django15, python27-django14, - python26-django16, python26-django15, python26-django14 + py36-{django110,django19,django18} + py35-{django110,django19,django18} + py34-{django110,django19,django18,django17} + py33-{django18,django17,django16} + py27-{django110,django19,django18,django17,django16,django15,django14} + py26-{django16,django15,django14} [tox:travis] -2.6 = python26 -2.7 = python27 -3.3 = python33 -3.4 = python34 -3.5 = python35 +2.6 = py26 +2.7 = py27 +3.3 = py33 +3.4 = py34 +3.5 = py35 +3.6 = py36 [testenv] setenv = PYTHONPATH = {toxinidir} commands = python setup.py test -basepython = - python26: python2.6 - python27: python2.7 - python33: python3.3 - python34: python3.4 - python35: python3.5 deps = django14: Django>=1.4,<1.5 django15: Django>=1.5,<1.6 From 76ad7332d4c6f08e1243ca9b06c891e14f6b153b Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 27 Mar 2017 11:33:25 +0300 Subject: [PATCH 3/4] Become officially compatible with Python 3.6 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index c76e70f..d3f9e03 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,7 @@ def run_tests(self): "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", 'Topic :: Internet :: WWW/HTTP', ], install_requires=['six'], From 96a8cb6b29ff1183e6229a3a29aaf40c19abab7e Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 27 Mar 2017 11:34:24 +0300 Subject: [PATCH 4/4] Become version 0.8.3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d3f9e03..cbc3dd8 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def run_tests(self): setup( name='django-enumfields', - version='0.8.2', + version='0.8.3', author='HZDG', author_email='webmaster@hzdg.com', description='Real Python Enums for Django.',