aboutsummaryrefslogtreecommitdiff
path: root/doc/sphinx/load_config.py
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2023-01-04 10:47:39 -0700
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-11-20 19:06:22 +0100
commitdc23eb8e0e1ea07f9a60d60fb3af053c931bcb46 (patch)
treeecd52bcf4742d0d3c094932557f2483bfccccfe3 /doc/sphinx/load_config.py
parent63e41659f22daf8dfd96c3c092d3ff88a9315d4a (diff)
downloadu-boot-dc23eb8e0e1ea07f9a60d60fb3af053c931bcb46.zip
u-boot-dc23eb8e0e1ea07f9a60d60fb3af053c931bcb46.tar.gz
u-boot-dc23eb8e0e1ea07f9a60d60fb3af053c931bcb46.tar.bz2
docs: Fix the docs build with Sphinx 6.0
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> Rebased for U-Boot Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'doc/sphinx/load_config.py')
-rw-r--r--doc/sphinx/load_config.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/sphinx/load_config.py b/doc/sphinx/load_config.py
index eeb394b..8b416bf 100644
--- a/doc/sphinx/load_config.py
+++ b/doc/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: