From 329783d80c69c689f97dbf08e88572187505904c Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 28 Oct 2021 20:27:39 -0400 Subject: [PATCH] guard a complicated mlog.warning inside a Feature check This is only relevant on certain versions of meson, so do not print it when meson_version is too low. The message itself is not precisely a deprecation warning, since ostensibly it may be an unlikely coding mistake. It is probably an attempt to implement `copy: true`, but it might not be, hence "warning" instead of "deprecation". So although we could switch this to a FeatureDeprecated, that is not being done at this time. --- mesonbuild/interpreter/interpreter.py | 10 ++++++---- test cases/common/14 configure file/meson.build | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 2eb7a0aad..fcf66146a 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2184,10 +2184,12 @@ This will become a hard error in the future.''', location=self.current_node) "present in the given configuration data.", location=node) if confdata_useless: ifbase = os.path.basename(inputs_abs[0]) - mlog.warning('Got an empty configuration_data() object and found no ' - f'substitutions in the input file {ifbase!r}. If you want to ' - 'copy a file to the build dir, use the \'copy:\' keyword ' - 'argument added in 0.47.0', location=node) + tv = FeatureNew.get_target_version(self.subproject) + if FeatureNew.check_version(tv, '0.47.0'): + mlog.warning('Got an empty configuration_data() object and found no ' + f'substitutions in the input file {ifbase!r}. If you want to ' + 'copy a file to the build dir, use the \'copy:\' keyword ' + 'argument added in 0.47.0', location=node) else: mesonlib.dump_conf_header(ofile_abs, conf.conf_data, output_format) conf.mark_used() diff --git a/test cases/common/14 configure file/meson.build b/test cases/common/14 configure file/meson.build index 8fdca210d..416dad7fa 100644 --- a/test cases/common/14 configure file/meson.build +++ b/test cases/common/14 configure file/meson.build @@ -1,4 +1,4 @@ -project('configure file test', 'c') +project('configure file test', 'c', meson_version: '>=0.47.0') conf = configuration_data()