[Python-modules-commits] [sorl-thumbnail] 07/15: merge patched into master
Wolfgang Borgert
debacle at moszumanska.debian.org
Wed Oct 5 01:39:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository sorl-thumbnail.
commit 4dacc17f2bfa96f400f76e8014f6c4ccb47c467e
Merge: 37dc22d aaf55c0
Author: W. Martin Borgert <debacle at debian.org>
Date: Tue Oct 4 02:01:26 2016 +0200
merge patched into master
.travis.yml | 65 +++--------
AUTHORS | 3 +-
README.rst | 25 +++--
debian/.git-dpm | 6 +-
...skip-incompatible-test-for-Django-1.8-1.9.patch | 16 +--
debian/patches/disable_http_tests.patch | 6 +-
debian/patches/icc_profile.patch | 10 +-
debian/patches/orientation.patch | 2 +-
docs/contributing.rst | 10 +-
docs/installation.rst | 2 +-
docs/reference/settings.rst | 2 +-
docs/requirements.rst | 7 +-
docs/template.rst | 6 +-
setup.py | 8 +-
sorl/__init__.py | 3 +-
sorl/thumbnail/admin/__init__.py | 8 +-
sorl/thumbnail/admin/compat.py | 91 ---------------
sorl/thumbnail/admin/current.py | 12 +-
sorl/thumbnail/base.py | 24 ++--
sorl/thumbnail/compat.py | 46 --------
sorl/thumbnail/conf/defaults.py | 10 +-
sorl/thumbnail/engines/convert_engine.py | 2 +-
sorl/thumbnail/engines/pil_engine.py | 10 +-
sorl/thumbnail/engines/vipsthumbnail_engine.py | 122 +++++++++++++++++++++
sorl/thumbnail/fields.py | 7 --
sorl/thumbnail/helpers.py | 7 +-
sorl/thumbnail/images.py | 29 +++--
sorl/thumbnail/kvstores/cached_db_kvstore.py | 5 +-
sorl/thumbnail/kvstores/dynamodb_kvstore.py | 38 +++++++
sorl/thumbnail/migrations/0001_initial.py | 5 +-
sorl/thumbnail/templatetags/thumbnail.py | 19 +++-
tests/.coveragerc | 11 +-
tests/data/aspect_test.jpg | Bin 0 -> 5723 bytes
tests/data/broken.jpeg | Bin 0 -> 480 bytes
tests/settings/default.py | 9 +-
tests/settings/dynamodb.py | 8 ++
tests/settings/vipsthumbnail.py | 4 +
tests/thumbnail_tests/compat.py | 9 +-
tests/thumbnail_tests/templates/thumbnaild4.html | 5 +
tests/thumbnail_tests/test_backends.py | 1 +
tests/thumbnail_tests/test_engines.py | 60 ++++++++++
tests/thumbnail_tests/urls.py | 16 +--
tox.ini | 13 ++-
vagrant.sh | 8 +-
44 files changed, 437 insertions(+), 313 deletions(-)
diff --cc debian/.git-dpm
index 0a3073a,0000000..3516915
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
+# see git-dpm(1) from git-dpm package
- 2301172c97b1680a811bfa99b6a869217d6785a8
- 2301172c97b1680a811bfa99b6a869217d6785a8
- 42b81892242e6ae4979e886c38f92a113aa58721
++aaf55c02fafab0f366155d02163051dcf2d516c3
++aaf55c02fafab0f366155d02163051dcf2d516c3
++3ffdcfe77474be5c4dadbc0c1a48660f0b6de824
+3ffdcfe77474be5c4dadbc0c1a48660f0b6de824
+sorl-thumbnail_12.3+git20160928.orig.tar.gz
+c5c474b91991acc8392d73c081aca22fd3fa01ea
+530006
+debianTag="debian/%e%v"
+patchedTag="patched/%e%v"
+upstreamTag="upstream/%e%u"
diff --cc debian/patches/0004-skip-incompatible-test-for-Django-1.8-1.9.patch
index 604f23b,0000000..e45be60
mode 100644,000000..100644
--- a/debian/patches/0004-skip-incompatible-test-for-Django-1.8-1.9.patch
+++ b/debian/patches/0004-skip-incompatible-test-for-Django-1.8-1.9.patch
@@@ -1,46 -1,0 +1,46 @@@
- From 2301172c97b1680a811bfa99b6a869217d6785a8 Mon Sep 17 00:00:00 2001
++From aaf55c02fafab0f366155d02163051dcf2d516c3 Mon Sep 17 00:00:00 2001
+From: "W. Martin Borgert" <debacle at debian.org>
+Date: Wed, 6 Jan 2016 21:18:12 +0100
+Subject: skip incompatible test for Django 1.8/1.9
+
+---
- tests/thumbnail_tests/compat.py | 5 ++++-
++ tests/thumbnail_tests/compat.py | 5 +++++
+ tests/thumbnail_tests/test_templatetags.py | 2 ++
- 2 files changed, 6 insertions(+), 1 deletion(-)
++ 2 files changed, 7 insertions(+)
+
+diff --git a/tests/thumbnail_tests/compat.py b/tests/thumbnail_tests/compat.py
- index e1e1fba..21b08ed 100644
++index 7367017..10f26df 100644
+--- a/tests/thumbnail_tests/compat.py
++++ b/tests/thumbnail_tests/compat.py
- @@ -8,7 +8,10 @@ PY3 = sys.version_info[0] == 3
- if PY3:
++@@ -4,6 +4,11 @@ try:
++ import unittest2 as unittest
++ except ImportError:
+ import unittest
- else:
- - from django.utils import unittest
+++else:
++ try:
++ from django.utils import unittest
++ except ImportError:
++ import unittest
+
+
+ def is_osx():
+diff --git a/tests/thumbnail_tests/test_templatetags.py b/tests/thumbnail_tests/test_templatetags.py
+index 0dbef1e..557c2d2 100644
+--- a/tests/thumbnail_tests/test_templatetags.py
++++ b/tests/thumbnail_tests/test_templatetags.py
+@@ -8,6 +8,7 @@ from PIL import Image
+
+ from django.template.loader import render_to_string
+ from django.test import Client, TestCase
++from django import VERSION
+ import pytest
+
+ from sorl.thumbnail.conf import settings
+@@ -167,6 +168,7 @@ class TemplateTestCaseB(BaseTestCase):
+
+
+ class TemplateTestCaseClient(TestCase):
++ @unittest.skipIf(VERSION[0] == 1 and VERSION[1] in [8, 9], "Test incompatible with Django 1.8/1.9")
+ def test_empty_error(self):
+ with override_custom_settings(settings, THUMBNAIL_DEBUG=False):
+ from django.core.mail import outbox
diff --cc debian/patches/disable_http_tests.patch
index 3579c34,0000000..815a0c4
mode 100644,000000..100644
--- a/debian/patches/disable_http_tests.patch
+++ b/debian/patches/disable_http_tests.patch
@@@ -1,58 -1,0 +1,58 @@@
- From 5ec2035a62b75066218e8af21dc920e413a8a7f2 Mon Sep 17 00:00:00 2001
++From 8d83ae645900b535160dbe3becc7c0cc651b13cd Mon Sep 17 00:00:00 2001
+From: Michael Fladischer <FladischerMichael at fladi.at>
+Date: Thu, 8 Oct 2015 13:53:16 -0700
+Subject: Disable HTTP requests during build
+
+ Remote resources such as images fetched over HTTP are not allowed at build
+ time so this patch skips these tests if the environment variable
+ LOCAL_BUILD is present.
+Last-Update: 2015-01-27
+Forwarded: not-needed
+
+Patch-Name: disable_http_tests.patch
+---
+ tests/thumbnail_tests/test_engines.py | 13 +++++++------
+ tests/thumbnail_tests/test_templatetags.py | 2 ++
+ 2 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/tests/thumbnail_tests/test_engines.py b/tests/thumbnail_tests/test_engines.py
- index 3b60b33..6bc0e82 100644
++index 4ef4617..da6a86a 100644
+--- a/tests/thumbnail_tests/test_engines.py
++++ b/tests/thumbnail_tests/test_engines.py
- @@ -190,12 +190,13 @@ class SimpleTestCase(BaseTestCase):
++@@ -192,12 +192,13 @@ class SimpleTestCase(BaseTestCase):
+ default.kvstore.get(im).serialize_storage(),
+ 'tests.thumbnail_tests.storage.TestStorage',
+ )
+- im = ImageFile('http://dummyimage.com/300x300/')
+- default.kvstore.set(im)
+- self.assertEqual(
+- default.kvstore.get(im).serialize_storage(),
+- 'sorl.thumbnail.images.UrlStorage',
+- )
++ if not os.environ.get('LOCAL_BUILD', False):
++ im = ImageFile('http://dummyimage.com/300x300/')
++ default.kvstore.set(im)
++ self.assertEqual(
++ default.kvstore.get(im).serialize_storage(),
++ 'sorl.thumbnail.images.UrlStorage',
++ )
+
+ def test_abspath(self):
+ item = Item.objects.get(image='500x500.jpg')
+diff --git a/tests/thumbnail_tests/test_templatetags.py b/tests/thumbnail_tests/test_templatetags.py
+index d545519..0dbef1e 100644
+--- a/tests/thumbnail_tests/test_templatetags.py
++++ b/tests/thumbnail_tests/test_templatetags.py
+@@ -146,10 +146,12 @@ class TemplateTestCaseA(BaseTestCase):
+
+
+ class TemplateTestCaseB(BaseTestCase):
++ @unittest.skipIf(os.environ.get('LOCAL_BUILD', False), "No remote resources desired")
+ def test_url(self):
+ val = render_to_string('thumbnail3.html', {}).strip()
+ self.assertEqual(val, '<img style="margin:0px 0px 0px 0px" width="20" height="20">')
+
++ @unittest.skipIf(os.environ.get('LOCAL_BUILD', False), "No remote resources desired")
+ def test_portrait(self):
+ val = render_to_string('thumbnail4.html', {
+ 'source': 'http://dummyimage.com/120x100/',
diff --cc debian/patches/icc_profile.patch
index 55ac34a,0000000..d6b3854
mode 100644,000000..100644
--- a/debian/patches/icc_profile.patch
+++ b/debian/patches/icc_profile.patch
@@@ -1,31 -1,0 +1,31 @@@
- From 8b292bba76b5fa9f8d2a1da47445d13a1b44284e Mon Sep 17 00:00:00 2001
++From d5a9bbb625355a53997bda0ece0e669c69552881 Mon Sep 17 00:00:00 2001
+From: Michael Fladischer <FladischerMichael at fladi.at>
+Date: Thu, 8 Oct 2015 13:53:18 -0700
+Subject: isome engines do not preserve ICC profile on crop
+
+ Skip the test for the ICC profile in a thumbnail if either graphicsmagick or
+ pgmagick is used as an engine.
+Last-Update: 2015-01-27
+Forwarded: no
+
+Patch-Name: icc_profile.patch
+---
+ tests/thumbnail_tests/test_engines.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/tests/thumbnail_tests/test_engines.py b/tests/thumbnail_tests/test_engines.py
- index 6bc0e82..082a331 100644
++index da6a86a..b4e1bc3 100644
+--- a/tests/thumbnail_tests/test_engines.py
++++ b/tests/thumbnail_tests/test_engines.py
- @@ -329,6 +329,11 @@ class CropTestCase(BaseTestCase):
- # TODO: Complete test for smart crop
- self.BACKEND.get_thumbnail('32x32', 'data/white_border.jpg', crop='smart')
++@@ -344,6 +344,11 @@ class CropTestCase(BaseTestCase):
++ self.assertEqual(th.x, 25)
++ self.assertEqual(th.y, 50)
+
++ @unittest.skipIf(settings.THUMBNAIL_ENGINE in (
++ "sorl.thumbnail.engines.pgmagick_engine.Engine",
++ "sorl.thumbnail.engines.convert_engine.Engine",
++ ),
++ "graphicsmagick and pgmagick do not preserve ICC profile on crop")
+ def test_crop_image_with_icc_profile(self):
+ name = 'data/icc_profile_test.jpg'
+ item, _ = Item.objects.get_or_create(image=name)
diff --cc debian/patches/orientation.patch
index 10e3766,0000000..3edd44a
mode 100644,000000..100644
--- a/debian/patches/orientation.patch
+++ b/debian/patches/orientation.patch
@@@ -1,89 -1,0 +1,89 @@@
- From cb0aedc45be3b391d121e138f43d3d29c1420a2f Mon Sep 17 00:00:00 2001
++From 59611f8187b383c8692cf3ffb94be9b2ec505534 Mon Sep 17 00:00:00 2001
+From: Michael Fladischer <FladischerMichael at fladi.at>
+Date: Thu, 8 Oct 2015 13:53:15 -0700
+Subject: Split orientation test into pixel and EXIF comparison.
+
+ Skip these tests if graphicsmagick or pgmagick is used as the engine. Both
+ don't synchronize the EXIF orientation with the actual orientation of the
+ image.
+Last-Update: 2015-01-27
+Forwarded: no
+
+Patch-Name: orientation.patch
+---
+ tests/thumbnail_tests/test_templatetags.py | 39 +++++++++++++++++++++++++++---
+ 1 file changed, 36 insertions(+), 3 deletions(-)
+
+diff --git a/tests/thumbnail_tests/test_templatetags.py b/tests/thumbnail_tests/test_templatetags.py
+index c774dea..d545519 100644
+--- a/tests/thumbnail_tests/test_templatetags.py
++++ b/tests/thumbnail_tests/test_templatetags.py
+@@ -1,6 +1,8 @@
+ # -*- coding: utf-8 -*-
+ import os
+ import re
++import shutil
++import unittest
+ from subprocess import Popen, PIPE
+ from PIL import Image
+
+@@ -76,8 +78,10 @@ class TemplateTestCaseA(BaseTestCase):
+ m = re.search('Interlace: None', str(p.stdout.read()))
+ self.assertEqual(bool(m), True)
+
+- def test_orientation(self):
+- ref = Image.open(os.path.join(DATA_DIR, '1_topleft.jpg'))
++ def test_orientation_pixels(self):
++ data_dir = os.path.join(settings.MEDIA_ROOT, 'data_pixels')
++ shutil.copytree(settings.DATA_ROOT, data_dir)
++ ref = Image.open(os.path.join(data_dir, '1_topleft.jpg'))
+ top = ref.getpixel((14, 7))
+ left = ref.getpixel((7, 14))
+ engine = PILEngine()
+@@ -101,16 +105,45 @@ class TemplateTestCaseA(BaseTestCase):
+ )
+
+ for name in data_images:
+- th = self.BACKEND.get_thumbnail('data/%s' % name, '30x30')
++ th = self.BACKEND.get_thumbnail('data_pixels/%s' % name, '30x30')
+ im = engine.get_image(th)
+
+ self.assertLess(epsilon(top, im.getpixel((14, 7))), 10)
+ self.assertLess(epsilon(left, im.getpixel((7, 14))), 10)
++
++ shutil.rmtree(data_dir)
++
++ @unittest.skipIf(settings.THUMBNAIL_ENGINE in (
++ "sorl.thumbnail.engines.pgmagick_engine.Engine",
++ "sorl.thumbnail.engines.convert_engine.Engine",
++ ),
++ "graphicsmagick and pgmagick do not correct the orientation in the EXIF tag")
++ def test_orientation_exif(self):
++ data_dir = os.path.join(settings.MEDIA_ROOT, 'data_exif')
++ shutil.copytree(settings.DATA_ROOT, data_dir)
++ engine = PILEngine()
++
++ data_images = (
++ '1_topleft.jpg',
++ '2_topright.jpg',
++ '3_bottomright.jpg',
++ '4_bottomleft.jpg',
++ '5_lefttop.jpg',
++ '6_righttop.jpg',
++ '7_rightbottom.jpg',
++ '8_leftbottom.jpg'
++ )
++
++ for name in sorted(os.listdir(data_dir)):
++ th = self.BACKEND.get_thumbnail('data_exif/%s' % name, '30x30')
++ im = engine.get_image(th)
+ exif = im._getexif()
+
+ if exif:
+ self.assertEqual(exif.get(0x0112), 1)
+
++ shutil.rmtree(data_dir)
++
+
+ class TemplateTestCaseB(BaseTestCase):
+ def test_url(self):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sorl-thumbnail.git
More information about the Python-modules-commits
mailing list