Add six imports for Django master compatibility

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 <aleksi.hakli@iki.fi>
This commit is contained in:
Aleksi Häkli 2019-02-24 15:31:40 +02:00
parent fc32a00e50
commit d4c2603ed7
No known key found for this signature in database
GPG key ID: 3E7146964D726BBE
2 changed files with 12 additions and 1 deletions

View file

@ -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 _

View file

@ -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(),