[v2,1/2] doc: copy custom CSS on guides build
Checks
Commit Message
The custom CSS file for Sphinx guides was copied during install,
but not during build time.
Before switching to Meson, the Makefile was copying this file
in the build steps, so the doc was complete and viewable
from the build directory.
It is especially useful to get full documentation in the build directory
when building only documentation with "ninja -C build doc".
The command "ninja install" was required to get the CSS file installed,
but it requires to build the libraries as well.
The CSS file is now copied as part of the Sphinx build script,
and it will be installed as part of the whole html directory.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: create destination directory in case RtD theme is unavailable
---
buildtools/call-sphinx-build.py | 10 ++++++++++
doc/guides/meson.build | 2 --
2 files changed, 10 insertions(+), 2 deletions(-)
Comments
On 7/31/2024 9:31 AM, Thomas Monjalon wrote:
> The custom CSS file for Sphinx guides was copied during install,
> but not during build time.
> Before switching to Meson, the Makefile was copying this file
> in the build steps, so the doc was complete and viewable
> from the build directory.
>
> It is especially useful to get full documentation in the build directory
> when building only documentation with "ninja -C build doc".
> The command "ninja install" was required to get the CSS file installed,
> but it requires to build the libraries as well.
>
> The CSS file is now copied as part of the Sphinx build script,
> and it will be installed as part of the whole html directory.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
@@ -3,6 +3,8 @@
# Copyright(c) 2019 Intel Corporation
#
+import filecmp
+import shutil
import sys
import os
from os.path import join
@@ -30,4 +32,12 @@
with open(join(dst, '.html.d'), 'w') as d:
d.write('html: ' + ' '.join(srcfiles) + '\n')
+# copy custom CSS file
+css = 'custom.css'
+src_css = join(src, css)
+dst_css = join(dst, 'html', '_static', 'css', css)
+if not os.path.exists(dst_css) or not filecmp.cmp(src_css, dst_css):
+ os.makedirs(os.path.dirname(dst_css), exist_ok=True)
+ shutil.copyfile(src_css, dst_css)
+
sys.exit(process.returncode)
@@ -24,7 +24,5 @@ html_guides = custom_target('html_guides',
install: get_option('enable_docs'),
install_dir: htmldir)
-install_data(files('custom.css'), install_dir: join_paths(htmldir,'_static', 'css'))
-
doc_targets += html_guides
doc_target_names += 'HTML_Guides'