File: 0007-fix-docs-build-with-Sphinx-4.patch

package info (click to toggle)
speedcrunch 0.12.0-7
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 14,208 kB
  • sloc: cpp: 17,603; ansic: 14,719; javascript: 8,678; python: 557; sh: 236; xml: 135; makefile: 23
file content (35 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: Felix Geyer <fgeyer@debian.org>
Date: Sat, 29 Oct 2022 10:55:34 +0200
Subject: Fix FTBFS with Sphinx >= 4

Pass the type instead of an instance to add_lexer().

> Sphinx.add_lexer():
> Take a lexer class as an argument.
> An instance of lexers are still supported until Sphinx-3.x.

--- speedcrunch-0.12.0.orig/doc/src/extensions/sc_lexer.py
+++ speedcrunch-0.12.0/doc/src/extensions/sc_lexer.py
@@ -108,16 +108,18 @@ class SpeedCrunchSessionLexer(SpeedCrunc
         ]
     }

+    def __init__(self):
+        super().__init__(stripnl=False)
+        self.add_filter('raiseonerror')
+

 __all__ = ['SpeedCrunchLexer', 'SpeedCrunchSessionLexer']


 # Sphinx extension interface
 def setup(app):
-    sc_lexer = SpeedCrunchSessionLexer(stripnl=False)
-    sc_lexer.add_filter('raiseonerror')
-    app.add_lexer('sc', sc_lexer)
-    app.add_lexer('speedcrunch', sc_lexer)
+    app.add_lexer('sc', SpeedCrunchSessionLexer)
+    app.add_lexer('speedcrunch', SpeedCrunchSessionLexer)
     return {
         'version': '0.1',
         'parallel_read_safe': True,