New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python setup.py check --restructuredtext --strict --metadata
fails with: warning: check: Could not finish the parsing.
if the RST document uses code or code-block directives.
#67252
Comments
if the RST document uses This is annoying because the document is valid, but it appears to be invalid How to reproduce this bug Clone a repo that has a $ git clone git@github.com:ionelmc/pytest-benchmark.git
$ cd pytest-benchmark
$ git checkout ab0b08f6fccb06a7909905a8409f8faa8b01e0d8 Observe that it has "code-blocks" in it: $ grep 'code-block' README.rst
.. code-block:: python
.. code-block:: python Observe that RST document is valid, according to $ rst2html.py --halt=1 README.rst > README.html && echo "RST was OK."
RST was OK.
$ head -n 3 README.html
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> Observe that $ python setup.py check --restructuredtext --strict --metadata
running check
warning: check: Could not finish the parsing.
$ echo $?
1 What was expected: What actually happened: The error is coming from here: It's happening because of this line:
If this is changed to:
then things work much better (this is how The attached patch prevents the failure from happening and also adds more information to the error when things go south. |
Testing a few common cases: $ python setup.py check --restructuredtext --strict --metadata
running check
error: The docutils package is needed.
$ python setup.py check --restructuredtext --strict --metadata
running check
warning: check: Cannot analyze code. Pygments package not found. (line 66) warning: check: Cannot analyze code. Pygments package not found. (line 99) error: Please correct your package. $ python setup.py check --restructuredtext --strict --metadata && echo "RST was OK."
running check
RST was OK. |
Note that this patch does 2 things:
If I only did #1 and not #2, then output looks like this: $ python setup.py check --restructuredtext --strict --metadata && echo "RST was OK."
running check
warning: check: Could not finish the parsing: 'Values' object has no attribute 'syntax_highlight'. error: Please correct your package. |
Could you add a test? See Lib/distutils/tests/test_check.py. |
OK, I added a test. See:
If you want, I can also update the diff attached here, but maybe it's easier to just look at my branch on Bitbucket? Whatever is most convenient for you... |
The Mercurial integration lets you update the patch with one click. Decentralized VCSes are nice :‑) Patch looks good to me. Thank you. |
What's the next step? |
An active core developer needs to see this and decide to commit the patch. You can see if there’s someone on IRC. If there’s no action in a week or two, feel free to ask on python-dev (maybe listing more than one waiting patch, or offering reviews in exchange for core dev time). |
New changeset db09d760b965 by Benjamin Peterson in branch '3.4': New changeset 38826e21f0db by Benjamin Peterson in branch '2.7': New changeset 731a36c13629 by Benjamin Peterson in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: