From 6e7d5a0c61c10f28f761f211f9e33fc63b8a3da5 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 30 Dec 2019 00:25:55 +0200 Subject: Make D template work even if dub is not available. --- mesonbuild/templates/dlangtemplates.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mesonbuild/templates/dlangtemplates.py b/mesonbuild/templates/dlangtemplates.py index a3703a8..124634c 100644 --- a/mesonbuild/templates/dlangtemplates.py +++ b/mesonbuild/templates/dlangtemplates.py @@ -88,13 +88,15 @@ test('{test_name}', test_exe) # Make this library usable from the Dlang # build system. dlang_mod = import('dlang') -dlang_mod.generate_dub_file(meson.project_name().to_lower(), meson.source_root(), - name : meson.project_name(), - license: meson.project_license(), - sourceFiles : '{source_file}', - description : 'Meson sample project.', - version : '{version}', -) +if find_program('dub', required: false).found() + dlang_mod.generate_dub_file(meson.project_name().to_lower(), meson.source_root(), + name : meson.project_name(), + license: meson.project_license(), + sourceFiles : '{source_file}', + description : 'Meson sample project.', + version : '{version}', + ) +endif ''' def create_exe_d_sample(project_name, project_version): -- cgit v1.1