aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-07-19 01:17:34 +0300
committerGitHub <noreply@github.com>2018-07-19 01:17:34 +0300
commitf390a0a2f39a952422bb8f6d4760b1a576e6d0b9 (patch)
treeca1e337b9f4135f078b93fbd855516a4b0eccf27 /mesonbuild/interpreter.py
parentb4c635a2e85a92bd0c3dd69c2d70612d09158bbd (diff)
parent0f15d7982cf0bbed9bb6845d4d4784a5754594ed (diff)
downloadmeson-f390a0a2f39a952422bb8f6d4760b1a576e6d0b9.zip
meson-f390a0a2f39a952422bb8f6d4760b1a576e6d0b9.tar.gz
meson-f390a0a2f39a952422bb8f6d4760b1a576e6d0b9.tar.bz2
Merge pull request #3814 from behlec/configure-file-output
Check if calls to configure_file write to the same output file.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 2c54eae..94f7bfe 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1868,6 +1868,7 @@ class Interpreter(InterpreterBase):
self.global_args_frozen = False # implies self.project_args_frozen
self.subprojects = {}
self.subproject_stack = []
+ self.configure_file_outputs = {}
# Passed from the outside, only used in subprojects.
if default_project_options:
self.default_project_options = default_project_options.copy()
@@ -3453,8 +3454,16 @@ root and issuing %s.
raise InterpreterException('@INPUT@ used as command argument, but no input file specified.')
# Validate output
output = kwargs['output']
+ ofile_rpath = os.path.join(self.subdir, output)
if not isinstance(output, str):
raise InterpreterException('Output file name must be a string')
+ if ofile_rpath in self.configure_file_outputs:
+ mesonbuildfile = os.path.join(self.subdir, 'meson.build')
+ current_call = "{}:{}".format(mesonbuildfile, self.current_lineno)
+ first_call = "{}:{}".format(mesonbuildfile, self.configure_file_outputs[ofile_rpath])
+ mlog.warning('Output file', mlog.bold(ofile_rpath, True), 'for configure_file() at', current_call, 'overwrites configure_file() output at', first_call)
+ else:
+ self.configure_file_outputs[ofile_rpath] = self.current_lineno
if ifile_abs:
values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
outputs = mesonlib.substitute_values([output], values)