Skip to contentSkip to conversation

docs: kernel_include.py: Cope with docutils 0.21

PATCH Applied Akira Yokosawa 3 participants 5 messages May 1, 2024 – May 2, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: kernel_include.py: Cope with docutils 0.21

Running "make htmldocs" on a newly installed Sphinx 7.3.7 ends up in a build error:

Sphinx parallel build error:
AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'

docutils 0.21 has removed nodes.reprunicode, quote from release note [1]:

* Removed objects:

docutils.nodes.reprunicode, docutils.nodes.ensure_str()
Python 2 compatibility hacks

Sphinx 7.3.0 supports docutils 0.21 [2]:

kernel_include.py, whose origin is misc.py of docutils, uses reprunicode.

Upstream docutils removed the offending line from the corresponding file (docutils/docutils/parsers/rst/directives/misc.py) in January 2022. Quoting the changelog [3]:

Deprecate nodes.reprunicode and nodes.ensure_str().

Drop uses of the deprecated constructs (not required with Python 3).

Do the same for kernel_include.py.

Tested against:
- Sphinx 2.4.5 (docutils 0.17.1)
- Sphinx 3.4.3 (docutils 0.17.1)
- Sphinx 5.3.0 (docutils 0.18.1)
- Sphinx 6.2.1 (docutils 0.19)
- Sphinx 7.2.6 (docutils 0.20.1)
- Sphinx 7.3.7 (docutils 0.21.2)

---
 Documentation/sphinx/kernel_include.py | 1 -
 1 file changed, 1 deletion(-)
Documentation/sphinx/kernel_include.py +0 -1
index abe768088377..638762442336 100755
@@ -97,7 +97,6 @@ class KernelInclude(Include):
         # HINT: this is the only line I had to change / commented out:
         #path = utils.relative_path(None, path)
 
-        path = nodes.reprunicode(path)
         encoding = self.options.get(
             'encoding', self.state.document.settings.input_encoding)
         e_handler=self.state.document.settings.input_encoding_error_handler

base-commit: fcb5bcefdbfbd939bf4edfa71182df0b56d20a49

Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw
Quoted 35 lines · Akira Yokosawa

Running "make htmldocs" on a newly installed Sphinx 7.3.7 ends up in a build error:

Sphinx parallel build error:
AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'

docutils 0.21 has removed nodes.reprunicode, quote from release note [1]:

* Removed objects:

docutils.nodes.reprunicode, docutils.nodes.ensure_str()
Python 2 compatibility hacks

Sphinx 7.3.0 supports docutils 0.21 [2]:

kernel_include.py, whose origin is misc.py of docutils, uses reprunicode.

Upstream docutils removed the offending line from the corresponding file (docutils/docutils/parsers/rst/directives/misc.py) in January 2022. Quoting the changelog [3]:

Deprecate nodes.reprunicode and nodes.ensure_str().

Drop uses of the deprecated constructs (not required with Python 3).

Do the same for kernel_include.py.

Tested against:
- Sphinx 2.4.5 (docutils 0.17.1)
- Sphinx 3.4.3 (docutils 0.17.1)
- Sphinx 5.3.0 (docutils 0.18.1)
- Sphinx 6.2.1 (docutils 0.19)
- Sphinx 7.2.6 (docutils 0.20.1)
- Sphinx 7.3.7 (docutils 0.21.2)

Quoted 4 lines

No htmldocs regressions on Sphinx 5.0.1.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#2 lore raw
In reply to Akira Yokosawa

Hi Jon,

Quoted 35 lines · Akira Yokosawa

Running "make htmldocs" on a newly installed Sphinx 7.3.7 ends up in a build error:

Sphinx parallel build error:
AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'

docutils 0.21 has removed nodes.reprunicode, quote from release note [1]:

* Removed objects:

docutils.nodes.reprunicode, docutils.nodes.ensure_str()
Python 2 compatibility hacks

Sphinx 7.3.0 supports docutils 0.21 [2]:

kernel_include.py, whose origin is misc.py of docutils, uses reprunicode.

Upstream docutils removed the offending line from the corresponding file (docutils/docutils/parsers/rst/directives/misc.py) in January 2022. Quoting the changelog [3]:

Deprecate nodes.reprunicode and nodes.ensure_str().

Drop uses of the deprecated constructs (not required with Python 3).

Do the same for kernel_include.py.

Tested against:
- Sphinx 2.4.5 (docutils 0.17.1)
- Sphinx 3.4.3 (docutils 0.17.1)
- Sphinx 5.3.0 (docutils 0.18.1)
- Sphinx 6.2.1 (docutils 0.19)
- Sphinx 7.2.6 (docutils 0.20.1)
- Sphinx 7.3.7 (docutils 0.21.2)

Quoted 4 lines

I forgot to put a Cc: stable@ tag.

Jon, could you do it for me?
I'm not sure how far this wants to be backported.
Maybe v6.1? It's up to you!

Thanks, Akira

maintainer
#3 lore raw
Quoted 43 lines · Akira Yokosawa

Hi Jon,

Quoted 35 lines · Akira Yokosawa

Running "make htmldocs" on a newly installed Sphinx 7.3.7 ends up in a build error:

Sphinx parallel build error:
AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'

docutils 0.21 has removed nodes.reprunicode, quote from release note [1]:

* Removed objects:

docutils.nodes.reprunicode, docutils.nodes.ensure_str()
Python 2 compatibility hacks

Sphinx 7.3.0 supports docutils 0.21 [2]:

kernel_include.py, whose origin is misc.py of docutils, uses reprunicode.

Upstream docutils removed the offending line from the corresponding file (docutils/docutils/parsers/rst/directives/misc.py) in January 2022. Quoting the changelog [3]:

Deprecate nodes.reprunicode and nodes.ensure_str().

Drop uses of the deprecated constructs (not required with Python 3).

Do the same for kernel_include.py.

Tested against:
- Sphinx 2.4.5 (docutils 0.17.1)
- Sphinx 3.4.3 (docutils 0.17.1)
- Sphinx 5.3.0 (docutils 0.18.1)
- Sphinx 6.2.1 (docutils 0.19)
- Sphinx 7.2.6 (docutils 0.20.1)
- Sphinx 7.3.7 (docutils 0.21.2)

Quoted 4 lines
Quoted 5 lines

I forgot to put a Cc: stable@ tag.

Jon, could you do it for me?
I'm not sure how far this wants to be backported.
Maybe v6.1? It's up to you!

I was planning to do that, yes. I'll try to get to the queue today.

Thanks,

jon

maintainer Applied
#4 lore raw
In reply to Akira Yokosawa
Quoted 48 lines · Akira Yokosawa

Running "make htmldocs" on a newly installed Sphinx 7.3.7 ends up in a build error:

Sphinx parallel build error:
AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'

docutils 0.21 has removed nodes.reprunicode, quote from release note [1]:

* Removed objects:

docutils.nodes.reprunicode, docutils.nodes.ensure_str()
Python 2 compatibility hacks

Sphinx 7.3.0 supports docutils 0.21 [2]:

kernel_include.py, whose origin is misc.py of docutils, uses reprunicode.

Upstream docutils removed the offending line from the corresponding file (docutils/docutils/parsers/rst/directives/misc.py) in January 2022. Quoting the changelog [3]:

Deprecate nodes.reprunicode and nodes.ensure_str().

Drop uses of the deprecated constructs (not required with Python 3).

Do the same for kernel_include.py.

Tested against:
- Sphinx 2.4.5 (docutils 0.17.1)
- Sphinx 3.4.3 (docutils 0.17.1)
- Sphinx 5.3.0 (docutils 0.18.1)
- Sphinx 6.2.1 (docutils 0.19)
- Sphinx 7.2.6 (docutils 0.20.1)
- Sphinx 7.3.7 (docutils 0.21.2)

---
 Documentation/sphinx/kernel_include.py | 1 -
 1 file changed, 1 deletion(-)
Documentation/sphinx/kernel_include.py +0 -0
index abe768088377..638762442336 100755

Documentation/sphinx/kernel_include.py class KernelInclude(Include): · line 100

Quoted 5 lines
Documentation/sphinx/kernel_include.py +0 -1
@@ -97,7 +97,6 @@ class KernelInclude(Include):
         # HINT: this is the only line I had to change / commented out:
         #path = utils.relative_path(None, path)
 
-        path = nodes.reprunicode(path)
         encoding = self.options.get(

Applied, thanks.

jon