]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] Docs: move sphinx-lint to pre-commit (GH-105750) (#105894)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 18 Jun 2023 12:21:34 +0000 (05:21 -0700)
committerGitHub <noreply@github.com>
Sun, 18 Jun 2023 12:21:34 +0000 (13:21 +0100)
Docs: move sphinx-lint to pre-commit (GH-105750)
(cherry picked from commit bc07c8f096791d678ca5c1e3486cb9648f7a027b)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
.github/workflows/doc.yml
.pre-commit-config.yaml
Doc/Makefile
Doc/constraints.txt
Doc/requirements.txt

index ec900ce68a1dded47eb1921129e07c47936f7e64..3211b526efc7a565a3d3a2654c3405d12df6e1fd 100644 (file)
@@ -51,8 +51,6 @@ jobs:
         cache-dependency-path: 'Doc/requirements.txt'
     - name: 'Install build dependencies'
       run: make -C Doc/ venv
-    - name: 'Check documentation'
-      run: make -C Doc/ check
     - name: 'Build HTML documentation'
       run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
 
@@ -82,8 +80,6 @@ jobs:
         make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1
 
   # This build doesn't use problem matchers or check annotations
-  # It also does not run 'make check', as sphinx-lint is not installed into the
-  # environment.
   build_doc_oldest_supported_sphinx:
     name: 'Docs (Oldest Sphinx)'
     runs-on: ubuntu-latest
index 808622f19a3dbf39d94f9c918f08c7e5588f4c6a..464bcde6e9842496c212e9a1fe5c6e0e09a3193d 100644 (file)
@@ -5,3 +5,11 @@ repos:
       - id: check-yaml
       - id: trailing-whitespace
         types_or: [c, python, rst]
+
+  - repo: https://github.com/sphinx-contrib/sphinx-lint
+    rev: v0.6.7
+    hooks:
+      - id: sphinx-lint
+        args: [--enable=default-role]
+        files: ^Doc/
+        types: [rst]
index c11ea6ce03e8a45fd43684bdc4e73b3591328673..22691895068fea47eea53f49ddf35423045027c3 100644 (file)
@@ -216,11 +216,9 @@ dist:
        rm dist/python-$(DISTVERSION)-docs-texinfo.tar
 
 .PHONY: check
-check:
-       # Check the docs and NEWS files with sphinx-lint.
-       # Ignore the tools and venv dirs and check that the default role is not used.
-       $(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
-       $(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/
+check: venv
+       $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
+       $(VENVDIR)/bin/python3 -m pre_commit run --all-files
 
 .PHONY: serve
 serve:
index 66c748eb092d83bb9284fd4c947bc7ccb738f25e..54888eaab242eea0743b79aa6d505c07588fc3f5 100644 (file)
@@ -23,7 +23,3 @@ sphinxcontrib-serializinghtml<1.2
 
 # Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
 MarkupSafe<2.2
-
-# Direct dependencies of sphinx-lint
-polib<1.3
-regex<2024
index 9cbd15c2209dc6326fc1ba014b16e38face6940f..4c9d02ea37ab58b7a09977f165dc19238ffd5f7b 100644 (file)
@@ -10,7 +10,6 @@ sphinx==4.5.0
 
 blurb
 
-sphinx-lint==0.6.7
 sphinxext-opengraph==0.7.5
 
 # The theme used by the documentation is stored separately, so we need