cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

documention fails 9.1.beta1 to build in prefix #566

Closed strogdon closed 4 years ago

strogdon commented 4 years ago
[thematic_] ... done (3 todos, 85 index, 66 citations, 0 modules)
[thematic_] /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_7/doc/en/thematic_tutorials/structures_in_coding_theory.rst:722: WARNING: Could not lex literal_block as "python". Highlighting skipped.
[thematic_] Merging js index files...
[thematic_] ... done (4882 js index entries)
[thematic_] The HTML pages are in ../../build_doc/html/en/thematic_tutorials.
Error building the documentation.
Traceback (most recent call last):
  File "sage_setup/docbuild/__main__.py", line 2, in <module>
    main()
  File "/storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_7/sage_setup/docbuild/__init__.py", line 1720, in main
    builder()
  File "/storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_7/sage_setup/docbuild/__init__.py", line 336, in _wrapper
    build_many(build_other_doc, L)
  File "/storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_7/sage_setup/docbuild/__init__.py", line 280, in build_many
    _build_many(target, args, processes=NUM_THREADS)
  File "/storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_7/sage_setup/docbuild/utils.py", line 283, in build_many
    raise worker_exc.original_exception
OSError: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_7/doc/en/thematic_tutorials/structures_in_coding_theory.rst:722: WARNING: Could not lex literal_block as "python". Highlighting skipped.
 ^[[31;01m*^[[0m ERROR: sci-mathematics/sage-9999::sage-on-gentoo failed (compile phase):
 ^[[31;01m*^[[0m   failed to produce html doc

Since this is Prefix there could be something installed that should not be.

strogdon commented 4 years ago

The offending line, 722 in structures_in_coding_theory.rst

.. CODE-BLOCK:: python
kiwifb commented 4 years ago

Since the last time that file was touched was in August 2019 we are looking at something else as the trigger.

strogdon commented 4 years ago

There was a similar failure here which prompted removing some patches from sphinx and pygments. The failure here was with pygments-2.5.2 installed. I downgraded to pygments-2.4.2 and the documents built. Perhaps you could try this on your end.

strogdon commented 4 years ago

There is now the exact same error on sage-release.

timokau commented 4 years ago

You can use this sphinx patch:

From b31c625f773ef00905acd0c434d6b173a5a84f68 Mon Sep 17 00:00:00 2001
From: Timo Kaufmann <timokau@zoho.com>
Date: Thu, 23 Jan 2020 10:34:09 +0100
Subject: [PATCH] Use the proper python2 pygments lexer

---
 sphinx/highlighting.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index ac2bd1b06..2b371279c 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -16,8 +16,14 @@ from pygments.filters import ErrorToken
 from pygments.formatters import HtmlFormatter, LatexFormatter
 from pygments.lexer import Lexer  # NOQA
 from pygments.lexers import get_lexer_by_name, guess_lexer
-from pygments.lexers import PythonLexer, Python3Lexer, PythonConsoleLexer, \
+from pygments.lexers import Python3Lexer, PythonConsoleLexer, \
     CLexer, TextLexer, RstLexer
+try:
+    # PythonLexer was renamed to Python2Lexer in pygments 2.5
+    from pygments.lexers import Python2Lexer
+except ImportError:
+    # Fallback for pygments <2.5
+    from pygments.lexers import PythonLexer as Python2Lexer
 from pygments.styles import get_style_by_name
 from pygments.util import ClassNotFound
 from six import text_type
@@ -40,7 +46,7 @@ logger = logging.getLogger(__name__)

 lexers = dict(
     none = TextLexer(stripnl=False),
-    python = PythonLexer(stripnl=False),
+    python = Python2Lexer(stripnl=False),
     python3 = Python3Lexer(stripnl=False),
     pycon = PythonConsoleLexer(stripnl=False),
     pycon3 = PythonConsoleLexer(python3=True, stripnl=False),
-- 
2.24.1

It should be backwards compatible, but I haven't tested it.

kiwifb commented 4 years ago

@timokau that looks perfect, thanks.

kiwifb commented 4 years ago

@strogdon new sphinx ebuild in tree for you to test.

strogdon commented 4 years ago

The new Sphinx ebuild works here with sage-9999 for pygments 2.3.1, 2.4.2 and 2.5.2

kiwifb commented 4 years ago

I guess I can close then.