Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ coverage: build
.PHONY: doctest
doctest: BUILDER = doctest
doctest:
@venv_version=$$($(VENVDIR)/bin/python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])'); \
tree_version=$$($(PYTHON) tools/extensions/patchlevel.py --short); \
if [ "$$venv_version" != "$$tree_version" ]; then \
echo "The venv runs Python $$venv_version, but this source tree is Python $$tree_version."; \
echo "The doctests are executed by the venv interpreter, so they would test"; \
echo "Python $$venv_version rather than the code documented here."; \
exit 1; \
fi
@$(MAKE) build BUILDER=$(BUILDER) || { \
echo "Testing of doctests in the sources finished, look at the" \
"results in build/doctest/output.txt"; \
Expand Down
13 changes: 13 additions & 0 deletions Doc/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ call ..\PCbuild\find_python.bat %PYTHON%

if not defined PYTHON set PYTHON=py

if "%1" NEQ "doctest" goto :skipversioncheck
for /f "usebackq" %%v in (`%PYTHON% -c "import sys; print(sys.version_info[0], sys.version_info[1], sep='.')"`) do set PYVERSION=%%v
for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py --short`) do set TREEVERSION=%%v
if "%PYVERSION%" NEQ "%TREEVERSION%" (
echo.
echo.%PYTHON% is Python %PYVERSION%, but this source tree is Python %TREEVERSION%.
echo.The doctests are executed by that interpreter, so they would test
echo.Python %PYVERSION% rather than the code documented here.
popd
exit /B 1
)
:skipversioncheck

if not defined SPHINXBUILD (
%PYTHON% -c "import sphinx" > nul 2> nul
if errorlevel 1 (
Expand Down
Loading