From b4e733da055cb020f28002d9cf379fff1d5c0119 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Sun, 15 May 2022 20:45:28 +0200 Subject: [PATCH 1/4] Use sphinx-lint in `make check`. --- Makefile | 4 +++- make.bat | 14 +++++++++++++- requirements.txt | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e0e6ecd73..06e325814 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ VENVDIR = ./venv BUILDDIR = _build SPHINXOPTS = SPHINXBUILD = $(VENVDIR)/bin/sphinx-build +SPHINXLINT = $(VENVDIR)/bin/sphinx-lint PAPER = # Internal variables. @@ -154,7 +155,8 @@ htmlview: html $(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('_build/html/index.html'))" check: - $(PYTHON) tools/rstlint.py -i tools -i venv + # Ignore the tools and venv dirs and check that the default role is not used. + $(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role serve: @echo "The 'serve' target was removed, use 'htmlview' instead" \ diff --git a/make.bat b/make.bat index cba6cb9d5..731fc08a5 100644 --- a/make.bat +++ b/make.bat @@ -10,6 +10,17 @@ if "%PYTHON%" == "" ( set PYTHON=py -3 ) +if not defined SPHINXLINT ( + %PYTHON% -c "import sphinxlint" > nul 2> nul + if errorlevel 1 ( + echo Installing sphinx-lint with %PYTHON% + rem Should have been installed with Sphinx earlier + %PYTHON% -m pip install sphinx-lint + if errorlevel 1 exit /B + ) + set SPHINXLINT=%PYTHON% -m sphinxlint +) + set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . if NOT "%PAPER%" == "" ( @@ -202,7 +213,8 @@ results in %BUILDDIR%/doctest/output.txt. ) :check -cmd /C %PYTHON% tools\rstlint.py -i tools -i venv +rem Ignore the tools and venv dirs and check that the default role is not used. +cmd /S /C "%SPHINXLINT% -i tools -i venv --enable default-role" goto end :serve diff --git a/requirements.txt b/requirements.txt index 7da0db247..071237ae9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Sphinx==4.5.0 furo<2022.4.8 sphinx_copybutton>=0.3.3 +sphinx-lint<1 From 3c46dae2fd788866aba65ed9eb7a2274ed8a61b0 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Sun, 15 May 2022 20:48:57 +0200 Subject: [PATCH 2/4] Fix missing newlines at the end of files. --- gh-faq.rst | 2 +- setup.rst | 2 +- silencewarnings.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gh-faq.rst b/gh-faq.rst index 7fe66c029..42b0fb61d 100644 --- a/gh-faq.rst +++ b/gh-faq.rst @@ -117,4 +117,4 @@ particularly useful outside of the change log. .. _bpo: https://bugs.python.org/ .. _GitHub search syntax: https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax -.. _advanced search: https://github.com/search/advanced \ No newline at end of file +.. _advanced search: https://github.com/search/advanced diff --git a/setup.rst b/setup.rst index 3775c5fe2..58120dc30 100644 --- a/setup.rst +++ b/setup.rst @@ -556,4 +556,4 @@ every rule. Various tools that are (or have been) used to maintain Python. -.. _issue tracker: https://github.com/python/cpython/issues \ No newline at end of file +.. _issue tracker: https://github.com/python/cpython/issues diff --git a/silencewarnings.rst b/silencewarnings.rst index 8d1ff5bff..a5f21ed0d 100644 --- a/silencewarnings.rst +++ b/silencewarnings.rst @@ -15,4 +15,4 @@ If you decide to tackle a warning you have found, open an issue on the `issue tracker`_ (if one has not already been opened) and say you are going to try and tackle the issue, and then proceed to fix the issue. -.. _issue tracker: https://github.com/python/cpython/issues \ No newline at end of file +.. _issue tracker: https://github.com/python/cpython/issues From 96028ad83efa57043df951f77c97243e0c3f5db3 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Mon, 16 May 2022 16:16:39 +0200 Subject: [PATCH 3/4] Add `venv` as a dependency for the `check` target. Co-authored-by: Hugo van Kemenade --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 06e325814..68c1bb2cc 100644 --- a/Makefile +++ b/Makefile @@ -154,7 +154,7 @@ doctest: venv htmlview: html $(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('_build/html/index.html'))" -check: +check: venv # Ignore the tools and venv dirs and check that the default role is not used. $(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role From 5525e936d24e702a9a92048d50ae62c92bac1bba Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Mon, 16 May 2022 23:38:09 +0200 Subject: [PATCH 4/4] Specify `sphinx-lint` version in `make.bat`. Co-authored-by: Steve Dower --- make.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make.bat b/make.bat index 731fc08a5..ca3ac39d8 100644 --- a/make.bat +++ b/make.bat @@ -15,7 +15,7 @@ if not defined SPHINXLINT ( if errorlevel 1 ( echo Installing sphinx-lint with %PYTHON% rem Should have been installed with Sphinx earlier - %PYTHON% -m pip install sphinx-lint + %PYTHON% -m pip install "sphinx-lint<1" if errorlevel 1 exit /B ) set SPHINXLINT=%PYTHON% -m sphinxlint