Skip to content

Commit e5bec54

Browse files
TheBukyTheBuky
authored andcommitted
Remove django.utils.six for recent python version to work with Django 3.0
1 parent decffd3 commit e5bec54

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

pipeline/collector.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import django
88
from django.contrib.staticfiles import finders
99
from django.contrib.staticfiles.storage import staticfiles_storage
10-
from django.utils import six
10+
try:
11+
from django.utils.six import iterkeys
12+
except ImportError:
13+
iterkeys = iter
14+
1115

1216
from pipeline.finders import PipelineFinder
1317

@@ -57,7 +61,7 @@ def collect(self, request=None, files=[]):
5761
if files and len(files) == len(found_files):
5862
break
5963

60-
return six.iterkeys(found_files)
64+
return iterkeys(found_files)
6165

6266
def copy_file(self, path, prefixed_path, source_storage):
6367
# Delete the target file if needed or break

pipeline/compilers/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
from django.contrib.staticfiles.storage import staticfiles_storage
1010
from django.core.files.base import ContentFile
1111
from django.utils.encoding import smart_bytes
12-
from django.utils.six import string_types, text_type
12+
try:
13+
from django.utils.six import string_types, text_type
14+
except ImportError:
15+
string_types = (str,)
16+
text_type = str
1317

1418
from pipeline.conf import settings
1519
from pipeline.exceptions import CompilerError

pipeline/compressors/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
from django.contrib.staticfiles.storage import staticfiles_storage
1212
from django.utils.encoding import smart_bytes, force_text
13-
from django.utils.six import string_types
13+
try:
14+
from django.utils.six import string_types
15+
except ImportError:
16+
string_types = (str,)
1417

1518
from pipeline.conf import settings
1619
from pipeline.exceptions import CompressorError

pipeline/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from django.conf import settings as _settings
99
from django.core.signals import setting_changed
1010
from django.dispatch import receiver
11-
from django.utils.six import string_types
11+
try:
12+
from django.utils.six import string_types
13+
except ImportError:
14+
string_types = (str,)
1215

1316

1417
DEFAULTS = {

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
'Framework :: Django :: 1.11',
2828
'Framework :: Django :: 2.0',
2929
'Framework :: Django :: 2.2',
30+
'Framework :: Django :: 3.0',
3031
'Intended Audience :: Developers',
3132
'License :: OSI Approved :: MIT License',
3233
'Operating System :: OS Independent',
@@ -36,6 +37,7 @@
3637
'Programming Language :: Python :: 3.5',
3738
'Programming Language :: Python :: 3.6',
3839
'Programming Language :: Python :: 3.7',
40+
'Programming Language :: Python :: 3.8',
3941
'Programming Language :: Python :: Implementation :: PyPy',
4042
'Topic :: Utilities',
4143
'Topic :: Software Development :: Libraries :: Python Modules',

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ basepython =
1414
py35: python3.5
1515
py36: python3.6
1616
py37: python3.7
17+
py38: python3.8
1718
deps =
1819
py{27,py}: mock
1920
py{27,py}: futures
2021
django22: Django>=2.2.1,<3.0
2122
django111: Django>=1.11,<1.12
22-
django20: Django>=2.0,<2.1
23+
django20: Django>=2.0,<2.2
24+
django30: Django>=3.0
2325
django-master: https://github.com/django/django/archive/master.tar.gz
2426
jinja2
2527
coverage

0 commit comments

Comments
 (0)