summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2023-01-04 20:47:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-18 13:44:53 +0300
commiteaabceae1b70d78c9d7ecc6f33dff5e173623973 (patch)
tree483e4442e2d24407431c618eb042c1bb51d0b40c /Documentation
parent38c4a17c6b32f7c6679b30de390c466c7367fe6b (diff)
downloadlinux-eaabceae1b70d78c9d7ecc6f33dff5e173623973.tar.xz
docs: Fix the docs build with Sphinx 6.0
commit 0283189e8f3d0917e2ac399688df85211f48447b upstream. Sphinx 6.0 removed the execfile_() function, which we use as part of the configuration process. They *did* warn us... Just open-code the functionality as is done in Sphinx itself. Tested (using SPHINX_CONF, since this code is only executed with an alternative config file) on various Sphinx versions from 2.5 through 6.0. Reported-by: Martin Liška <mliska@suse.cz> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/sphinx/load_config.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Documentation/sphinx/load_config.py b/Documentation/sphinx/load_config.py
index eeb394b39e2c..8b416bfd75ac 100644
--- a/Documentation/sphinx/load_config.py
+++ b/Documentation/sphinx/load_config.py
@@ -3,7 +3,7 @@
import os
import sys
-from sphinx.util.pycompat import execfile_
+from sphinx.util.osutil import fs_encoding
# ------------------------------------------------------------------------------
def loadConfig(namespace):
@@ -48,7 +48,9 @@ def loadConfig(namespace):
sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
config = namespace.copy()
config['__file__'] = config_file
- execfile_(config_file, config)
+ with open(config_file, 'rb') as f:
+ code = compile(f.read(), fs_encoding, 'exec')
+ exec(code, config)
del config['__file__']
namespace.update(config)
else: