From: Jonathan Corbet Date: Wed, 4 Jan 2023 17:47:39 +0000 (-0700) Subject: docs: Fix the docs build with Sphinx 6.0 X-Git-Tag: v5.15.92~421 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44167b74a8a370b316e1a861ffb7bd44a763304f;hp=24176bf2a1452d58b8677982a8b3a72f01d3e8ad;p=platform%2Fkernel%2Flinux-rpi.git 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 Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman --- diff --git a/Documentation/sphinx/load_config.py b/Documentation/sphinx/load_config.py index eeb394b..8b416bf 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: