[v3] dts: remove html dir from nested docs

Message ID 20241128230515.1125653-1-paul.szczepanek@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] dts: remove html dir from nested docs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-unit-arm64-testing pending Testing pending
ci/iol-testing warning apply patch failure

Commit Message

Paul Szczepanek Nov. 28, 2024, 11:05 p.m. UTC
To facilitate deploying docs to the website
and make paths more consistent remove the html
directory from docs nested in html directories.

Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
---
 buildtools/call-sphinx-build.py | 6 ++++--
 doc/api/meson.build             | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
  

Comments

Thomas Monjalon Nov. 29, 2024, 11:39 a.m. UTC | #1
29/11/2024 00:05, Paul Szczepanek:
> To facilitate deploying docs to the website
> and make paths more consistent remove the html
> directory from docs nested in html directories.
> 
> Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
> Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
> ---
>  buildtools/call-sphinx-build.py | 6 ++++--
>  doc/api/meson.build             | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py
> index 2c7de54285..3e5fc813a2 100755
> --- a/buildtools/call-sphinx-build.py
> +++ b/buildtools/call-sphinx-build.py
> @@ -30,8 +30,10 @@
>  
>  # run sphinx, putting the html output in a "html" directory
>  with open(join(dst, 'sphinx_html.out'), 'w') as out:
> -    process = run(sphinx_cmd + ['-b', 'html', src, join(dst, 'html')],
> -                  stdout=out)
> +    # don't append html dir if dst is already nested in a html dir
> +    top_2_dirs = os.path.join(*os.path.normpath(dst).split(os.path.sep)[-2:])
> +    html_dst = dst if 'html' in top_2_dirs else join(dst, 'html')
> +    process = run(sphinx_cmd + ['-b', 'html', src, html_dst], stdout=out)

There is still a file in the extra html directory:

build/doc/api/html/dts/html/_static/css/custom.css

I suppose that we need to change this line:

dst_css = join(dst, 'html', '_static', 'css', css)

into

dst_css = join(html_dst, '_static', 'css', css)

Then it should become this path:

build/doc/api/html/dts/_static/css/custom.css
  

Patch

diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py
index 2c7de54285..3e5fc813a2 100755
--- a/buildtools/call-sphinx-build.py
+++ b/buildtools/call-sphinx-build.py
@@ -30,8 +30,10 @@ 
 
 # run sphinx, putting the html output in a "html" directory
 with open(join(dst, 'sphinx_html.out'), 'w') as out:
-    process = run(sphinx_cmd + ['-b', 'html', src, join(dst, 'html')],
-                  stdout=out)
+    # don't append html dir if dst is already nested in a html dir
+    top_2_dirs = os.path.join(*os.path.normpath(dst).split(os.path.sep)[-2:])
+    html_dst = dst if 'html' in top_2_dirs else join(dst, 'html')
+    process = run(sphinx_cmd + ['-b', 'html', src, html_dst], stdout=out)
 
 # create a gcc format .d file giving all the dependencies of this doc build
 with open(join(dst, '.html.d'), 'w') as d:
diff --git a/doc/api/meson.build b/doc/api/meson.build
index f9f1326bbd..ac6eb8236d 100644
--- a/doc/api/meson.build
+++ b/doc/api/meson.build
@@ -37,7 +37,7 @@  cdata.set('OUTPUT', join_paths(dpdk_build_root, 'doc', 'api'))
 cdata.set('TOPDIR', dpdk_source_root)
 cdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, join_paths(dpdk_build_root, 'doc', 'api')]))
 cdata.set('WARN_AS_ERROR', 'NO')
-cdata.set('DTS_API_MAIN_PAGE', join_paths('.', 'dts', 'html', 'index.html'))
+cdata.set('DTS_API_MAIN_PAGE', join_paths('.', 'dts', 'index.html'))
 if get_option('werror')
     cdata.set('WARN_AS_ERROR', 'YES')
 endif