archrelease: copy trunk to extra-x86_64
[arch-packages.git] / linux-rt / trunk / fix-docgen.patch
blobc9fb89e1eadf5ebeb35193b60981dad0a3696661
1 From a3b216b0a5c2628624de605599aa6c16675578de Mon Sep 17 00:00:00 2001
2 From: Jonathan Corbet <corbet@lwn.net>
3 Date: Wed, 4 Jan 2023 13:45:35 -0700
4 Subject: [PATCH] docs: Fix the docs build with Sphinx 6.0
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Sphinx 6.0 removed the execfile_() function, which we use as part of the
10 configuration process. They *did* warn us... Just open-code the
11 functionality as is done in Sphinx itself.
13 Tested (using SPHINX_CONF, since this code is only executed with an
14 alternative config file) on various Sphinx versions from 2.5 through 6.0.
16 Reported-by: Martin Liška <mliska@suse.cz>
17 Signed-off-by: Jonathan Corbet <corbet@lwn.net>
18 ---
19 Documentation/sphinx/load_config.py | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
22 diff --git a/Documentation/sphinx/load_config.py b/Documentation/sphinx/load_config.py
23 index eeb394b39e2cc8..8b416bfd75ac17 100644
24 --- a/Documentation/sphinx/load_config.py
25 +++ b/Documentation/sphinx/load_config.py
26 @@ -3,7 +3,7 @@
28 import os
29 import sys
30 -from sphinx.util.pycompat import execfile_
31 +from sphinx.util.osutil import fs_encoding
33 # ------------------------------------------------------------------------------
34 def loadConfig(namespace):
35 @@ -48,7 +48,9 @@ def loadConfig(namespace):
36 sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
37 config = namespace.copy()
38 config['__file__'] = config_file
39 - execfile_(config_file, config)
40 + with open(config_file, 'rb') as f:
41 + code = compile(f.read(), fs_encoding, 'exec')
42 + exec(code, config)
43 del config['__file__']
44 namespace.update(config)
45 else: