diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2025-01-08 17:49:16 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-09 16:59:23 +0000 |
| commit | 335889b6195152c83547d63aa44bd3c33f8b8931 (patch) | |
| tree | 8f79486a09ff01d89921321a86527f6a9e79612a | |
| parent | 5ffd270c606862f55a7e77fe2a882c68aa221bb2 (diff) | |
| download | poky-335889b6195152c83547d63aa44bd3c33f8b8931.tar.gz | |
python3-jinja2: upgrade 3.1.4 -> 3.1.5
(From OE-Core rev: fca4fe9282d5895cc961aef82471604d219cb3ba)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/python/python3-jinja2/fix-3.13.patch | 87 | ||||
| -rw-r--r-- | meta/recipes-devtools/python/python3-jinja2_3.1.5.bb (renamed from meta/recipes-devtools/python/python3-jinja2_3.1.4.bb) | 9 |
2 files changed, 5 insertions, 91 deletions
diff --git a/meta/recipes-devtools/python/python3-jinja2/fix-3.13.patch b/meta/recipes-devtools/python/python3-jinja2/fix-3.13.patch deleted file mode 100644 index 34ecd15176..0000000000 --- a/meta/recipes-devtools/python/python3-jinja2/fix-3.13.patch +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | From cf6ba7732b49ab4637aa747186cf1d1572688584 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Thomas Grainger <tagrain@gmail.com> | ||
| 3 | Date: Mon, 13 May 2024 18:02:35 +0100 | ||
| 4 | Subject: [PATCH] fix test_package_zip_list on 3.13 | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/pallets/jinja/pull/1979] | ||
| 7 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
| 8 | --- | ||
| 9 | src/jinja2/loaders.py | 32 ++++++++++++++++++++++++++------ | ||
| 10 | tests/test_loader.py | 4 ++-- | ||
| 11 | 2 files changed, 28 insertions(+), 8 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/src/jinja2/loaders.py b/src/jinja2/loaders.py | ||
| 14 | index 9eaf647..8c2c86c 100644 | ||
| 15 | --- a/src/jinja2/loaders.py | ||
| 16 | +++ b/src/jinja2/loaders.py | ||
| 17 | @@ -238,6 +238,30 @@ class FileSystemLoader(BaseLoader): | ||
| 18 | return sorted(found) | ||
| 19 | |||
| 20 | |||
| 21 | +if sys.version_info >= (3, 13): | ||
| 22 | + | ||
| 23 | + def _get_zipimporter_files(z: t.Any) -> t.Dict[str, object]: | ||
| 24 | + try: | ||
| 25 | + get_files = z._get_files | ||
| 26 | + except AttributeError as e: | ||
| 27 | + raise TypeError( | ||
| 28 | + "This zip import does not have the required" | ||
| 29 | + " metadata to list templates." | ||
| 30 | + ) from e | ||
| 31 | + return get_files() | ||
| 32 | +else: | ||
| 33 | + | ||
| 34 | + def _get_zipimporter_files(z: t.Any) -> t.Dict[str, object]: | ||
| 35 | + try: | ||
| 36 | + files = z._files | ||
| 37 | + except AttributeError as e: | ||
| 38 | + raise TypeError( | ||
| 39 | + "This zip import does not have the required" | ||
| 40 | + " metadata to list templates." | ||
| 41 | + ) from e | ||
| 42 | + return files # type: ignore[no-any-return] | ||
| 43 | + | ||
| 44 | + | ||
| 45 | class PackageLoader(BaseLoader): | ||
| 46 | """Load templates from a directory in a Python package. | ||
| 47 | |||
| 48 | @@ -382,11 +406,7 @@ class PackageLoader(BaseLoader): | ||
| 49 | for name in filenames | ||
| 50 | ) | ||
| 51 | else: | ||
| 52 | - if not hasattr(self._loader, "_files"): | ||
| 53 | - raise TypeError( | ||
| 54 | - "This zip import does not have the required" | ||
| 55 | - " metadata to list templates." | ||
| 56 | - ) | ||
| 57 | + files = _get_zipimporter_files(self._loader) | ||
| 58 | |||
| 59 | # Package is a zip file. | ||
| 60 | prefix = ( | ||
| 61 | @@ -395,7 +415,7 @@ class PackageLoader(BaseLoader): | ||
| 62 | ) | ||
| 63 | offset = len(prefix) | ||
| 64 | |||
| 65 | - for name in self._loader._files.keys(): | ||
| 66 | + for name in files: | ||
| 67 | # Find names under the templates directory that aren't directories. | ||
| 68 | if name.startswith(prefix) and name[-1] != os.path.sep: | ||
| 69 | results.append(name[offset:].replace(os.path.sep, "/")) | ||
| 70 | diff --git a/tests/test_loader.py b/tests/test_loader.py | ||
| 71 | index 77d686e..e0683e4 100644 | ||
| 72 | --- a/tests/test_loader.py | ||
| 73 | +++ b/tests/test_loader.py | ||
| 74 | @@ -364,8 +364,8 @@ def test_package_zip_source(package_zip_loader, template, expect): | ||
| 75 | |||
| 76 | |||
| 77 | @pytest.mark.xfail( | ||
| 78 | - platform.python_implementation() == "PyPy", | ||
| 79 | - reason="PyPy's zipimporter doesn't have a '_files' attribute.", | ||
| 80 | + sys.implementation.name == "pypy", | ||
| 81 | + reason="zipimporter doesn't have a '_files' attribute", | ||
| 82 | raises=TypeError, | ||
| 83 | ) | ||
| 84 | def test_package_zip_list(package_zip_loader): | ||
| 85 | -- | ||
| 86 | 2.39.5 | ||
| 87 | |||
diff --git a/meta/recipes-devtools/python/python3-jinja2_3.1.4.bb b/meta/recipes-devtools/python/python3-jinja2_3.1.5.bb index 84c40796c6..b9ef57f599 100644 --- a/meta/recipes-devtools/python/python3-jinja2_3.1.4.bb +++ b/meta/recipes-devtools/python/python3-jinja2_3.1.5.bb | |||
| @@ -4,7 +4,7 @@ HOMEPAGE = "https://pypi.org/project/Jinja2/" | |||
| 4 | LICENSE = "BSD-3-Clause" | 4 | LICENSE = "BSD-3-Clause" |
| 5 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=5dc88300786f1c214c1e9827a5229462" | 5 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=5dc88300786f1c214c1e9827a5229462" |
| 6 | 6 | ||
| 7 | SRC_URI[sha256sum] = "4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369" | 7 | SRC_URI[sha256sum] = "8fefff8dc3034e27bb80d67c671eb8a9bc424c0ef4c0826edbff304cceff43bb" |
| 8 | 8 | ||
| 9 | PYPI_PACKAGE = "jinja2" | 9 | PYPI_PACKAGE = "jinja2" |
| 10 | 10 | ||
| @@ -14,9 +14,10 @@ CLEANBROKEN = "1" | |||
| 14 | 14 | ||
| 15 | inherit pypi python_flit_core ptest-python-pytest | 15 | inherit pypi python_flit_core ptest-python-pytest |
| 16 | 16 | ||
| 17 | SRC_URI += " \ | 17 | do_install_ptest:append() { |
| 18 | file://fix-3.13.patch \ | 18 | # test_async items require trio module |
| 19 | " | 19 | rm -f ${D}${PTEST_PATH}/tests/test_async.py ${D}${PTEST_PATH}/tests/test_async_filters.py |
| 20 | } | ||
| 20 | 21 | ||
| 21 | RDEPENDS:${PN}-ptest += " \ | 22 | RDEPENDS:${PN}-ptest += " \ |
| 22 | python3-unixadmin \ | 23 | python3-unixadmin \ |
