diff options
Diffstat (limited to 'meta-python/recipes-devtools/python')
8 files changed, 232 insertions, 20 deletions
diff --git a/meta-python/recipes-devtools/python/python3-django.inc b/meta-python/recipes-devtools/python/python3-django.inc index c6475d2079..589f6a5b85 100644 --- a/meta-python/recipes-devtools/python/python3-django.inc +++ b/meta-python/recipes-devtools/python/python3-django.inc | |||
| @@ -6,13 +6,16 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=f09eb47206614a4954c51db8a94840fa" | |||
| 6 | PYPI_PACKAGE = "django" | 6 | PYPI_PACKAGE = "django" |
| 7 | UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}" | 7 | UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}" |
| 8 | 8 | ||
| 9 | inherit pypi | 9 | inherit pypi ptest |
| 10 | |||
| 11 | SRC_URI += "file://run-ptest" | ||
| 10 | 12 | ||
| 11 | FILES:${PN} += "${datadir}/django" | 13 | FILES:${PN} += "${datadir}/django" |
| 12 | 14 | ||
| 13 | BBCLASSEXTEND = "native nativesdk" | 15 | BBCLASSEXTEND = "native nativesdk" |
| 14 | 16 | ||
| 15 | RDEPENDS:${PN} += "\ | 17 | RDEPENDS:${PN} += "\ |
| 18 | python3-asgiref \ | ||
| 16 | python3-compression \ | 19 | python3-compression \ |
| 17 | python3-ctypes \ | 20 | python3-ctypes \ |
| 18 | python3-datetime \ | 21 | python3-datetime \ |
| @@ -25,9 +28,37 @@ RDEPENDS:${PN} += "\ | |||
| 25 | python3-numbers \ | 28 | python3-numbers \ |
| 26 | python3-pkgutil \ | 29 | python3-pkgutil \ |
| 27 | python3-pytz \ | 30 | python3-pytz \ |
| 31 | python3-sqlparse \ | ||
| 28 | python3-threading \ | 32 | python3-threading \ |
| 29 | python3-unixadmin \ | 33 | python3-unixadmin \ |
| 30 | python3-xml \ | 34 | python3-xml \ |
| 31 | " | 35 | " |
| 32 | 36 | ||
| 33 | CVE_PRODUCT = "django" | 37 | CVE_PRODUCT = "django" |
| 38 | |||
| 39 | do_install_ptest(){ | ||
| 40 | install -d ${D}${PTEST_PATH}//docs/_ext | ||
| 41 | install -m 0644 ${S}/docs/_ext/github_links.py ${D}${PTEST_PATH}/docs/_ext | ||
| 42 | |||
| 43 | cp -r ${S}/tests ${D}${PTEST_PATH} | ||
| 44 | sed -i 's,/usr/bin/env python,/usr/bin/env python3,' ${D}${PTEST_PATH}/tests/runtests.py | ||
| 45 | ln -sr ${D}${libdir}/python3.*/site-packages/django ${D}${PTEST_PATH}/django | ||
| 46 | } | ||
| 47 | |||
| 48 | RDEPENDS:${PN}-ptest += " \ | ||
| 49 | gettext \ | ||
| 50 | python3-bcrypt \ | ||
| 51 | python3-compile \ | ||
| 52 | python3-docutils \ | ||
| 53 | python3-fcntl \ | ||
| 54 | python3-jinja2 \ | ||
| 55 | python3-misc \ | ||
| 56 | python3-numpy \ | ||
| 57 | python3-pillow \ | ||
| 58 | python3-pyyaml \ | ||
| 59 | python3-sqlite3 \ | ||
| 60 | python3-statistics \ | ||
| 61 | python3-tblib \ | ||
| 62 | python3-zoneinfo \ | ||
| 63 | tzdata \ | ||
| 64 | " | ||
diff --git a/meta-python/recipes-devtools/python/python3-django/0001-Fix-test_strip_tags-test.patch b/meta-python/recipes-devtools/python/python3-django/0001-Fix-test_strip_tags-test.patch new file mode 100644 index 0000000000..f77c3b963a --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-django/0001-Fix-test_strip_tags-test.patch | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | From 7b80b2186300620931009fd62c2969f108fe7a62 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jacob Walls <jacobtylerwalls@gmail.com> | ||
| 3 | Date: Thu, 11 Dec 2025 08:44:19 -0500 | ||
| 4 | Subject: [PATCH] Refs #36499 -- Adjusted test_strip_tags following Python | ||
| 5 | behavior change for incomplete entities. | ||
| 6 | |||
| 7 | Upstream-Status: Backport [https://github.com/django/django/commit/7b80b2186300620931009fd62c2969f108fe7a62] | ||
| 8 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 9 | --- | ||
| 10 | tests/utils_tests/test_html.py | 25 ++++++++++++++++++++----- | ||
| 11 | 1 file changed, 20 insertions(+), 5 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py | ||
| 14 | index 7412c2624c73..ee115aaf1cf2 100644 | ||
| 15 | --- a/tests/utils_tests/test_html.py | ||
| 16 | +++ b/tests/utils_tests/test_html.py | ||
| 17 | @@ -1,3 +1,4 @@ | ||
| 18 | +import math | ||
| 19 | import os | ||
| 20 | import sys | ||
| 21 | from datetime import datetime | ||
| 22 | @@ -124,7 +125,7 @@ | ||
| 23 | # old and new results. The check below is temporary until all supported | ||
| 24 | # Python versions and CI workers include the fix. See: | ||
| 25 | # https://github.com/python/cpython/commit/6eb6c5db | ||
| 26 | - min_fixed = { | ||
| 27 | + min_fixed_security = { | ||
| 28 | (3, 14): (3, 14), | ||
| 29 | (3, 13): (3, 13, 6), | ||
| 30 | (3, 12): (3, 12, 12), | ||
| 31 | @@ -132,7 +133,21 @@ | ||
| 32 | (3, 10): (3, 10, 19), | ||
| 33 | (3, 9): (3, 9, 24), | ||
| 34 | } | ||
| 35 | - htmlparser_fixed = sys.version_info >= min_fixed[sys.version_info[:2]] | ||
| 36 | + # Similarly, there was a fix for terminating incomplete entities. See: | ||
| 37 | + # https://github.com/python/cpython/commit/95296a9d | ||
| 38 | + min_fixed_incomplete_entities = { | ||
| 39 | + (3, 14): (3, 14, 1), | ||
| 40 | + (3, 13): (3, 13, 10), | ||
| 41 | + (3, 12): (3, 12, math.inf), # not fixed in 3.12. | ||
| 42 | + } | ||
| 43 | + major_version = sys.version_info[:2] | ||
| 44 | + htmlparser_fixed_security = sys.version_info >= min_fixed_security.get( | ||
| 45 | + major_version, major_version | ||
| 46 | + ) | ||
| 47 | + htmlparser_fixed_incomplete_entities = ( | ||
| 48 | + sys.version_info | ||
| 49 | + >= min_fixed_incomplete_entities.get(major_version, major_version) | ||
| 50 | + ) | ||
| 51 | items = ( | ||
| 52 | ( | ||
| 53 | "<p>See: 'é is an apostrophe followed by e acute</p>", | ||
| 54 | @@ -159,16 +174,19 @@ | ||
| 55 | # https://bugs.python.org/issue20288 | ||
| 56 | ("&gotcha&#;<>", "&gotcha&#;<>"), | ||
| 57 | ("<sc<!-- -->ript>test<<!-- -->/script>", "ript>test"), | ||
| 58 | - ("<script>alert()</script>&h", "alert()h"), | ||
| 59 | + ( | ||
| 60 | + "<script>alert()</script>&h", | ||
| 61 | + "alert()&h;" if htmlparser_fixed_incomplete_entities else "alert()h", | ||
| 62 | + ), | ||
| 63 | ( | ||
| 64 | "><!" + ("&" * 16000) + "D", | ||
| 65 | - ">" if htmlparser_fixed else "><!" + ("&" * 16000) + "D", | ||
| 66 | + ">" if htmlparser_fixed_security else "><!" + ("&" * 16000) + "D", | ||
| 67 | ), | ||
| 68 | ("X<<<<br>br>br>br>X", "XX"), | ||
| 69 | ("<" * 50 + "a>" * 50, ""), | ||
| 70 | ( | ||
| 71 | ">" + "<a" * 500 + "a", | ||
| 72 | - ">" if htmlparser_fixed else ">" + "<a" * 500 + "a", | ||
| 73 | + ">" if htmlparser_fixed_security else ">" + "<a" * 500 + "a", | ||
| 74 | ), | ||
| 75 | ("<a" * 49 + "a" * 951, "<a" * 49 + "a" * 951), | ||
| 76 | ("<" + "a" * 1_002, "<" + "a" * 1_002), | ||
diff --git a/meta-python/recipes-devtools/python/python3-django/0001-fix-test_msgfmt_error_including_non_ascii-test.patch b/meta-python/recipes-devtools/python/python3-django/0001-fix-test_msgfmt_error_including_non_ascii-test.patch new file mode 100644 index 0000000000..6f887b3015 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-django/0001-fix-test_msgfmt_error_including_non_ascii-test.patch | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | From 1960ecd879ce351226b36e7ac0aa25616241b6f6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jericho Serrano <118679068+jericho1050@users.noreply.github.com> | ||
| 3 | Date: Fri, 6 Jun 2025 04:58:29 +0800 | ||
| 4 | Subject: [PATCH] Fixed #36421 -- Made test_msgfmt_error_including_non_ascii | ||
| 5 | compatible with msgfmt 0.25. | ||
| 6 | |||
| 7 | Upstream-Status: Backport [https://github.com/django/django/commit/1960ecd879ce351226b36e7ac0aa25616241b6f6] | ||
| 8 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 9 | --- | ||
| 10 | tests/i18n/test_compilation.py | 25 +++++++++++++++++++++++-- | ||
| 11 | 1 file changed, 23 insertions(+), 2 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py | ||
| 14 | index 4b0bb9f6bb16..3a57dbf0765f 100644 | ||
| 15 | --- a/tests/i18n/test_compilation.py | ||
| 16 | +++ b/tests/i18n/test_compilation.py | ||
| 17 | @@ -1,5 +1,6 @@ | ||
| 18 | import gettext as gettext_module | ||
| 19 | import os | ||
| 20 | +import re | ||
| 21 | import stat | ||
| 22 | import unittest | ||
| 23 | from io import StringIO | ||
| 24 | @@ -8,10 +9,12 @@ | ||
| 25 | from unittest import mock | ||
| 26 | |||
| 27 | from django.core.management import CommandError, call_command, execute_from_command_line | ||
| 28 | -from django.core.management.utils import find_command | ||
| 29 | +from django.core.management.utils import find_command, popen_wrapper | ||
| 30 | from django.test import SimpleTestCase, override_settings | ||
| 31 | from django.test.utils import captured_stderr, captured_stdout | ||
| 32 | from django.utils import translation | ||
| 33 | +from django.utils.encoding import DEFAULT_LOCALE_ENCODING | ||
| 34 | +from django.utils.functional import cached_property | ||
| 35 | from django.utils.translation import gettext | ||
| 36 | |||
| 37 | from .utils import RunInTmpDirMixin, copytree | ||
| 38 | @@ -254,6 +257,17 @@ def test_no_dirs_accidentally_skipped(self): | ||
| 39 | |||
| 40 | |||
| 41 | class CompilationErrorHandling(MessageCompilationTests): | ||
| 42 | + @cached_property | ||
| 43 | + def msgfmt_version(self): | ||
| 44 | + # Note that msgfmt is installed via GNU gettext tools, hence the msgfmt | ||
| 45 | + # version should align to gettext. | ||
| 46 | + out, err, status = popen_wrapper( | ||
| 47 | + ["msgfmt", "--version"], | ||
| 48 | + stdout_encoding=DEFAULT_LOCALE_ENCODING, | ||
| 49 | + ) | ||
| 50 | + m = re.search(r"(\d+)\.(\d+)\.?(\d+)?", out) | ||
| 51 | + return tuple(int(d) for d in m.groups() if d is not None) | ||
| 52 | + | ||
| 53 | def test_error_reported_by_msgfmt(self): | ||
| 54 | # po file contains wrong po formatting. | ||
| 55 | with self.assertRaises(CommandError): | ||
| 56 | @@ -278,7 +292,14 @@ def test_msgfmt_error_including_non_ascii(self): | ||
| 57 | call_command( | ||
| 58 | "compilemessages", locale=["ko"], stdout=StringIO(), stderr=stderr | ||
| 59 | ) | ||
| 60 | - self.assertIn("' cannot start a field name", stderr.getvalue()) | ||
| 61 | + if self.msgfmt_version < (0, 25): | ||
| 62 | + error_msg = "' cannot start a field name" | ||
| 63 | + else: | ||
| 64 | + error_msg = ( | ||
| 65 | + "a field name starts with a character that is not alphanumerical " | ||
| 66 | + "or underscore" | ||
| 67 | + ) | ||
| 68 | + self.assertIn(error_msg, stderr.getvalue()) | ||
| 69 | |||
| 70 | |||
| 71 | class ProjectAndAppTests(MessageCompilationTests): | ||
diff --git a/meta-python/recipes-devtools/python/python3-django/run-ptest b/meta-python/recipes-devtools/python/python3-django/run-ptest new file mode 100644 index 0000000000..dd257cc843 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-django/run-ptest | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | useradd tester || echo test user exists already | ||
| 3 | |||
| 4 | # We need $(pwd), because some tests import modules from the actual tests folder | ||
| 5 | # Also, there is one module in the docs/_ext folder that is imported, and that | ||
| 6 | # module accesses other modules by a relative path to itself. | ||
| 7 | export PYTHONPATH=$(pwd):$(pwd)/docs/_ext:$PYTHONPATH | ||
| 8 | |||
| 9 | cd tests | ||
| 10 | |||
| 11 | su tester -c "./runtests.py --noinput -v 2" 2>&1 | \ | ||
| 12 | tee ../testoutput.log | \ | ||
| 13 | sed -e '/\.\.\. ok/ s/^/PASS: /g' \ | ||
| 14 | -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g' \ | ||
| 15 | -e '/\.\.\. skipped/ s/^/SKIP: /g' \ | ||
| 16 | -e 's/ \.\.\. ok//g' \ | ||
| 17 | -e 's/ \.\.\. ERROR//g' \ | ||
| 18 | -e 's/ \.\.\. FAIL//g' \ | ||
| 19 | -e 's/ \.\.\. skipped//g' | ||
diff --git a/meta-python/recipes-devtools/python/python3-django_4.2.27.bb b/meta-python/recipes-devtools/python/python3-django_4.2.27.bb deleted file mode 100644 index 86425ca724..0000000000 --- a/meta-python/recipes-devtools/python/python3-django_4.2.27.bb +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | require python3-django.inc | ||
| 2 | inherit python_setuptools_build_meta | ||
| 3 | |||
| 4 | SRC_URI[sha256sum] = "b865fbe0f4a3d1ee36594c5efa42b20db3c8bbb10dff0736face1c6e4bda5b92" | ||
| 5 | |||
| 6 | RDEPENDS:${PN} += "\ | ||
| 7 | python3-sqlparse \ | ||
| 8 | python3-asgiref \ | ||
| 9 | " | ||
| 10 | |||
| 11 | # Set DEFAULT_PREFERENCE so that the LTS version of django is built by | ||
| 12 | # default. To build the 4.x branch, | ||
| 13 | # PREFERRED_VERSION_python3-django = "4.2.%" can be added to local.conf | ||
| 14 | DEFAULT_PREFERENCE = "-1" | ||
diff --git a/meta-python/recipes-devtools/python/python3-django_5.2.9.bb b/meta-python/recipes-devtools/python/python3-django_5.2.9.bb index c0aff44a78..11f438d623 100644 --- a/meta-python/recipes-devtools/python/python3-django_5.2.9.bb +++ b/meta-python/recipes-devtools/python/python3-django_5.2.9.bb | |||
| @@ -1,9 +1,7 @@ | |||
| 1 | require python3-django.inc | 1 | require python3-django.inc |
| 2 | inherit python_setuptools_build_meta | 2 | inherit python_setuptools_build_meta |
| 3 | 3 | ||
| 4 | SRC_URI[sha256sum] = "16b5ccfc5e8c27e6c0561af551d2ea32852d7352c67d452ae3e76b4f6b2ca495" | 4 | SRC_URI += "file://0001-fix-test_msgfmt_error_including_non_ascii-test.patch \ |
| 5 | 5 | file://0001-Fix-test_strip_tags-test.patch \ | |
| 6 | RDEPENDS:${PN} += "\ | ||
| 7 | python3-sqlparse \ | ||
| 8 | python3-asgiref \ | ||
| 9 | " | 6 | " |
| 7 | SRC_URI[sha256sum] = "16b5ccfc5e8c27e6c0561af551d2ea32852d7352c67d452ae3e76b4f6b2ca495" | ||
diff --git a/meta-python/recipes-devtools/python/python3-django_6.0.1.bb b/meta-python/recipes-devtools/python/python3-django_6.0.1.bb new file mode 100644 index 0000000000..9642a3c581 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-django_6.0.1.bb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | require python3-django.inc | ||
| 2 | inherit python_setuptools_build_meta | ||
| 3 | |||
| 4 | SRC_URI[sha256sum] = "ed76a7af4da21551573b3d9dfc1f53e20dd2e6c7d70a3adc93eedb6338130a5f" | ||
| 5 | |||
| 6 | # Set DEFAULT_PREFERENCE so that the LTS version of django is built by | ||
| 7 | # default. To build the 6.x branch, | ||
| 8 | # PREFERRED_VERSION_python3-django = "6.0.%" can be added to local.conf | ||
| 9 | DEFAULT_PREFERENCE = "-1" | ||
diff --git a/meta-python/recipes-devtools/python/python3-tblib_3.2.2.bb b/meta-python/recipes-devtools/python/python3-tblib_3.2.2.bb new file mode 100644 index 0000000000..ae3ba730c5 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-tblib_3.2.2.bb | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | SUMMARY = "Serialization library for Exceptions and Tracebacks." | ||
| 2 | HOMEPAGE = "https://github.com/ionelmc/python-tblib" | ||
| 3 | LICENSE = "BSD-2-Clause" | ||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=810c4c43873f8d9331fb067a6473a960" | ||
| 5 | |||
| 6 | inherit pypi python_setuptools_build_meta ptest-python-pytest | ||
| 7 | |||
| 8 | SRC_URI[sha256sum] = "e9a652692d91bf4f743d4a15bc174c0b76afc750fe8c7b6d195cc1c1d6d2ccec" | ||
| 9 | |||
| 10 | do_install_ptest:append(){ | ||
| 11 | install -m 0644 ${S}/pytest.ini ${D}${PTEST_PATH} | ||
| 12 | # The tests are comparing exception outputs with expected ones, and it doesn't | ||
| 13 | # expect carets in the exception. | ||
| 14 | sed -i 's/pytest/PYTHONNODEBUGRANGES=1 pytest/' ${D}${PTEST_PATH}/run-ptest | ||
| 15 | } | ||
| 16 | |||
| 17 | RDEPENDS:${PN}-ptest += " \ | ||
| 18 | python3-misc \ | ||
| 19 | python3-pytest-benchmark \ | ||
| 20 | python3-statistics \ | ||
| 21 | python3-twisted \ | ||
| 22 | " | ||
