summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-12-30 00:25:55 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-12-30 00:25:55 +0200
commit09c4c1a324bf4771b5bf2232a52819e47f5299f4 (patch)
treec74c0e9e8ba9dddc4dcc0280945148ceaa83d875
parent4f6453bc327d91c29956459951a06bcdc73ba040 (diff)
downloadmeson-duboptional.tar.gz
Make D template work even if dub is not available.duboptional
-rw-r--r--mesonbuild/templates/dlangtemplates.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/mesonbuild/templates/dlangtemplates.py b/mesonbuild/templates/dlangtemplates.py
index a3703a81e..124634c29 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):