mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-15 08:56:58 +02:00
dev-python/jinja2: Sync with Gentoo
It's from Gentoo commit 336345316628860e8b25582f8d4745456461e776.
This commit is contained in:
parent
86a343017a
commit
54c4817e22
@ -1 +1 @@
|
||||
DIST jinja2-3.1.4.tar.gz 240245 BLAKE2B cb70699cea93ddf53b7c8876b9006cc70599d49f8c64ab615759a53db6829cab7b55ac673777bc4c8dc5dfc68efada29d37f47fe7cf449044721f659fe6a654d SHA512 d07d68a2687af68c705d3b7f5a2c67aca7b9d125316b15085888b9d0d6e769981af76f6f524728b89b5501bd671d518fcb2638f9ae112e57ca2bf2a53482cd89
|
||||
DIST jinja2-3.1.5.tar.gz 244674 BLAKE2B 0b3f44e5d3a5f3d898d0b678035ddaaeb30f1f7ca09555da93adbb8d7f7159a3e192809f69f47c21ce5be6f4fb1cc91bc35d4d62f2c38c71582210085091b3d7 SHA512 75ad0094482c69d45fcd3aa8ee32e249931e53fee3f804f6ddfd5b6da0ed16962d8f1fced811e7dcb4d8401fadd828e77528d6d1280547a7d4f5f77cccf9bbd4
|
||||
|
@ -1,67 +0,0 @@
|
||||
From 679af7f816ced8941ed5cf9b151a0cac543d0336 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Grainger <tagrain@gmail.com>
|
||||
Date: Mon, 13 May 2024 18:02:35 +0100
|
||||
Subject: [PATCH] fix test_package_zip_list on 3.13
|
||||
|
||||
---
|
||||
src/jinja2/loaders.py | 32 ++++++++++++++++++++++++++------
|
||||
tests/test_loader.py | 2 +-
|
||||
2 files changed, 27 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/jinja2/loaders.py b/src/jinja2/loaders.py
|
||||
index 9eaf647ba..8c2c86cd0 100644
|
||||
--- a/src/jinja2/loaders.py
|
||||
+++ b/src/jinja2/loaders.py
|
||||
@@ -238,6 +238,30 @@ def list_templates(self) -> t.List[str]:
|
||||
return sorted(found)
|
||||
|
||||
|
||||
+if sys.version_info >= (3, 13):
|
||||
+
|
||||
+ def _get_zipimporter_files(z: t.Any) -> t.Dict[str, object]:
|
||||
+ try:
|
||||
+ get_files = z._get_files
|
||||
+ except AttributeError as e:
|
||||
+ raise TypeError(
|
||||
+ "This zip import does not have the required"
|
||||
+ " metadata to list templates."
|
||||
+ ) from e
|
||||
+ return get_files()
|
||||
+else:
|
||||
+
|
||||
+ def _get_zipimporter_files(z: t.Any) -> t.Dict[str, object]:
|
||||
+ try:
|
||||
+ files = z._files
|
||||
+ except AttributeError as e:
|
||||
+ raise TypeError(
|
||||
+ "This zip import does not have the required"
|
||||
+ " metadata to list templates."
|
||||
+ ) from e
|
||||
+ return files # type: ignore[no-any-return]
|
||||
+
|
||||
+
|
||||
class PackageLoader(BaseLoader):
|
||||
"""Load templates from a directory in a Python package.
|
||||
|
||||
@@ -382,11 +406,7 @@ def list_templates(self) -> t.List[str]:
|
||||
for name in filenames
|
||||
)
|
||||
else:
|
||||
- if not hasattr(self._loader, "_files"):
|
||||
- raise TypeError(
|
||||
- "This zip import does not have the required"
|
||||
- " metadata to list templates."
|
||||
- )
|
||||
+ files = _get_zipimporter_files(self._loader)
|
||||
|
||||
# Package is a zip file.
|
||||
prefix = (
|
||||
@@ -395,7 +415,7 @@ def list_templates(self) -> t.List[str]:
|
||||
)
|
||||
offset = len(prefix)
|
||||
|
||||
- for name in self._loader._files.keys():
|
||||
+ for name in files:
|
||||
# Find names under the templates directory that aren't directories.
|
||||
if name.startswith(prefix) and name[-1] != os.path.sep:
|
||||
results.append(name[offset:].replace(os.path.sep, "/"))
|
@ -1,4 +1,4 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
@ -33,17 +33,25 @@ distutils_enable_tests pytest
|
||||
# XXX: handle Babel better?
|
||||
|
||||
src_prepare() {
|
||||
local PATCHES=(
|
||||
# https://github.com/pallets/jinja/pull/1979
|
||||
"${FILESDIR}/${P}-py313.patch"
|
||||
)
|
||||
|
||||
# avoid unnecessary dep on extra sphinxcontrib modules
|
||||
sed -i '/sphinxcontrib.log_cabinet/ d' docs/conf.py || die
|
||||
|
||||
distutils-r1_src_prepare
|
||||
}
|
||||
|
||||
python_test() {
|
||||
local EPYTEST_IGNORE=()
|
||||
if ! has_version "dev-python/trio[${PYTHON_USEDEP}]"; then
|
||||
EPYTEST_IGNORE+=(
|
||||
tests/test_async.py
|
||||
tests/test_async_filters.py
|
||||
)
|
||||
fi
|
||||
|
||||
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
|
||||
epytest
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
if ! has_version dev-python/babel; then
|
||||
elog "For i18n support, please emerge dev-python/babel."
|
Loading…
Reference in New Issue
Block a user