diff mbox series

doc: avoid using deprecated sphinx function

Message ID 20231114-b4-sphinx-deprecation-v1-1-41687254ad8e@linaro.org
State New
Headers show
Series doc: avoid using deprecated sphinx function | expand

Commit Message

Caleb Connolly Nov. 14, 2023, 3:18 p.m. UTC
The execfile_() function in sphinx has been removed after being
deprecated for some time. Follow what sphinx upstream does in [1] to
avoid using this function. This fixes "make htmldocs" on at least Arch
Linux but likely other distros too.

[1]: https://github.com/sphinx-doc/sphinx/commit/9ced1e355ad6baecd4e755a598a54877dc0aad44

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
base-commit: 92b27528d777ce85362af45e7d2974a6c856219b

// Caleb (they/them)
---
 doc/sphinx/load_config.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Tom Rini Nov. 14, 2023, 3:46 p.m. UTC | #1
On Tue, Nov 14, 2023 at 03:18:02PM +0000, Caleb Connolly wrote:

> The execfile_() function in sphinx has been removed after being
> deprecated for some time. Follow what sphinx upstream does in [1] to
> avoid using this function. This fixes "make htmldocs" on at least Arch
> Linux but likely other distros too.
> 
> [1]: https://github.com/sphinx-doc/sphinx/commit/9ced1e355ad6baecd4e755a598a54877dc0aad44
> 
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
> base-commit: 92b27528d777ce85362af45e7d2974a6c856219b

I think we should cherry-pick:
commit 0283189e8f3d0917e2ac399688df85211f48447b
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Wed Jan 4 10:47:39 2023 -0700

    docs: Fix the docs build with Sphinx 6.0

from the kernel, to keep the file in-sync. That's the only commit to
load_config.py since I believe we synced last, but there might be other
changes in Documentation/sphinx/ to grab as well.
Heinrich Schuchardt Nov. 14, 2023, 3:58 p.m. UTC | #2
On 11/14/23 16:46, Tom Rini wrote:
> On Tue, Nov 14, 2023 at 03:18:02PM +0000, Caleb Connolly wrote:
>
>> The execfile_() function in sphinx has been removed after being
>> deprecated for some time. Follow what sphinx upstream does in [1] to
>> avoid using this function. This fixes "make htmldocs" on at least Arch
>> Linux but likely other distros too.

Hello Caleb,

Did you set up an environment as described in
https://docs.u-boot.org/en/latest/build/documentation.html?

Or did you try to build with other versions of packages than those
described in doc/sphinx/requirements.txt?

It would well make sense to rework our requirements as the Sphinx 3.4.3
we are using is getting dated.

Best regards

Heinrich

>>
>> [1]: https://github.com/sphinx-doc/sphinx/commit/9ced1e355ad6baecd4e755a598a54877dc0aad44
>>
>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>> ---
>> base-commit: 92b27528d777ce85362af45e7d2974a6c856219b
>
> I think we should cherry-pick:
> commit 0283189e8f3d0917e2ac399688df85211f48447b
> Author: Jonathan Corbet <corbet@lwn.net>
> Date:   Wed Jan 4 10:47:39 2023 -0700
>
>      docs: Fix the docs build with Sphinx 6.0
>
> from the kernel, to keep the file in-sync. That's the only commit to
> load_config.py since I believe we synced last, but there might be other
> changes in Documentation/sphinx/ to grab as well.
>
Caleb Connolly Nov. 14, 2023, 4:12 p.m. UTC | #3
On 14/11/2023 15:58, Heinrich Schuchardt wrote:
> On 11/14/23 16:46, Tom Rini wrote:
>> On Tue, Nov 14, 2023 at 03:18:02PM +0000, Caleb Connolly wrote:
>>
>>> The execfile_() function in sphinx has been removed after being
>>> deprecated for some time. Follow what sphinx upstream does in [1] to
>>> avoid using this function. This fixes "make htmldocs" on at least Arch
>>> Linux but likely other distros too.
> 
> Hello Caleb,
> 
> Did you set up an environment as described in
> https://docs.u-boot.org/en/latest/build/documentation.html?

No, I used the version of the sphinx library included in my
distribution... Certainly this would have been a good place to check ><
> 
> Or did you try to build with other versions of packages than those
> described in doc/sphinx/requirements.txt?
> 
> It would well make sense to rework our requirements as the Sphinx 3.4.3
> we are using is getting dated.
> 
> Best regards
> 
> Heinrich
> 
>>>
>>> [1]:
>>> https://github.com/sphinx-doc/sphinx/commit/9ced1e355ad6baecd4e755a598a54877dc0aad44
>>>
>>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>>> ---
>>> base-commit: 92b27528d777ce85362af45e7d2974a6c856219b
>>
>> I think we should cherry-pick:
>> commit 0283189e8f3d0917e2ac399688df85211f48447b
>> Author: Jonathan Corbet <corbet@lwn.net>
>> Date:   Wed Jan 4 10:47:39 2023 -0700
>>
>>      docs: Fix the docs build with Sphinx 6.0
>>
>> from the kernel, to keep the file in-sync. That's the only commit to
>> load_config.py since I believe we synced last, but there might be other
>> changes in Documentation/sphinx/ to grab as well.

Ah, I wasn't aware that this was pulled from Linux, that makes a lot
more sense then :)
>>
>
diff mbox series

Patch

diff --git a/doc/sphinx/load_config.py b/doc/sphinx/load_config.py
index eeb394b39e2c..977b27084780 100644
--- a/doc/sphinx/load_config.py
+++ b/doc/sphinx/load_config.py
@@ -3,7 +3,6 @@ 
 
 import os
 import sys
-from sphinx.util.pycompat import execfile_
 
 # ------------------------------------------------------------------------------
 def loadConfig(namespace):
@@ -48,7 +47,7 @@  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)
+            exec(config_file.read_text(), config)
             del config['__file__']
             namespace.update(config)
         else: