[Python-modules-commits] [python-django] 01/03: Add two patches to fix build in current Debian unstable
Raphaël Hertzog
hertzog at moszumanska.debian.org
Wed May 20 16:05:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
hertzog pushed a commit to branch debian/experimental
in repository python-django.
commit 78a07eaea02529eee4ca5d3a2bf670404e31b26e
Author: Raphaël Hertzog <hertzog at debian.org>
Date: Wed May 20 14:54:24 2015 +0200
Add two patches to fix build in current Debian unstable
* Add fix-assertRaisesMessage.patch to make the package build with
python 2.7.10~rc1 which is affected by
https://bugs.python.org/issue24134
* Add fix-test-extended-length-storage.patch to make the package build
even when AUFS is in use (and when the max length of a filename is
shorter than usual).
---
debian/changelog | 9 ++--
debian/patches/fix-assertRaisesMessage.patch | 56 ++++++++++++++++++++++
.../patches/fix-test-extended-length-storage.patch | 54 +++++++++++++++++++++
debian/patches/series | 2 +
4 files changed, 118 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 24b67e9..ca41ad2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,5 @@
python-django (1.8.1-1) UNRELEASED; urgency=medium
- TODO: Handle https://code.djangoproject.com/ticket/24826
- and https://code.djangoproject.com/ticket/24827
-
* New major upstream release:
https://docs.djangoproject.com/en/1.8/releases/1.8/
https://docs.djangoproject.com/en/1.8/releases/1.8.1/
@@ -12,6 +9,12 @@ python-django (1.8.1-1) UNRELEASED; urgency=medium
that they refer to django-admin and not django-admin.py
* Add jinja2 and mock as build dependencies required by the test
suite.
+ * Add fix-assertRaisesMessage.patch to make the package build with
+ python 2.7.10~rc1 which is affected by
+ https://bugs.python.org/issue24134
+ * Add fix-test-extended-length-storage.patch to make the package build
+ even when AUFS is in use (and when the max length of a filename is
+ shorter than usual).
-- Raphaël Hertzog <hertzog at debian.org> Wed, 20 May 2015 09:54:47 +0200
diff --git a/debian/patches/fix-assertRaisesMessage.patch b/debian/patches/fix-assertRaisesMessage.patch
new file mode 100644
index 0000000..e5e939d
--- /dev/null
+++ b/debian/patches/fix-assertRaisesMessage.patch
@@ -0,0 +1,56 @@
+Description: Fix assertRaisesMessage() with python 2.7.10~rc1 and Python 3.5
+ The failures are due to the change described in
+ https://bugs.python.org/issue24134. The changes got reverted
+ in stable releases but not in Python 3.5 so this patch
+ is still needed for Python 3.5 compatibility...
+Origin: upstream, https://github.com/django/django/commit/c2bc1cefdcbbf074408f4a4cace88b315cf9d652 https://github.com/django/django/commit/e89c3a46035e9fe17c373a6c9cd63b9fd631d596
+Author: Tim Graham <timograham at gmail.com>
+Bug: https://code.djangoproject.com/ticket/23763
+Applied-Upstream: 1.9
+
+--- a/django/test/testcases.py
++++ b/django/test/testcases.py
+@@ -565,8 +565,7 @@ class SimpleTestCase(unittest.TestCase):
+ msg_prefix + "Template '%s' was used unexpectedly in rendering"
+ " the response" % template_name)
+
+- def assertRaisesMessage(self, expected_exception, expected_message,
+- callable_obj=None, *args, **kwargs):
++ def assertRaisesMessage(self, expected_exception, expected_message, *args, **kwargs):
+ """
+ Asserts that the message in a raised exception matches the passed
+ value.
+@@ -574,12 +573,15 @@ class SimpleTestCase(unittest.TestCase):
+ Args:
+ expected_exception: Exception class expected to be raised.
+ expected_message: expected error message string value.
+- callable_obj: Function to be called.
+- args: Extra args.
++ args: Function to be called and extra positional args.
+ kwargs: Extra kwargs.
+ """
++ # callable_obj was a documented kwarg in Django 1.8 and older.
++ callable_obj = kwargs.pop('callable_obj', None)
++ if callable_obj:
++ args = (callable_obj,) + args
+ return six.assertRaisesRegex(self, expected_exception,
+- re.escape(expected_message), callable_obj, *args, **kwargs)
++ re.escape(expected_message), *args, **kwargs)
+
+ def assertFieldOutput(self, fieldclass, valid, invalid, field_args=None,
+ field_kwargs=None, empty_value=''):
+--- a/tests/test_utils/tests.py
++++ b/tests/test_utils/tests.py
+@@ -752,6 +752,12 @@ class AssertRaisesMsgTest(SimpleTestCase
+ raise ValueError("[.*x+]y?")
+ self.assertRaisesMessage(ValueError, "[.*x+]y?", func1)
+
++ def test_callable_obj_param(self):
++ # callable_obj was a documented kwarg in Django 1.8 and older.
++ def func1():
++ raise ValueError("[.*x+]y?")
++ self.assertRaisesMessage(ValueError, "[.*x+]y?", callable_obj=func1)
++
+
+ class AssertFieldOutputTests(SimpleTestCase):
+
diff --git a/debian/patches/fix-test-extended-length-storage.patch b/debian/patches/fix-test-extended-length-storage.patch
new file mode 100644
index 0000000..043ade8
--- /dev/null
+++ b/debian/patches/fix-test-extended-length-storage.patch
@@ -0,0 +1,54 @@
+Description: Fix failing test when AUFS is in use
+ AUFS only supports filenames up to 242 characters and a test
+ was wrongly assuming that a 255 characters filename would be possible.
+Bug: https://code.djangoproject.com/ticket/24826
+Author: Claude Paroz <claude at 2xlibre.net> with changes by Raphaël Hertzog <hertzog at debian.org>
+
+--- a/django/core/files/storage.py
++++ b/django/core/files/storage.py
+@@ -13,7 +13,7 @@ from django.utils.crypto import get_rand
+ from django.utils.deconstruct import deconstructible
+ from django.utils.deprecation import RemovedInDjango20Warning
+ from django.utils.encoding import filepath_to_uri, force_text
+-from django.utils.functional import LazyObject
++from django.utils.functional import LazyObject, cached_property
+ from django.utils.module_loading import import_string
+ from django.utils.six.moves.urllib.parse import urljoin
+ from django.utils.text import get_valid_filename
+@@ -27,6 +27,8 @@ class Storage(object):
+ storage systems can inherit or override, as necessary.
+ """
+
++ MAX_FILENAME_LENGTH = 255 # Should be safe on most backends
++
+ # The following methods represent a public interface to private methods.
+ # These shouldn't be overridden by subclasses unless absolutely necessary.
+
+@@ -198,6 +200,16 @@ class FileSystemStorage(Storage):
+ else settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS
+ )
+
++ @cached_property
++ def MAX_FILENAME_LENGTH(self):
++ dir_to_test = self.location
++ while not os.path.exists(dir_to_test):
++ dir_to_test = os.path.dirname(dir_to_test)
++ try:
++ return os.pathconf(dir_to_test, 'PC_NAME_MAX')
++ except Exception:
++ return Storage.MAX_FILENAME_LENGTH
++
+ def _open(self, name, mode='rb'):
+ return File(open(self.path(name), mode))
+
+--- a/tests/file_storage/tests.py
++++ b/tests/file_storage/tests.py
+@@ -534,7 +534,7 @@ class FileFieldStorageTests(SimpleTestCa
+ def test_extended_length_storage(self):
+ # Testing FileField with max_length > 255. Most systems have filename
+ # length limitation of 255. Path takes extra chars.
+- filename = 251 * 'a' # 4 chars for extension.
++ filename = (temp_storage.MAX_FILENAME_LENGTH - 4) * 'a' # 4 chars for extension.
+ obj = Storage()
+ obj.extended_length.save('%s.txt' % filename, ContentFile('Same Content'))
+ self.assertEqual(obj.extended_length.name, 'tests/%s.txt' % filename)
diff --git a/debian/patches/series b/debian/patches/series
index 9b1ddfc..bd6c5cb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
+fix-assertRaisesMessage.patch
+fix-test-extended-length-storage.patch
02_disable-sources-in-sphinxdoc.diff
06_use_debian_geoip_database_as_default.diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django.git
More information about the Python-modules-commits
mailing list