From 5522e8f024fb346b1ff97bb64e264fe3a2fad057 Mon Sep 17 00:00:00 2001 From: Kirill Isakov Date: Wed, 20 Apr 2022 11:04:40 +0600 Subject: [PATCH] vcs_tag: document the already supported file arg --- docs/yaml/functions/vcs_tag.yaml | 4 +++- mesonbuild/interpreter/interpreter.py | 2 ++ test cases/common/66 vcstag/meson.build | 5 +++++ test cases/common/66 vcstag/version.py | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 test cases/common/66 vcstag/version.py diff --git a/docs/yaml/functions/vcs_tag.yaml b/docs/yaml/functions/vcs_tag.yaml index 3d4a1c4be..29ef7ea0b 100644 --- a/docs/yaml/functions/vcs_tag.yaml +++ b/docs/yaml/functions/vcs_tag.yaml @@ -22,7 +22,7 @@ description: | kwargs: command: - type: list[str] + type: list[str | file] description: | The command to execute, see [[custom_target]] for details on how this command must be specified. @@ -30,6 +30,8 @@ kwargs: This parameter is optional. If it is absent, Meson will try its best to find a suitable default command. + *(since 0.62.0)* [[@file]] is accepted. + input: type: str required: true diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index ecbfd7ade..790f47f91 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1731,6 +1731,8 @@ external dependencies (including libraries) must go to "dependencies".''') vcs_cmd = kwargs['command'] source_dir = os.path.normpath(os.path.join(self.environment.get_source_dir(), self.subdir)) if vcs_cmd: + if isinstance(vcs_cmd[0], mesonlib.File): + FeatureNew.single_use('vcs_tag with file as the first argument', '0.62.0', self.subproject, location=node) maincmd = self.find_program_impl(vcs_cmd[0], required=False) if maincmd.found(): vcs_cmd[0] = maincmd diff --git a/test cases/common/66 vcstag/meson.build b/test cases/common/66 vcstag/meson.build index 520f72aa1..9eba4c65b 100644 --- a/test cases/common/66 vcstag/meson.build +++ b/test cases/common/66 vcstag/meson.build @@ -17,7 +17,12 @@ fallback : '1.0.0') version_src_fallback = vcs_tag(input : 'vcstag.c.in', output : 'vcstag-fallback.c') +version_src_file = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-file.c', +command : files('version.py')) + executable('tagprog', 'tagprog.c', version_src) executable('tagprog-custom', 'tagprog.c', version_src_custom) executable('tagprog-fallback', 'tagprog.c', version_src_fallback) executable('tagprog-notfound-fallback', 'tagprog.c', version_src_notfound_fallback) +executable('tagprog-file', 'tagprog.c', version_src_file) diff --git a/test cases/common/66 vcstag/version.py b/test cases/common/66 vcstag/version.py new file mode 100755 index 000000000..0e0185ea8 --- /dev/null +++ b/test cases/common/66 vcstag/version.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('3.14')