forked from Lainports/freebsd-ports
textproc/py-mkdocstrings: Update to 0.22.0
* Introduce CRYSTAL, PYTHON and PYTHONLEGACY options to reflect the optional dependencies as noted in "pyproject.toml". Leave the last two as non-default for now, because both are mutually exclusive due conflicting dependencies. * Switch to PEP517 build framework and get rid of the no longer required workarounds for distutils. * Remove the backported patch for Jinja2 3.1+ compatibility which is also no longer needed. * Convert the test suite to USE_PYTHON=pytest as well. Changelogs since 0.17.0: https://github.com/mkdocstrings/mkdocstrings/blob/0.22.0/CHANGELOG.md
This commit is contained in:
parent
e1c6e80783
commit
6b168f1127
4 changed files with 33 additions and 94 deletions
|
|
@ -1,6 +1,5 @@
|
|||
PORTNAME= mkdocstrings
|
||||
DISTVERSION= 0.17.0
|
||||
PORTREVISION= 1
|
||||
DISTVERSION= 0.22.0
|
||||
CATEGORIES= textproc python
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
||||
|
|
@ -11,32 +10,50 @@ WWW= https://github.com/mkdocstrings/mkdocstrings
|
|||
LICENSE= ISCL
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
|
||||
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pdm-backend>0:devel/py-pdm-backend@${PY_FLAVOR}
|
||||
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}Jinja2>=2.11.1:devel/py-Jinja2@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}markdown>=3.3:textproc/py-markdown@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}markupsafe>=1.1:textproc/py-markupsafe@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}mkdocs>=1.2:textproc/py-mkdocs@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}pymdown-extensions>=6.3:textproc/py-pymdown-extensions@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}mkdocs-autorefs>=0.1:textproc/py-mkdocs-autorefs@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}pytkdocs>=0.14.0:textproc/py-pytkdocs@${PY_FLAVOR}
|
||||
${PYTHON_PKGNAMEPREFIX}mkdocs-autorefs>=0.3.1:textproc/py-mkdocs-autorefs@${PY_FLAVOR}
|
||||
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}mkdocs-material>0:textproc/py-mkdocs-material@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}sphinx>0:textproc/py-sphinx@${PY_FLAVOR}
|
||||
|
||||
USES= python
|
||||
USE_GITHUB= yes
|
||||
USE_PYTHON= autoplist distutils
|
||||
USE_PYTHON= autoplist pep517 pytest
|
||||
# Skip "test_sphinx_load_mkdocstrings_inventory_file" as it requires
|
||||
# mkdocs-gen-files (not in Ports tree, yet).
|
||||
# The same applies to "test_plugin" which requires markdown-exec (not in Ports
|
||||
# tree yet).
|
||||
PYTEST_IGNORED_TESTS= test_sphinx_load_mkdocstrings_inventory_file test_plugin
|
||||
|
||||
# Required otherwise the build process tries to get the current version via git
|
||||
MAKE_ENV= PDM_BUILD_SCM_VERSION=${DISTVERSION}
|
||||
TEST_ENV= PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||
|
||||
NO_ARCH= yes
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's|%%DISTVERSION%%|${DISTVERSION}|' ${WRKSRC}/setup.py
|
||||
OPTIONS_DEFINE= CRYSTAL
|
||||
OPTIONS_DEFAULT= CRYSTAL
|
||||
OPTIONS_RADIO= PYHANDLER
|
||||
OPTIONS_RADIO_PYHANDLER= PYTHON PYTHONLEGACY
|
||||
|
||||
# Skip "test_sphinx_load_mkdocstrings_inventory_file" as it requires
|
||||
# mkdocs-gen-files (not in Ports tree, yet).
|
||||
do-test:
|
||||
@cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs \
|
||||
-k 'not test_sphinx_load_mkdocstrings_inventory_file'
|
||||
CRYSTAL_DESC= Crystal language handler
|
||||
PYTHONLEGACY_DESC= Legacy Python language handler
|
||||
PYTHON_DESC= Python language handler
|
||||
|
||||
.include <bsd.port.mk>
|
||||
CRYSTAL_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mkdocstrings-crystal>=0.3.4:textproc/py-mkdocstrings-crystal@${PY_FLAVOR}
|
||||
PYTHONLEGACY_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mkdocstrings-python-legacy>=0.2.1:textproc/py-mkdocstrings-python-legacy@${PY_FLAVOR}
|
||||
PYTHON_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mkdocstrings-python>=0.5.2:textproc/py-mkdocstrings-python@${PY_FLAVOR}
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${PYTHON_REL} < 31000
|
||||
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}importlib-metadata>=4.6:devel/py-importlib-metadata@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.1:devel/py-typing-extensions@${PY_FLAVOR}
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1645976995
|
||||
SHA256 (mkdocstrings-mkdocstrings-0.17.0_GH0.tar.gz) = dcd8f03387c423bb1ddf6fbbec8dfa0432dfc3d01001adb4a0c07985f333971c
|
||||
SIZE (mkdocstrings-mkdocstrings-0.17.0_GH0.tar.gz) = 73551
|
||||
TIMESTAMP = 1688217280
|
||||
SHA256 (mkdocstrings-mkdocstrings-0.22.0_GH0.tar.gz) = fcabb0e22b5630de43ade2e26c3ace2d2d70f132a472da3fda0421571e24883d
|
||||
SIZE (mkdocstrings-mkdocstrings-0.22.0_GH0.tar.gz) = 81345
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
--- setup.py.orig 2022-02-28 05:29:01 UTC
|
||||
+++ setup.py
|
||||
@@ -0,0 +1,41 @@
|
||||
+# Generated via pdm export -f setuppy" (run "pdm lock" beforehand)
|
||||
+# -*- coding: utf-8 -*-
|
||||
+from setuptools import setup
|
||||
+
|
||||
+INSTALL_REQUIRES = [
|
||||
+ 'Jinja2>=2.11.1',
|
||||
+ 'Markdown>=3.3',
|
||||
+ 'MarkupSafe>=1.1',
|
||||
+ 'mkdocs>=1.2',
|
||||
+ 'mkdocs-autorefs>=0.1',
|
||||
+ 'pymdown-extensions>=6.3',
|
||||
+ 'pytkdocs>=0.14.0',
|
||||
+]
|
||||
+ENTRY_POINTS = {
|
||||
+ 'mkdocs.plugins': [
|
||||
+ 'mkdocstrings = mkdocstrings.plugin:MkdocstringsPlugin',
|
||||
+ ],
|
||||
+}
|
||||
+
|
||||
+setup_kwargs = {
|
||||
+ 'name': 'mkdocstrings',
|
||||
+ 'version': '%%DISTVERSION%%',
|
||||
+ 'description': 'Automatic documentation from sources, for MkDocs.',
|
||||
+ 'author': '',
|
||||
+ 'author_email': 'Timothée Mazzucotelli <pawamoy@pm.me>',
|
||||
+ 'package_dir': {'': 'src/'},
|
||||
+ 'packages': [
|
||||
+ 'mkdocstrings',
|
||||
+ 'mkdocstrings.handlers',
|
||||
+ 'mkdocstrings.templates.python',
|
||||
+ 'mkdocstrings.templates.python.material',
|
||||
+ 'mkdocstrings.templates.python.mkdocs',
|
||||
+ 'mkdocstrings.templates.python.readthedocs'
|
||||
+ ],
|
||||
+ 'package_data': {'': ['*']},
|
||||
+ 'install_requires': INSTALL_REQUIRES,
|
||||
+ 'python_requires': '>=3.6.2',
|
||||
+ 'entry_points': ENTRY_POINTS,
|
||||
+}
|
||||
+
|
||||
+setup(**setup_kwargs)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
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.
|
||||
|
||||
Loading…
Add table
Reference in a new issue