From: David Lord Date: Fri, 23 Aug 2024 23:51:25 +0000 (-0700) Subject: Merge branch '3.1.x' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f0fc0ad2cd5e916d607777efdbbba421893e8ac;p=thirdparty%2Fjinja.git Merge branch '3.1.x' --- 7f0fc0ad2cd5e916d607777efdbbba421893e8ac diff --cc requirements/tests37.in index 0e459b2d,9c2bed18..00000000 deleted file mode 100644,100644 --- a/requirements/tests37.in +++ /dev/null @@@ -1,2 -1,2 +1,0 @@@ --pytest - trio==0.26.0 -trio==0.22.2 diff --cc requirements/tests37.txt index ffc62338,81c6213c..00000000 deleted file mode 100644,100644 --- a/requirements/tests37.txt +++ /dev/null @@@ -1,28 -1,43 +1,0 @@@ --# --# This file is autogenerated by pip-compile with Python 3.7 --# by the following command: --# --# pip-compile tests37.in --# - attrs==23.2.0 -attrs==24.2.0 -- # via -- # outcome -- # trio - idna==3.7 -exceptiongroup==1.2.2 - # via - # pytest - # trio -idna==3.8 -- # via trio -importlib-metadata==6.7.0 - # via - # attrs - # pluggy - # pytest --iniconfig==2.0.0 -- # via pytest --outcome==1.3.0.post0 -- # via trio --packaging==24.0 -- # via pytest --pluggy==1.2.0 -- # via pytest --pytest==7.4.4 -- # via -r tests37.in --sniffio==1.3.1 -- # via trio --sortedcontainers==2.4.0 -- # via trio - trio==0.26.0 -tomli==2.0.1 - # via pytest -trio==0.22.2 -- # via -r tests37.in -typing-extensions==4.7.1 - # via importlib-metadata -zipp==3.15.0 - # via importlib-metadata diff --cc src/jinja2/loaders.py index 5cb49271,8c2c86cd..8ca32cbb --- a/src/jinja2/loaders.py +++ b/src/jinja2/loaders.py @@@ -382,20 -406,19 +406,16 @@@ class PackageLoader(BaseLoader) 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 = ( - self._template_root[len(self._archive) :].lstrip(os.path.sep) - + os.path.sep - ) + prefix = self._template_root[len(self._archive) :].lstrip(os.sep) + os.sep 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, "/")) + if name.startswith(prefix) and name[-1] != os.sep: + results.append(name[offset:].replace(os.sep, "/")) results.sort() return results diff --cc tox.ini index bb84c67e,a40f36a4..064ca2e4 --- a/tox.ini +++ b/tox.ini @@@ -48,11 -54,11 +54,3 @@@ commands pip-compile tests.in -q {posargs:-U} pip-compile typing.in -q {posargs:-U} pip-compile dev.in -q {posargs:-U} -- --[testenv:update-requirements37] --base_python = 3.7 --labels = update --deps = pip-tools --skip_install = true --change_dir = requirements --commands = pip-compile tests37.in -q {posargs:-U}