From: Jakub Bogusz Date: Fri, 11 Mar 2022 22:10:05 +0000 (+0100) Subject: - updated to 3.5.4 X-Git-Tag: auto/th/sphinx-pdg-3.5.4-1 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=d1b48898fafae0e57c9e7c26265f0f80dfaec056;p=packages%2Fsphinx-pdg.git - updated to 3.5.4 - added jinja3 patch (Jinja2 3.x support from git) - added docutils patch (allow docutils 0.17 and 0.18) --- diff --git a/Sphinx-docutils.patch b/Sphinx-docutils.patch new file mode 100644 index 0000000..53573cc --- /dev/null +++ b/Sphinx-docutils.patch @@ -0,0 +1,11 @@ +--- Sphinx-3.5.4/setup.py.orig 2021-04-11 12:40:16.000000000 +0200 ++++ Sphinx-3.5.4/setup.py 2022-03-11 06:21:28.393510714 +0100 +@@ -23,7 +23,7 @@ install_requires = [ + 'sphinxcontrib-qthelp', + 'Jinja2>=2.3', + 'Pygments>=2.0', +- 'docutils>=0.12,<0.17', ++ 'docutils>=0.12,<0.19', + 'snowballstemmer>=1.1', + 'babel>=1.3', + 'alabaster>=0.7,<0.8', diff --git a/Sphinx-jinja3.patch b/Sphinx-jinja3.patch new file mode 100644 index 0000000..d3b8aae --- /dev/null +++ b/Sphinx-jinja3.patch @@ -0,0 +1,120 @@ +From 85f58874ecd9feb391e24f9d0197bef5cc637a87 Mon Sep 17 00:00:00 2001 +From: Takeshi KOMIYA +Date: Mon, 3 May 2021 13:48:17 +0900 +Subject: [PATCH] Support jinja2-3.0 + +Since jinja2-3.0, some utility functions like contextfunction and +environmentfilter are renamed to new name. This follows the updates to +support jinja2-3.0 or above. +--- + CHANGES | 2 ++ + setup.py | 3 +-- + sphinx/jinja2glue.py | 13 +++++++++---- + sphinx/util/rst.py | 10 ++++++++-- + 4 files changed, 20 insertions(+), 8 deletions(-) + +#diff --git a/CHANGES b/CHANGES +#index ce70aeb83c..c9f0c4556c 100644 +#--- a/CHANGES +#+++ b/CHANGES +#@@ -4,6 +4,8 @@ Release 4.1.0 (in development) +# Dependencies +# ------------ +# +#+* Support jinja2-3.0 +#+ +# Incompatible changes +# -------------------- +# +#diff --git a/setup.py b/setup.py +#index 7ce37f9eaf..b669afc00e 100644 +#--- a/setup.py +#+++ b/setup.py +#@@ -21,8 +21,7 @@ +# 'sphinxcontrib-htmlhelp', +# 'sphinxcontrib-serializinghtml', +# 'sphinxcontrib-qthelp', +#- 'Jinja2>=2.3,<3.0', +#- 'MarkupSafe<2.0', +#+ 'Jinja2>=2.3', +# 'Pygments>=2.0', +# 'docutils>=0.14,<0.18', +# 'snowballstemmer>=1.1', +diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py +index c239f5a4a1..cd6e8066b9 100644 +--- a/sphinx/jinja2glue.py ++++ b/sphinx/jinja2glue.py +@@ -12,7 +12,7 @@ from os import path + from pprint import pformat + from typing import Any, Callable, Dict, Iterator, List, Tuple, Union + +-from jinja2 import BaseLoader, FileSystemLoader, TemplateNotFound, contextfunction ++from jinja2 import BaseLoader, FileSystemLoader, TemplateNotFound + from jinja2.environment import Environment + from jinja2.sandbox import SandboxedEnvironment + from jinja2.utils import open_if_exists +@@ -22,6 +22,11 @@ from sphinx.theming import Theme + from sphinx.util import logging + from sphinx.util.osutil import mtimes_of_files + ++try: ++ from jinja2.utils import pass_context # type: ignore # jinja2-3.0 or above ++except ImportError: ++ from jinja2 import contextfunction as pass_context ++ + if False: + # For type annotation + from sphinx.builders import Builder +@@ -102,7 +107,7 @@ class idgen: + next = __next__ # Python 2/Jinja compatibility + + +-@contextfunction ++@pass_context + def warning(context: Dict, message: str, *args: Any, **kwargs: Any) -> str: + if 'pagename' in context: + filename = context.get('pagename') + context.get('file_suffix', '') +@@ -181,9 +186,9 @@ class BuiltinTemplateLoader(TemplateBrid + self.environment.filters['toint'] = _toint + self.environment.filters['todim'] = _todim + self.environment.filters['slice_index'] = _slice_index +- self.environment.globals['debug'] = contextfunction(pformat) ++ self.environment.globals['debug'] = pass_context(pformat) + self.environment.globals['warning'] = warning +- self.environment.globals['accesskey'] = contextfunction(accesskey) ++ self.environment.globals['accesskey'] = pass_context(accesskey) + self.environment.globals['idgen'] = idgen + if use_i18n: + self.environment.install_gettext_translations(builder.app.translator) +diff --git a/sphinx/util/rst.py b/sphinx/util/rst.py +index 82b3f6bdaa..8103a8b109 100644 +--- a/sphinx/util/rst.py ++++ b/sphinx/util/rst.py +@@ -18,11 +18,17 @@ + from docutils.parsers.rst.languages import en as english + from docutils.statemachine import StringList + from docutils.utils import Reporter +-from jinja2 import Environment, environmentfilter ++from jinja2 import Environment + + from sphinx.locale import __ + from sphinx.util import docutils, logging + ++try: ++ from jinja2.utils import pass_environment # type: ignore # jinja2-3.0 or above ++except ImportError: ++ from jinja2 import environmentfilter as pass_environment ++ ++ + logger = logging.getLogger(__name__) + + docinfo_re = re.compile(':\\w+:.*?') +@@ -51,7 +57,7 @@ def charwidth(char: str, widechars: str) -> int: + return sum(charwidth(c, widechars) for c in text) + + +-@environmentfilter ++@pass_environment + def heading(env: Environment, text: str, level: int = 1) -> str: + """Create a heading for *level*.""" + assert level <= 3 diff --git a/sphinx-pdg.spec b/sphinx-pdg.spec index 3a320a6..76981f6 100644 --- a/sphinx-pdg.spec +++ b/sphinx-pdg.spec @@ -11,14 +11,16 @@ Summary: Sphinx - Python documentation generator Summary(pl.UTF-8): Sphinx - narzędzie do tworzenia dokumentacji dla Pythona Name: sphinx-pdg -Version: 3.5.1 -Release: 2 +Version: 3.5.4 +Release: 1 License: BSD Group: Development/Languages/Python #Source0Download: https://pypi.org/simple/Sphinx/ Source0: https://files.pythonhosted.org/packages/source/S/Sphinx/Sphinx-%{version}.tar.gz -# Source0-md5: c29fafed45f91fbb3252dff545d09694 +# Source0-md5: dd46088ebc01f6f721ee7618df680d68 Patch0: float-ver.patch +Patch1: Sphinx-jinja3.patch +Patch2: Sphinx-docutils.patch URL: http://www.sphinx-doc.org/ %if %{with tests} && %(locale -a | grep -q '^C\.utf8$'; echo $?) BuildRequires: glibc-localedb-all @@ -42,7 +44,7 @@ BuildRequires: python3-html5lib BuildRequires: python3-imagesize BuildRequires: python3-jinja2 >= 2.3 # for lint only, not run by pytest -#BuildRequires: python3-mypy >= 0.790 +#BuildRequires: python3-mypy >= 0.800 BuildRequires: python3-packaging BuildRequires: python3-pygments >= 2.0 BuildRequires: python3-pytest >= 3.0 @@ -134,6 +136,8 @@ Dokumentacja do generatora dokumentacji pythonowej Sphinx. %prep %setup -q -n Sphinx-%{version} %patch0 -p1 +%patch1 -p1 +%patch2 -p1 # needs python-babel with at least de,en,ja locales installed %{__rm} tests/test_util_i18n.py