]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] Docs: move sphinx-lint to pre-commit (GH-105750) (#108276)
authorHugo van Kemenade <hugovk@users.noreply.github.com>
Tue, 22 Aug 2023 12:18:39 +0000 (15:18 +0300)
committerGitHub <noreply@github.com>
Tue, 22 Aug 2023 12:18:39 +0000 (15:18 +0300)
.github/workflows/reusable-docs.yml
.pre-commit-config.yaml
Doc/Makefile
Doc/constraints.txt
Doc/requirements.txt

index 9c1ed2788080dcc5833ed6fa967a83bac766b379..f8e166b780b3ed618f0c5eb10091b9df12765162 100644 (file)
@@ -26,8 +26,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
     - name: 'Upload'
@@ -37,8 +35,6 @@ jobs:
         path: Doc/build/html
 
   # 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..889bd8502a10eab1c5f1613258b58d51e4f41dfc 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.8
+    hooks:
+      - id: sphinx-lint
+        args: [--enable=default-role]
+        files: ^Doc/|^Misc/NEWS.d/next/
+        types: [rst]
index 918814140f45cbe8b410de21f0605ffb01e7de91..55be2b2dc5c1e6f9ca28ba2d3359892d4f03b2ae 100644 (file)
@@ -214,11 +214,9 @@ dist:
        rm -r dist/python-$(DISTVERSION)-docs-texinfo
        rm dist/python-$(DISTVERSION)-docs-texinfo.tar
 
-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
 
 serve:
        @echo "The serve target was removed, use htmlview instead (see bpo-36329)"
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 3c0e0a7733673e6d278078122ac95332715e228b..df79ae63840471734d2def6d0fc079d67cb9fa1c 100644 (file)
@@ -10,7 +10,6 @@ sphinx==4.5.0
 
 blurb
 
-sphinx-lint==0.6.7
 sphinxext-opengraph>=0.7.1
 
 # The theme used by the documentation is stored separately, so we need