From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: From: Bastian Krause Date: Thu, 24 Sep 2020 09:54:05 +0200 Message-Id: <20200924075405.28209-1-bst@pengutronix.de> MIME-Version: 1.0 Subject: [ptxdist] [PATCH v4] python3-django: version bump 1.8.7 -> 2.2.16 List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de 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 --- 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 -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,}(? -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 ---- - 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 +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