1 |
From 0283189e8f3d0917e2ac399688df85211f48447b Mon Sep 17 00:00:00 2001 |
2 |
From: Jonathan Corbet <corbet@lwn.net> |
3 |
Date: Wed, 4 Jan 2023 10:47:39 -0700 |
4 |
Subject: 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 |
8 |
|
9 |
From: Jonathan Corbet <corbet@lwn.net> |
10 |
|
11 |
commit 0283189e8f3d0917e2ac399688df85211f48447b upstream. |
12 |
|
13 |
Sphinx 6.0 removed the execfile_() function, which we use as part of the |
14 |
configuration process. They *did* warn us... Just open-code the |
15 |
functionality as is done in Sphinx itself. |
16 |
|
17 |
Tested (using SPHINX_CONF, since this code is only executed with an |
18 |
alternative config file) on various Sphinx versions from 2.5 through 6.0. |
19 |
|
20 |
Reported-by: Martin Liška <mliska@suse.cz> |
21 |
Cc: stable@vger.kernel.org |
22 |
Signed-off-by: Jonathan Corbet <corbet@lwn.net> |
23 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
24 |
--- |
25 |
Documentation/sphinx/load_config.py | 6 ++++-- |
26 |
1 file changed, 4 insertions(+), 2 deletions(-) |
27 |
|
28 |
--- a/Documentation/sphinx/load_config.py |
29 |
+++ b/Documentation/sphinx/load_config.py |
30 |
@@ -3,7 +3,7 @@ |
31 |
|
32 |
import os |
33 |
import sys |
34 |
-from sphinx.util.pycompat import execfile_ |
35 |
+from sphinx.util.osutil import fs_encoding |
36 |
|
37 |
# ------------------------------------------------------------------------------ |
38 |
def loadConfig(namespace): |
39 |
@@ -48,7 +48,9 @@ def loadConfig(namespace): |
40 |
sys.stdout.write("load additional sphinx-config: %s\n" % config_file) |
41 |
config = namespace.copy() |
42 |
config['__file__'] = config_file |
43 |
- execfile_(config_file, config) |
44 |
+ with open(config_file, 'rb') as f: |
45 |
+ code = compile(f.read(), fs_encoding, 'exec') |
46 |
+ exec(code, config) |
47 |
del config['__file__'] |
48 |
namespace.update(config) |
49 |
else: |