diff options
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 5f9b98a..6b1fb76 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -653,12 +653,18 @@ def do_conf_file(src, dst, confdata, format, encoding='utf-8'): result = [] missing_variables = set() + # Detect when the configuration data is empty and no tokens were found + # during substitution so we can warn the user to use the `copy:` kwarg. + confdata_useless = not confdata.keys() for line in data: if line.startswith(search_token): + confdata_useless = False line = do_mesondefine(line, confdata) else: line, missing = do_replacement(regex, line, format, confdata) missing_variables.update(missing) + if missing: + confdata_useless = False result.append(line) dst_tmp = dst + '~' try: @@ -668,7 +674,7 @@ def do_conf_file(src, dst, confdata, format, encoding='utf-8'): raise MesonException('Could not write output file %s: %s' % (dst, str(e))) shutil.copymode(src, dst_tmp) replace_if_different(dst, dst_tmp) - return missing_variables + return missing_variables, confdata_useless CONF_C_PRELUDE = '''/* * Autogenerated by the Meson build system. |