git: c97b0646fcb8 - main - textproc/py-mkdocstrings: Add support for Jinja2 3.1

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Fri, 18 Nov 2022 06:46:36 UTC
The branch main has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c97b0646fcb8289dadcbbada96cb457a0f7c1b53

commit c97b0646fcb8289dadcbbada96cb457a0f7c1b53
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2022-11-18 06:39:43 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2022-11-18 06:39:43 +0000

    textproc/py-mkdocstrings: Add support for Jinja2 3.1
    
    * The newer releases of py-mkdocstrings need some additional
      dependencies, which are not yet available as ports.
    
      Thus backport a patch of the 0.18.0 release to add compatibility for
      Jinja2 3.1.  This fixes the runtime regarding "contextfunction" that
      was replaced with "pass_context" in Jinja2 3.1 after 23cc43859179.
    
    * Bump PORTREVISION due package change.
---
 textproc/py-mkdocstrings/Makefile                  |  1 +
 .../files/patch-src_mkdocstrings_loggers.py        | 34 ++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/textproc/py-mkdocstrings/Makefile b/textproc/py-mkdocstrings/Makefile
index 791c81be8efc..0b44e2548343 100644
--- a/textproc/py-mkdocstrings/Makefile
+++ b/textproc/py-mkdocstrings/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	mkdocstrings
 DISTVERSION=	0.17.0
+PORTREVISION=	1
 CATEGORIES=	textproc python
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 
diff --git a/textproc/py-mkdocstrings/files/patch-src_mkdocstrings_loggers.py b/textproc/py-mkdocstrings/files/patch-src_mkdocstrings_loggers.py
new file mode 100644
index 000000000000..defa90fffce3
--- /dev/null
+++ b/textproc/py-mkdocstrings/files/patch-src_mkdocstrings_loggers.py
@@ -0,0 +1,34 @@
+From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= <pawamoy@pm.me>
+Date: Wed, 2 Feb 2022 12:27:27 +0100
+Subject: [PATCH] refactor: Support Jinja2 3.1
+
+Issue #360: https://github.com/mkdocstrings/mkdocstrings/issues/360
+PR #361: https://github.com/mkdocstrings/mkdocstrings/issues/361
+
+--- src/mkdocstrings/loggers.py.orig	2021-12-27 17:59:33 UTC
++++ src/mkdocstrings/loggers.py
+@@ -4,10 +4,14 @@ from typing import Any, Callable, Optional, Tuple
+ from pathlib import Path
+ from typing import Any, Callable, Optional, Tuple
+ 
+-from jinja2 import contextfunction
+ from jinja2.runtime import Context
+ from mkdocs.utils import warning_filter
+ 
++try:
++    from jinja2 import pass_context
++except ImportError:  # TODO: remove once Jinja2 < 3.1 is dropped
++    from jinja2 import contextfunction as pass_context  # noqa: WPS440
++
+ TEMPLATES_DIR = Path(__file__).parent / "templates"
+ 
+ 
+@@ -71,7 +75,7 @@ def get_template_logger_function(logger_func: Callable
+         A function.
+     """
+ 
+-    @contextfunction
++    @pass_context
+     def wrapper(context: Context, msg: Optional[str] = None) -> str:
+         """Log a message.
+