From d4c2603ed7d06bd9880878f6ab73cf62fa6ac5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksi=20H=C3=A4kli?= Date: Sun, 24 Feb 2019 15:31:40 +0200 Subject: [PATCH] Add six imports for Django master compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement forwards compatibility for missing django.utils.six package imports on Django 2.2 Relates to django-compressor/django-appconf#44 and can be removed after django-appconf has received a new release which deprecates the use of the integrated Django six library Signed-off-by: Aleksi Häkli --- axes/conf.py | 10 ++++++++++ setup.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/axes/conf.py b/axes/conf.py index 681aac8..75f25fc 100644 --- a/axes/conf.py +++ b/axes/conf.py @@ -1,3 +1,13 @@ +# TODO: Remove these imports after django-appconf does not depend on django.utils.six +try: + from django.utils import six # noqa +except ImportError: # pragma: no cover + import sys + import warnings + + sys.modules['django.utils.six'] = __import__('six') + warnings.warn('django.utils.six was patched for django-appconf backwards compatibility', ImportWarning) + from django.conf import settings from django.utils.translation import gettext_lazy as _ diff --git a/setup.py b/setup.py index 17958f8..c54aef0 100644 --- a/setup.py +++ b/setup.py @@ -34,10 +34,11 @@ setup( package_dir={'axes': 'axes'}, python_requires='~=3.5', install_requires=[ - 'pytz', 'django', 'django-appconf', 'django-ipware>=2.0.2', + 'pytz', + 'six', ], include_package_data=True, packages=find_packages(),