Hack for distutils check --restructuredtext #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A Python distutils bug (http://bugs.python.org/issue23063) causes
python setup.py check --restructuredtext
to fail on documents withcode blocks.
Fixes: SF-270 (https://sourceforge.net/p/docutils/bugs/270/)
python setup.py check --restructuredtext --strict --metadata
fails with:if the RST document uses
code
orcode-block
directives.This is annoying because the document is valid, but it appears to be invalid and confuses people. For an example, see ionelmc/pytest-benchmark#4 (comment).
How to reproduce this bug
Clone a repo that has a
README.rst
withcode-block
directives in it. E.g.:Observe that it has "code-blocks" in it:
Observe that RST document is valid, according to
rst2html.py
:Observe that
python setup.py check --restructuredtext --strict --metadata
fails:What was expected:
python setup.py check --restructuredtext --strict --metadata
should succeed with no warnings, just asrst2html.py did
, becauseREADME.rst
is a valid RST document.What actually happened:
python setup.py check --restructuredtext --strict --metadata
prints a warning and an error and fails, unlikerst2html.py
The error is coming from here:
https://github.com/python/cpython/blob/master/Lib/distutils/command/check.py#L142
It's happening because of this line:
https://github.com/python/cpython/blob/master/Lib/distutils/command/check.py#L125
If this is changed to:
then things work much better (this is how
tools/quicktest.py
does it for example)so this might actually be a bug in distutils, but changing CPython (and maybe PyPy) is a more laborious and slow process, so I'm thinking it might be nice to work around this in docutils, if isn't too much of a burden. Docutils is on a much shorter release cycle than CPython, so changing docutils is a way to get this fix out to users much faster.