mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v4] python3-django: version bump 1.8.7 -> 2.2.16
@ 2020-09-24  7:54 Bastian Krause
  2020-10-06  8:18 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Bastian Krause @ 2020-09-24  7:54 UTC (permalink / raw)
  To: ptxdist; +Cc: Bastian Krause

This is the latest LTS version.

The lazy regex compile went mainline with 2bb1027d6b ("Fixed #25322 --
Lazily compiled core.validators regular expressions.").

The MigrationLoader pyc patch is no longer needed, "./manage.py migrate"
works fine.

A fix of an accidental executable bit on a javascript file is added.
This patch did not make it to 2.x.x stable, only to >= 3.x.x .

Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
Note that this patch does not work on its own, the v3 series preceding
the v3 of this patch is needed. The rest of the series seemed to be
okay, that's why I only made a v4 of this single patch.

Changes since v3:
- add patch to fix executable bit on javascript file
Changes since v2:
- drop obsolete v1.8.7 patches
No changes since (implicit) v1.
---
 ...ly-compiled-core.validators-regular-.patch | 123 ------------------
 ...002-MigrationLoader-search-for-.py-c.patch |  36 -----
 patches/Django-1.8.7/series                   |   2 -
 ...ble-bit-from-static-asset-xregexp.js.patch |  12 ++
 patches/Django-2.2.16/series                  |   4 +
 rules/python3-django.in                       |   3 +
 rules/python3-django.make                     |   4 +-
 7 files changed, 21 insertions(+), 163 deletions(-)
 delete mode 100644 patches/Django-1.8.7/0001-Fixed-25322-Lazily-compiled-core.validators-regular-.patch
 delete mode 100644 patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch
 delete mode 100644 patches/Django-1.8.7/series
 create mode 100644 patches/Django-2.2.16/0001-Removed-executable-bit-from-static-asset-xregexp.js.patch
 create mode 100644 patches/Django-2.2.16/series

diff --git a/patches/Django-1.8.7/0001-Fixed-25322-Lazily-compiled-core.validators-regular-.patch b/patches/Django-1.8.7/0001-Fixed-25322-Lazily-compiled-core.validators-regular-.patch
deleted file mode 100644
index 3c3b0eac4..000000000
--- a/patches/Django-1.8.7/0001-Fixed-25322-Lazily-compiled-core.validators-regular-.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From 1753a76267a4dda6858d117858f233c0ed662a7f Mon Sep 17 00:00:00 2001
-From: Jonas Haag <jonas@lophus.org>
-Date: Wed, 26 Aug 2015 09:12:05 +0200
-Subject: [PATCH 1/1] Fixed #25322 -- Lazily compiled core.validators regular
- expressions.
-
-This speeds up import of 'django.core.validators' which can save a
-few hundred milliseconds when importing the module for the first
-time. It can be a significant speedup to the django-admin command.
----
- django/core/validators.py | 34 +++++++++++++++++++++++-----------
- 1 file changed, 23 insertions(+), 11 deletions(-)
-
-diff --git a/django/core/validators.py b/django/core/validators.py
-index 89d184f..7719b40 100644
---- a/django/core/validators.py
-+++ b/django/core/validators.py
-@@ -6,6 +6,7 @@ from django.core.exceptions import ValidationError
- from django.utils import six
- from django.utils.deconstruct import deconstructible
- from django.utils.encoding import force_text
-+from django.utils.functional import SimpleLazyObject
- from django.utils.ipv6 import is_valid_ipv6_address
- from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit
- from django.utils.translation import ugettext_lazy as _, ungettext_lazy
-@@ -14,6 +15,18 @@ from django.utils.translation import ugettext_lazy as _, ungettext_lazy
- EMPTY_VALUES = (None, '', [], (), {})
- 
- 
-+def _lazy_re_compile(regex, flags=0):
-+    """Lazily compile a regex with flags."""
-+    def _compile():
-+        # Compile the regex if it was not passed pre-compiled.
-+        if isinstance(regex, six.string_types):
-+            return re.compile(regex, flags)
-+        else:
-+            assert not flags, "flags must be empty if regex is passed pre-compiled"
-+            return regex
-+    return SimpleLazyObject(_compile)
-+
-+
- @deconstructible
- class RegexValidator(object):
-     regex = ''
-@@ -36,9 +49,7 @@ class RegexValidator(object):
-         if self.flags and not isinstance(self.regex, six.string_types):
-             raise TypeError("If the flags are set, regex must be a regular expression string.")
- 
--        # Compile the regex if it was not passed pre-compiled.
--        if isinstance(self.regex, six.string_types):
--            self.regex = re.compile(self.regex, self.flags)
-+        self.regex = _lazy_re_compile(self.regex, self.flags)
- 
-     def __call__(self, value):
-         """
-@@ -77,7 +88,7 @@ class URLValidator(RegexValidator):
-     tld_re = r'\.(?:[a-z' + ul + r']{2,}|xn--[a-z0-9]+)\.?'
-     host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
- 
--    regex = re.compile(
-+    regex = _lazy_re_compile(
-         r'^(?:[a-z0-9\.\-]*)://'  # scheme is validated separately
-         r'(?:\S+(?::\S*)?@)?'  # user:pass authentication
-         r'(?:' + ipv4_re + '|' + ipv6_re + '|' + host_re + ')'
-@@ -126,7 +137,7 @@ class URLValidator(RegexValidator):
-             url = value
- 
- integer_validator = RegexValidator(
--    re.compile('^-?\d+\Z'),
-+    _lazy_re_compile('^-?\d+\Z'),
-     message=_('Enter a valid integer.'),
-     code='invalid',
- )
-@@ -140,16 +151,17 @@ def validate_integer(value):
- class EmailValidator(object):
-     message = _('Enter a valid email address.')
-     code = 'invalid'
--    user_regex = re.compile(
-+
-+    user_regex = _lazy_re_compile(
-         r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\Z"  # dot-atom
-         r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)',  # quoted-string
-         re.IGNORECASE)
--    domain_regex = re.compile(
-+    domain_regex = _lazy_re_compile(
-         # max length of the domain is 249: 254 (max email length) minus one
-         # period, two characters for the TLD, @ sign, & one character before @.
-         r'(?:[A-Z0-9](?:[A-Z0-9-]{0,247}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))\Z',
-         re.IGNORECASE)
--    literal_regex = re.compile(
-+    literal_regex = _lazy_re_compile(
-         # literal form, ipv4 or ipv6 address (SMTP 4.1.3)
-         r'\[([A-f0-9:\.]+)\]\Z',
-         re.IGNORECASE)
-@@ -209,14 +221,14 @@ class EmailValidator(object):
- 
- validate_email = EmailValidator()
- 
--slug_re = re.compile(r'^[-a-zA-Z0-9_]+\Z')
-+slug_re = _lazy_re_compile(r'^[-a-zA-Z0-9_]+\Z')
- validate_slug = RegexValidator(
-     slug_re,
-     _("Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."),
-     'invalid'
- )
- 
--ipv4_re = re.compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\Z')
-+ipv4_re = _lazy_re_compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\Z')
- validate_ipv4_address = RegexValidator(ipv4_re, _('Enter a valid IPv4 address.'), 'invalid')
- 
- 
-@@ -257,7 +269,7 @@ def ip_address_validators(protocol, unpack_ipv4):
-         raise ValueError("The protocol '%s' is unknown. Supported: %s"
-                          % (protocol, list(ip_address_validator_map)))
- 
--comma_separated_int_list_re = re.compile('^[\d,]+\Z')
-+comma_separated_int_list_re = _lazy_re_compile('^[\d,]+\Z')
- validate_comma_separated_integer_list = RegexValidator(
-     comma_separated_int_list_re,
-     _('Enter only digits separated by commas.'),
--- 
-2.6.4
-
diff --git a/patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch b/patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch
deleted file mode 100644
index a1dc20dff..000000000
--- a/patches/Django-1.8.7/0002-MigrationLoader-search-for-.py-c.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 65d28e3e9a47ad270e7017b6b2b269978c01c428 Mon Sep 17 00:00:00 2001
-From: Florian Scherf <f.scherf@pengutronix.de>
-Date: Wed, 3 Feb 2016 17:32:32 +0100
-Subject: [PATCH] MigrationLoader: search for *.py(c)
-
-The MigrationLoader originally searchs for *.py but we
-are running *.pyc only.
-Without this patch "./manage.py migrate" will crash.
-
-Signed-off-by: Florian Scherf <f.scherf@pengutronix.de>
----
- django/db/migrations/loader.py | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
-index bbd60a6..77b50fd 100644
---- a/django/db/migrations/loader.py
-+++ b/django/db/migrations/loader.py
-@@ -88,10 +88,12 @@ class MigrationLoader(object):
-                     six.moves.reload_module(module)
-             self.migrated_apps.add(app_config.label)
-             directory = os.path.dirname(module.__file__)
--            # Scan for .py files
-+            # Scan for .py(c) files
-             migration_names = set()
-             for name in os.listdir(directory):
--                if name.endswith(".py"):
-+                root, ext = os.path.splitext(name)
-+
-+                if ext in ['.py', '.pyc']:
-                     import_name = name.rsplit(".", 1)[0]
-                     if import_name[0] not in "_.~":
-                         migration_names.add(import_name)
--- 
-2.7.0.rc3
-
diff --git a/patches/Django-1.8.7/series b/patches/Django-1.8.7/series
deleted file mode 100644
index c644f907c..000000000
--- a/patches/Django-1.8.7/series
+++ /dev/null
@@ -1,2 +0,0 @@
-0001-Fixed-25322-Lazily-compiled-core.validators-regular-.patch
-0002-MigrationLoader-search-for-.py-c.patch
diff --git a/patches/Django-2.2.16/0001-Removed-executable-bit-from-static-asset-xregexp.js.patch b/patches/Django-2.2.16/0001-Removed-executable-bit-from-static-asset-xregexp.js.patch
new file mode 100644
index 000000000..32a46732a
--- /dev/null
+++ b/patches/Django-2.2.16/0001-Removed-executable-bit-from-static-asset-xregexp.js.patch
@@ -0,0 +1,12 @@
+From: Jon Dufresne <jon.dufresne@gmail.com>
+Date: Mon, 4 Mar 2019 07:35:08 -0800
+Subject: [PATCH] Removed executable bit from static asset xregexp.js.
+
+---
+ django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ mode change 100755 => 100644 django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js
+
+diff --git a/django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js b/django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js
+old mode 100755
+new mode 100644
diff --git a/patches/Django-2.2.16/series b/patches/Django-2.2.16/series
new file mode 100644
index 000000000..e61afe47a
--- /dev/null
+++ b/patches/Django-2.2.16/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Removed-executable-bit-from-static-asset-xregexp.js.patch
+# ab8842e97b440ebf0ed66068f3c8f29c  - git-ptx-patches magic
diff --git a/rules/python3-django.in b/rules/python3-django.in
index 0475108bd..e55bfa582 100644
--- a/rules/python3-django.in
+++ b/rules/python3-django.in
@@ -3,6 +3,9 @@
 menuconfig PYTHON3_DJANGO
 	tristate
 	select PYTHON3
+	select PYTHON3_DISTUTILS	if RUNTIME
+	select PYTHON3_PYTZ		if RUNTIME
+	select PYTHON3_SQLPARSE		if RUNTIME
 	prompt "django                        "
 	help
 	  Django is a high-level Python Web framework that encourages rapid
diff --git a/rules/python3-django.make b/rules/python3-django.make
index ffc73a4b8..64dc291ad 100644
--- a/rules/python3-django.make
+++ b/rules/python3-django.make
@@ -14,8 +14,8 @@ PACKAGES-$(PTXCONF_PYTHON3_DJANGO) += python3-django
 #
 # Paths and names
 #
-PYTHON3_DJANGO_VERSION	:= 1.8.7
-PYTHON3_DJANGO_MD5	:= 44c01355b5efa01938a89b8bd798b1ed
+PYTHON3_DJANGO_VERSION	:= 2.2.16
+PYTHON3_DJANGO_MD5	:= 93faf5bbd54a19ea49f4932a813b9758
 PYTHON3_DJANGO		:= Django-$(PYTHON3_DJANGO_VERSION)
 PYTHON3_DJANGO_SUFFIX	:= tar.gz
 PYTHON3_DJANGO_URL	:= https://www.djangoproject.com/download/$(PYTHON3_DJANGO_VERSION)/tarball/
-- 
2.28.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-06  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24  7:54 [ptxdist] [PATCH v4] python3-django: version bump 1.8.7 -> 2.2.16 Bastian Krause
2020-10-06  8:18 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox