Skip to content

Commit ce04202

Browse files
author
David Krauth
committed
Added Django 2.2 & 3.0 to testing matrix (with fixes). Bumped Python version to 3.7.
1 parent bc251f4 commit ce04202

File tree

23 files changed

+87
-59
lines changed

23 files changed

+87
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ build
66
ghostdriver.log
77
test/media
88
dist/
9+
.python-version

.travis.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ matrix:
1818
- { python: 2.7, env: S3=0 TOXENV=py27-dj111 }
1919
- { python: 2.7, env: S3=1 TOXENV=py27-dj111 }
2020
- { python: 2.7, env: S3=0 TOXENV=py27-dj111-grp }
21-
- { python: 3.6, env: S3=0 TOXENV=py36-dj111 }
22-
- { python: 3.6, env: S3=0 TOXENV=py36-dj20 }
23-
- { python: 3.6, env: S3=1 TOXENV=py36-dj20 }
24-
- { python: 3.6, env: S3=0 TOXENV=py36-dj20-grp }
25-
- { python: 3.6, env: S3=0 TOXENV=py36-dj21 }
21+
- { python: 3.7, env: S3=0 TOXENV=py37-dj111 }
22+
- { python: 3.7, env: S3=0 TOXENV=py37-dj20 }
23+
- { python: 3.7, env: S3=1 TOXENV=py37-dj20 }
24+
- { python: 3.7, env: S3=0 TOXENV=py37-dj20-grp }
25+
- { python: 3.7, env: S3=0 TOXENV=py37-dj21 }
26+
- { python: 3.7, env: S3=0 TOXENV=py37-dj22 }
27+
- { python: 3.7, env: S3=0 TOXENV=py37-dj22-grp }
28+
- { python: 3.7, env: S3=0 TOXENV=py37-dj30 }
29+
- { python: 3.7, env: S3=0 TOXENV=py37-dj30-grp }
2630
allow_failures:
27-
- env: S3=0 TOXENV=py36-dj21
31+
- env:
32+
S3=0 TOXENV=py37-dj30
33+
S3=0 TOXENV=py37-dj30-grp
2834

2935
cache: pip
3036

cropduster/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.12.8'
1+
__version__ = '4.12.9'

cropduster/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
import copy
55
import errno
66

7+
import six
8+
from six.moves import xrange
9+
710
try:
811
from django.urls import get_urlconf, get_resolver
912
except ImportError:
1013
from django.core.urlresolvers import get_urlconf, get_resolver
1114
from django.http import HttpResponse
1215
from django.utils.safestring import mark_safe
13-
from django.utils import six
14-
from django.utils.six.moves import xrange
15-
1616
from django.utils.encoding import force_text
1717

1818

cropduster/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import contextlib
22
from operator import attrgetter
33

4+
import six
45
import django
56
from django import forms
67
from django.db import models, transaction, router, DEFAULT_DB_ALIAS
78
from django.db.models.fields import Field
89
from django.db.models.fields.files import ImageFileDescriptor, ImageFieldFile
910
from django.db.models.fields.related import ManyToManyRel, ManyToManyField
1011
from django.utils.functional import cached_property
11-
from django.utils import six
1212
from django.contrib.contenttypes.models import ContentType
1313

1414
from generic_plus.fields import GenericForeignFileField

cropduster/files.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
import re
55
import hashlib
66

7+
from six.moves.urllib import parse as urlparse
8+
from six.moves.urllib.request import urlopen
9+
710
from django.core.files.images import get_image_dimensions
811
from django.core.files.uploadedfile import SimpleUploadedFile
912
from django.core.files.storage import default_storage
1013
from django.conf import settings
1114
from django.db.models.fields.files import FieldFile, FileField
1215
from django.utils.functional import cached_property
1316
from django.utils.http import urlunquote_plus
14-
from django.utils.six.moves.urllib import parse as urlparse
15-
from django.utils.six.moves.urllib.request import urlopen
1617

1718
from generic_plus.utils import get_relative_media_url, get_media_path
1819

cropduster/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import six
12
from django import forms
23
from django.core.exceptions import ValidationError
34
from django.forms.models import ModelChoiceIterator
45
from django.forms.models import ChoiceField, ModelMultipleChoiceField
56
from django.forms.utils import flatatt
67
from django.utils.encoding import force_text
78
from django.utils.html import escape, conditional_escape
8-
from django.utils import six
99

1010
from generic_plus.forms import BaseGenericFileInlineFormSet, GenericForeignFileWidget
1111

cropduster/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
import time
88
from datetime import datetime
99

10+
import six
11+
from six.moves import xrange
12+
1013
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
1114
from django.core.files.storage import FileSystemStorage
1215
from django.contrib.contenttypes.fields import GenericForeignKey
1316
from django.contrib.contenttypes.models import ContentType
1417
from django.db import connection, models
15-
from django.utils import six
16-
from django.utils.encoding import python_2_unicode_compatible
17-
from django.utils.six.moves import xrange
1818
from django.core.files.storage import default_storage, FileSystemStorage
1919

2020
import PIL.Image
@@ -44,7 +44,7 @@ def safe_str_path(file_path):
4444
return file_path
4545

4646

47-
@python_2_unicode_compatible
47+
@six.python_2_unicode_compatible
4848
class Thumb(models.Model):
4949

5050
name = models.CharField(max_length=255, db_index=True)
@@ -213,7 +213,7 @@ def generate_filename(instance, filename):
213213
return filename
214214

215215

216-
@python_2_unicode_compatible
216+
@six.python_2_unicode_compatible
217217
class Image(models.Model):
218218

219219
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)

cropduster/resizing.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
import hashlib
77
import tempfile
88

9+
import six
10+
from six.moves import filter
911
import PIL.Image
1012

1113
from django.core.exceptions import ImproperlyConfigured
12-
from django.utils import six
13-
from django.utils.encoding import python_2_unicode_compatible
14-
from django.utils.six.moves import filter
1514
from django.core.files.storage import default_storage
1615

1716
from .settings import CROPDUSTER_RETAIN_METADATA
@@ -23,7 +22,7 @@
2322
INFINITY = float('inf')
2423

2524

26-
@python_2_unicode_compatible
25+
@six.python_2_unicode_compatible
2726
class SizeAlias(object):
2827
is_alias = True
2928

@@ -46,7 +45,7 @@ def add_to_sizes_dict(self, sizes):
4645
ctx.update(size_to)
4746

4847

49-
@python_2_unicode_compatible
48+
@six.python_2_unicode_compatible
5049
class Size(object):
5150

5251
is_alias = False

cropduster/settings.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import PIL
33
import distutils.spawn
44
from distutils.version import LooseVersion
5+
import six
56
from django.conf import settings
67
from django.core.exceptions import ImproperlyConfigured
7-
from django.utils import six
88

99

1010
CROPDUSTER_MEDIA_ROOT = getattr(settings, 'CROPDUSTER_MEDIA_ROOT', settings.MEDIA_ROOT)
@@ -45,8 +45,12 @@ def get_jpeg_quality(width, height):
4545
"CROPDUSTER_JPEG_QUALITY setting must be either a callable "
4646
"or a numeric value, got type %s" % (type(CROPDUSTER_JPEG_QUALITY).__name__))
4747

48-
JPEG_SAVE_ICC_SUPPORTED = (LooseVersion(getattr(PIL, 'PILLOW_VERSION', '0'))
49-
>= LooseVersion('2.2.1'))
48+
try:
49+
PILLOW_VERSION = getattr(PIL, '__version__', '0')
50+
except AttributeError:
51+
PILLOW_VERSION = getattr(PIL, 'PILLOW_VERSION', '0')
52+
53+
JPEG_SAVE_ICC_SUPPORTED = (LooseVersion(PILLOW_VERSION) >= LooseVersion('2.2.1'))
5054

5155
CROPDUSTER_GIFSICLE_PATH = getattr(settings, 'CROPDUSTER_GIFSICLE_PATH', None)
5256

0 commit comments

Comments
 (0)