#5 Stop using Python 2 Sphinx, use Python 3 to build the docs
Merged 5 years ago by churchyard. Opened 5 years ago by churchyard.
rpms/ churchyard/python2-docs py3  into  master

@@ -0,0 +1,58 @@ 

+ From 869652b426bb34a30ce7b39f0a0ac242ed5b1016 Mon Sep 17 00:00:00 2001

+ From: Julien Palard <julien@palard.fr>

+ Date: Mon, 18 Mar 2019 19:11:30 +0100

+ Subject: [PATCH] [2.7] bpo-35605: Fix documentation build for sphinx<1.6

+  (GH-12413)

+ 

+ (cherry picked from commit dfc8fc15fa989acba3c372572e52bbcb5ab38a37)

+ ---

+  Doc/conf.py                                                 | 2 +-

+  Doc/tools/extensions/pyspecific.py                          | 6 +++++-

+  .../Documentation/2018-12-30-09-56-13.bpo-35605.gAWt32.rst  | 1 +

+  3 files changed, 7 insertions(+), 2 deletions(-)

+  create mode 100644 Misc/NEWS.d/next/Documentation/2018-12-30-09-56-13.bpo-35605.gAWt32.rst

+ 

+ diff --git a/Doc/conf.py b/Doc/conf.py

+ index 557fe1e72f27..df76b943b794 100644

+ --- a/Doc/conf.py

+ +++ b/Doc/conf.py

+ @@ -57,7 +57,7 @@

+  

+  # Custom sidebar templates, filenames relative to this file.

+  html_sidebars = {

+ -    'index': 'indexsidebar.html',

+ +    'index': ['indexsidebar.html'],

+  }

+  

+  # Additional templates that should be rendered to pages.

+ diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py

+ index 6378f76bdc2c..1ec88c23e01b 100644

+ --- a/Doc/tools/extensions/pyspecific.py

+ +++ b/Doc/tools/extensions/pyspecific.py

+ @@ -15,7 +15,6 @@

+  from docutils import nodes, utils

+  from docutils.parsers.rst import Directive

+  

+ -from sphinx.util import status_iterator

+  from sphinx.util.nodes import split_explicit_title

+  from sphinx.writers.html import HTMLTranslator

+  from sphinx.writers.latex import LaTeXTranslator

+ @@ -173,6 +172,11 @@ def get_target_uri(self, docname, typ=None):

+          return ''  # no URIs

+  

+      def write(self, *ignored):

+ +        try:  # sphinx>=1.6

+ +            from sphinx.util import status_iterator

+ +        except ImportError:  # sphinx<1.6

+ +            status_iterator = self.status_iterator

+ +

+          writer = TextWriter(self)

+          for label in status_iterator(pydoc_topic_labels,

+                                       'building topics... ',

+ diff --git a/Misc/NEWS.d/next/Documentation/2018-12-30-09-56-13.bpo-35605.gAWt32.rst b/Misc/NEWS.d/next/Documentation/2018-12-30-09-56-13.bpo-35605.gAWt32.rst

+ new file mode 100644

+ index 000000000000..cbc0f1e07f31

+ --- /dev/null

+ +++ b/Misc/NEWS.d/next/Documentation/2018-12-30-09-56-13.bpo-35605.gAWt32.rst

+ @@ -0,0 +1 @@

+ +Fix documentation build for sphinx<1.6.  Patch by Anthony Sottile.

file modified
+9 -8
@@ -9,6 +9,10 @@ 

  URL:			https://www.python.org/

  

  Source:			https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz

+ 

+ # Make it build with Sphinx 2

+ Patch1:			https://github.com/python/cpython/commit/869652b426bb34a30ce7b39f0a0ac242ed5b1016.patch

+ 

  # this changes the makefile so that build requires are used instead of

  # hard coded svn checkout to get sphinx

  Patch19: python-2.7-texinfomakefile.patch
@@ -17,10 +21,10 @@ 

  

  BuildArch:		noarch

  

- BuildRequires:	python2

- BuildRequires:	python2-docutils

- BuildRequires:	python2-pygments

- BuildRequires:	python2-sphinx

+ BuildRequires:	python3

+ BuildRequires:	python3-docutils

+ BuildRequires:	python3-pygments

+ BuildRequires:	python3-sphinx

  BuildRequires:	linkchecker

  

  Recommends:		python2 = %{version}
@@ -48,10 +52,7 @@ 

  documentation for the Python 2 language using the info command or Emacs.

  

  %prep

- %setup -q -n Python-%{version}

- 

- %patch19 -p1 -b .texinfomakefile

- %patch20 -p1 -b .texinfobuilder

+ %autosetup -p1 -n Python-%{version}

  

  %build

  make -C Doc html

Still uses linkchecker and that runs on Python 2 unfortunately

This is a demo for https://fedoraproject.org/wiki/Changes/Sphinx2

We should check it it remains to work with sphinx 2. However if it doesn't, we might need to retire the package, so we can marge now as well.

rebased onto 1158f09

5 years ago

This will be needed now.

Note: Test the build with sphinx 2.0.0

sphinx-build -b html -d build/doctrees -D latex_elements.papersize= . build/html
Running Sphinx v2.0.0b1

Exception occurred:
File "/builddir/build/BUILD/Python-2.7.15/Doc/tools/extensions/pyspecific.py", line 251, in setup
app.add_description_unit('opcode', 'opcode', '%s (opcode)',
AttributeError: 'Sphinx' object has no attribute 'add_description_unit'
The full traceback has been saved in /tmp/sphinx-err-0mwzg576.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at https://github.com/sphinx-doc/sphinx/issues. Thanks!
make: Leaving directory '/builddir/build/BUILD/Python-2.7.15/Doc'
make: *** [Makefile:41: build] Error 2

So no, it doesn't build.

Let's update it to .16 instead before is starts to FTBFS forever and then we can either ship pre-built docs or retire the package.

Note to self: See if python3-docs build with 2.0.0 and report to upstream(s) if it doesn't.

python3-docs build fine with sphinx 2

Pull-Request has been closed by churchyard

5 years ago

Pull-Request has been reopened by churchyard

5 years ago

rebased onto 27c1d5d

5 years ago

writing output... [100%] whatsnew/index
generating indices... genindex py-modindex
BUILDSTDERR: writing additional pages... download index
BUILDSTDERR: Theme error:
BUILDSTDERR: An error happened in rendering the page index.
BUILDSTDERR: Reason: TemplateNotFound()

rebased onto db11dd4

5 years ago

Added. Builds fine in mock.

Changes look good, the simple-ci packages contain docs that look good

+1, please merge

Pull-Request has been merged by churchyard

5 years ago