From: Otto Moerbeek Date: Mon, 17 Feb 2025 15:06:42 +0000 (+0100) Subject: Only run python if found X-Git-Tag: dnsdist-2.0.0-alpha1~48^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=112d834a16130c97dc2e40b9290524489e6e3d29;p=thirdparty%2Fpdns.git Only run python if found --- diff --git a/docs/generate-docs.py b/docs/generate-docs.py index 839e4c7f44..6ba273fca3 100755 --- a/docs/generate-docs.py +++ b/docs/generate-docs.py @@ -41,7 +41,7 @@ def main(): sphinx_build = venv_directory.joinpath("bin").joinpath("sphinx-build") if args.pdf_name: - buildargs = [ + build_args = [ sphinx_build, "-M", "latexpdf", @@ -49,7 +49,7 @@ def main(): '.' ] else: - buildargs = [ + build_args = [ sphinx_build, "-b", "html", @@ -57,7 +57,7 @@ def main(): target_directory, ] subprocess.run( - buildargs + files, # default is to do all + build_args + files, # if files is empty, it means do all files check=True ) if args.pdf_name: diff --git a/meson.build b/meson.build index bd5ff45c33..65d453c146 100644 --- a/meson.build +++ b/meson.build @@ -1124,47 +1124,48 @@ if get_option('unit-tests-backends') endforeach endif -html_docs = custom_target( - 'html-docs', - command: [ - python, - product_source_dir / docs_dir / 'generate-docs.py', - '--build-root', '@BUILD_ROOT@', - '--source-root', '@SOURCE_ROOT@', - '--venv-name', 'venv-docs', - '--requirements-file', docs_dir / 'requirements.txt', - '--source-directory', docs_dir, - '--target-directory', '@BUILD_ROOT@' / 'html-docs', - ], - output: 'html-docs', - console: true, -) - -docs_tarball = custom_target( - 'html-docs.tar.bz2', - command: ['tar', 'cjf', 'html-docs.tar.bz2', html_docs], - output: 'html-docs.tar.bz2', -) +if python.found() + html_docs = custom_target( + 'html-docs', + command: [ + python, + product_source_dir / docs_dir / 'generate-docs.py', + '--build-root', '@BUILD_ROOT@', + '--source-root', '@SOURCE_ROOT@', + '--venv-name', 'venv-docs', + '--requirements-file', docs_dir / 'requirements.txt', + '--source-directory', docs_dir, + '--target-directory', '@BUILD_ROOT@' / 'html-docs', + ], + output: 'html-docs', + console: true, + ) -pdf_docs = custom_target( - command: [ - python, - product_source_dir / docs_dir / 'generate-docs.py', - '--build-root', '@BUILD_ROOT@', - '--source-root', '@SOURCE_ROOT@', - '--venv-name', 'venv-docs', - '--requirements-file', docs_dir / 'requirements.txt', - '--source-directory', docs_dir, - '--target-directory', '@BUILD_ROOT@', - '--pdf-name', 'PowerDNS-Authoritative.pdf', - ], - output: 'PowerDNS-Authoritative.pdf', - console: true, -) + docs_tarball = custom_target( + 'html-docs.tar.bz2', + command: ['tar', 'cjf', 'html-docs.tar.bz2', html_docs], + output: 'html-docs.tar.bz2', + ) -run_target( - 'all-docs', - # args mentioned in command line become auto-dependency - command: ['echo', 'Generated', html_docs, docs_tarball, pdf_docs], -) + pdf_docs = custom_target( + command: [ + python, + product_source_dir / docs_dir / 'generate-docs.py', + '--build-root', '@BUILD_ROOT@', + '--source-root', '@SOURCE_ROOT@', + '--venv-name', 'venv-docs', + '--requirements-file', docs_dir / 'requirements.txt', + '--source-directory', docs_dir, + '--target-directory', '@BUILD_ROOT@', + '--pdf-name', 'PowerDNS-Authoritative.pdf', + ], + output: 'PowerDNS-Authoritative.pdf', + console: true, + ) + run_target( + 'all-docs', + # args mentioned in command line become auto-dependency + command: ['echo', 'Generated', html_docs, docs_tarball, pdf_docs], + ) +endif diff --git a/pdns/dnsdistdist/meson.build b/pdns/dnsdistdist/meson.build index ddf86963d2..414fafded0 100644 --- a/pdns/dnsdistdist/meson.build +++ b/pdns/dnsdistdist/meson.build @@ -690,46 +690,48 @@ install_data( follow_symlinks: true ) -html_docs = custom_target( - 'html-docs', - command: [ - python, - product_source_dir / docs_dir / 'generate-docs.py', - '--build-root', '@BUILD_ROOT@', - '--source-root', '@SOURCE_ROOT@', - '--venv-name', 'venv-docs', - '--requirements-file', docs_dir / 'requirements.txt', - '--source-directory', docs_dir, - '--target-directory', '@BUILD_ROOT@' / 'html-docs', - ], - output: 'html-docs', - console: true, -) +if python.found() + html_docs = custom_target( + 'html-docs', + command: [ + python, + product_source_dir / docs_dir / 'generate-docs.py', + '--build-root', '@BUILD_ROOT@', + '--source-root', '@SOURCE_ROOT@', + '--venv-name', 'venv-docs', + '--requirements-file', docs_dir / 'requirements.txt', + '--source-directory', docs_dir, + '--target-directory', '@BUILD_ROOT@' / 'html-docs', + ], + output: 'html-docs', + console: true, + ) -docs_tarball = custom_target( - 'html-docs.tar.bz2', - command: ['tar', 'cjf', 'html-docs.tar.bz2', html_docs], - output: 'html-docs.tar.bz2', -) + docs_tarball = custom_target( + 'html-docs.tar.bz2', + command: ['tar', 'cjf', 'html-docs.tar.bz2', html_docs], + output: 'html-docs.tar.bz2', + ) -pdf_docs = custom_target( - command: [ - python, - product_source_dir / docs_dir / 'generate-docs.py', - '--build-root', '@BUILD_ROOT@', - '--source-root', '@SOURCE_ROOT@', - '--venv-name', 'venv-docs', - '--requirements-file', docs_dir / 'requirements.txt', - '--source-directory', docs_dir, - '--target-directory', '@BUILD_ROOT@', - '--pdf-name', 'dnsdist.pdf', - ], - output: 'dnsdist.pdf', - console: true, -) + pdf_docs = custom_target( + command: [ + python, + product_source_dir / docs_dir / 'generate-docs.py', + '--build-root', '@BUILD_ROOT@', + '--source-root', '@SOURCE_ROOT@', + '--venv-name', 'venv-docs', + '--requirements-file', docs_dir / 'requirements.txt', + '--source-directory', docs_dir, + '--target-directory', '@BUILD_ROOT@', + '--pdf-name', 'dnsdist.pdf', + ], + output: 'dnsdist.pdf', + console: true, + ) -run_target( - 'all-docs', - # args mentioned in command line become auto-dependency - command: ['echo', 'Generated', html_docs, docs_tarball, pdf_docs], -) + run_target( + 'all-docs', + # args mentioned in command line become auto-dependency + command: ['echo', 'Generated', html_docs, docs_tarball, pdf_docs], + ) +endif \ No newline at end of file diff --git a/pdns/recursordist/meson.build b/pdns/recursordist/meson.build index 7ddded8306..43f583e3fe 100644 --- a/pdns/recursordist/meson.build +++ b/pdns/recursordist/meson.build @@ -734,47 +734,48 @@ dep_conf_distfile = custom_target( install_dir: get_option('sysconfdir'), ) -html_docs = custom_target( - 'html-docs', - command: [ - python, - product_source_dir / docs_dir / 'generate-docs.py', - '--build-root', '@BUILD_ROOT@', - '--source-root', '@SOURCE_ROOT@', - '--venv-name', 'venv-docs', - '--requirements-file', docs_dir / 'requirements.txt', - '--source-directory', docs_dir, - '--target-directory', '@BUILD_ROOT@' / 'html-docs', - ], - output: 'html-docs', - console: true, -) - -docs_tarball = custom_target( - 'html-docs.tar.bz2', - command: ['tar', 'cjf', 'html-docs.tar.bz2', html_docs], - output: 'html-docs.tar.bz2', -) +if python.found() + html_docs = custom_target( + 'html-docs', + command: [ + python, + product_source_dir / docs_dir / 'generate-docs.py', + '--build-root', '@BUILD_ROOT@', + '--source-root', '@SOURCE_ROOT@', + '--venv-name', 'venv-docs', + '--requirements-file', docs_dir / 'requirements.txt', + '--source-directory', docs_dir, + '--target-directory', '@BUILD_ROOT@' / 'html-docs', + ], + output: 'html-docs', + console: true, + ) -pdf_docs = custom_target( - command: [ - python, - product_source_dir / docs_dir / 'generate-docs.py', - '--build-root', '@BUILD_ROOT@', - '--source-root', '@SOURCE_ROOT@', - '--venv-name', 'venv-docs', - '--requirements-file', docs_dir / 'requirements.txt', - '--source-directory', docs_dir, - '--target-directory', '@BUILD_ROOT@', - '--pdf-name', 'PowerDNS-Recursor.pdf', - ], - output: 'PowerDNS-Recursor.pdf', - console: true, -) + docs_tarball = custom_target( + 'html-docs.tar.bz2', + command: ['tar', 'cjf', 'html-docs.tar.bz2', html_docs], + output: 'html-docs.tar.bz2', + ) -run_target( - 'all-docs', - # args mentioned in command line become auto-dependency - command: ['echo', 'Generated', html_docs, docs_tarball, pdf_docs], -) + pdf_docs = custom_target( + command: [ + python, + product_source_dir / docs_dir / 'generate-docs.py', + '--build-root', '@BUILD_ROOT@', + '--source-root', '@SOURCE_ROOT@', + '--venv-name', 'venv-docs', + '--requirements-file', docs_dir / 'requirements.txt', + '--source-directory', docs_dir, + '--target-directory', '@BUILD_ROOT@', + '--pdf-name', 'PowerDNS-Recursor.pdf', + ], + output: 'PowerDNS-Recursor.pdf', + console: true, + ) + run_target( + 'all-docs', + # args mentioned in command line become auto-dependency + command: ['echo', 'Generated', html_docs, docs_tarball, pdf_docs], + ) +endif