summaryrefslogtreecommitdiff
path: root/mesonbuild/utils
diff options
context:
space:
mode:
authorStas Sergeev <stsp@users.sourceforge.net>2024-05-07 21:46:55 +0300
committerDylan Baker <dylan@pnwbakers.com>2024-05-09 12:27:35 -0700
commitcfd57180eef9036c7167c5682b9f3055a540fccc (patch)
tree65f8ed46c385af05d6387aec6d16b1fcd311564f /mesonbuild/utils
parentf8aefe20703e3d64710fa675d511f9bef77dc32a (diff)
downloadmeson-cfd57180eef9036c7167c5682b9f3055a540fccc.tar.gz
implement @PLAINNAME0@ and @BASENAME0@
@PLAINNAME@ and @BASENAME@ cannot be used in custom_target() with multiple inputs. For those, similar macros are needed with an index. Fixes #13164
Diffstat (limited to 'mesonbuild/utils')
-rw-r--r--mesonbuild/utils/universal.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index ce9afd96b..c831169c5 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -1744,6 +1744,8 @@ def get_filenames_templates_dict(inputs: T.List[str], outputs: T.List[str]) -> T
If there is more than one input file, the following keys are also created:
@INPUT0@, @INPUT1@, ... one for each input file
+ @PLAINNAME0@, @PLAINNAME1@, ... one for each input file
+ @BASENAME0@, @BASENAME1@, ... one for each input file
If there is more than one output file, the following keys are also created:
@@ -1757,6 +1759,9 @@ def get_filenames_templates_dict(inputs: T.List[str], outputs: T.List[str]) -> T
for (ii, vv) in enumerate(inputs):
# Write out @INPUT0@, @INPUT1@, ...
values[f'@INPUT{ii}@'] = vv
+ plain = os.path.basename(vv)
+ values[f'@PLAINNAME{ii}@'] = plain
+ values[f'@BASENAME{ii}@'] = os.path.splitext(plain)[0]
if len(inputs) == 1:
# Just one value, substitute @PLAINNAME@ and @BASENAME@
values['@PLAINNAME@'] = plain = os.path.basename(inputs[0])