Skip to content

Commit 0283189

Browse files
author
Jonathan Corbet
committed
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 <[email protected]> Cc: [email protected] Signed-off-by: Jonathan Corbet <[email protected]>
1 parent 1b929c0 commit 0283189

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Documentation/sphinx/load_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import os
55
import sys
6-
from sphinx.util.pycompat import execfile_
6+
from sphinx.util.osutil import fs_encoding
77

88
# ------------------------------------------------------------------------------
99
def loadConfig(namespace):
@@ -48,7 +48,9 @@ def loadConfig(namespace):
4848
sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
4949
config = namespace.copy()
5050
config['__file__'] = config_file
51-
execfile_(config_file, config)
51+
with open(config_file, 'rb') as f:
52+
code = compile(f.read(), fs_encoding, 'exec')
53+
exec(code, config)
5254
del config['__file__']
5355
namespace.update(config)
5456
else:

0 commit comments

Comments
 (0)