diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-08-09 10:38:14 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-08-09 19:43:45 -0400 |
commit | 223991c09e9c568f0e45f6c5c1918122af7d2776 (patch) | |
tree | 6f4043a508cb4e3c49f1bdddbad21098ba26a57d /mesonbuild/modules/i18n.py | |
parent | 487d45c1e5bfff0fbdb4747841db6a0b5b124af9 (diff) | |
download | meson-223991c09e9c568f0e45f6c5c1918122af7d2776.zip meson-223991c09e9c568f0e45f6c5c1918122af7d2776.tar.gz meson-223991c09e9c568f0e45f6c5c1918122af7d2776.tar.bz2 |
Fix i18n target name when using @BASENAME@ and configure_file() input
Fixes: #9022
Diffstat (limited to 'mesonbuild/modules/i18n.py')
-rw-r--r-- | mesonbuild/modules/i18n.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 6e841d0..57d25fd 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -108,18 +108,15 @@ class I18nModule(ExtensionModule): kwargs['command'] = command - inputfile = kwargs['input'] - # I have no idea why/how this if isinstance(inputfile, mesonlib.HoldableObject) works / used to work... - if isinstance(inputfile, mesonlib.HoldableObject): - ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs) - else: - if isinstance(inputfile, list): - # We only use this input file to create a name of the custom target. - # Thus we can ignore the other entries. - inputfile = inputfile[0] - if isinstance(inputfile, str): - inputfile = mesonlib.File.from_source_file(state.environment.source_dir, - state.subdir, inputfile) + # We only use this input file to create a name of the custom target. + # Thus we can ignore the other entries. + inputfile = mesonlib.extract_as_list(kwargs, 'input')[0] + if isinstance(inputfile, str): + inputfile = mesonlib.File.from_source_file(state.environment.source_dir, + state.subdir, inputfile) + if isinstance(inputfile, mesonlib.File): + # output could be '@BASENAME@' in which case we need to do substitutions + # to get a unique target name. output = kwargs['output'] ifile_abs = inputfile.absolute_path(state.environment.source_dir, state.environment.build_dir) @@ -127,6 +124,9 @@ class I18nModule(ExtensionModule): outputs = mesonlib.substitute_values([output], values) output = outputs[0] ct = build.CustomTarget(output + '_' + state.subdir.replace('/', '@').replace('\\', '@') + '_merge', state.subdir, state.subproject, kwargs) + else: + ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs) + return ModuleReturnValue(ct, [ct]) @FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset']) |