aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/templates
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-12-30 00:25:55 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-12-31 13:19:21 +0200
commit6e7d5a0c61c10f28f761f211f9e33fc63b8a3da5 (patch)
tree15f34c4abb7e89bc639da60af526c1df5beac967 /mesonbuild/templates
parente9158b477f1cb1ed24d7b87e7efca1c2a293761f (diff)
downloadmeson-6e7d5a0c61c10f28f761f211f9e33fc63b8a3da5.zip
meson-6e7d5a0c61c10f28f761f211f9e33fc63b8a3da5.tar.gz
meson-6e7d5a0c61c10f28f761f211f9e33fc63b8a3da5.tar.bz2
Make D template work even if dub is not available.
Diffstat (limited to 'mesonbuild/templates')
-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 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):