diff options
author | Christoph Behle <behlec@gmail.com> | 2018-10-06 17:19:09 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-07 19:06:01 +0300 |
commit | c0236e10f36448703ca2f85689aaa880810d93c6 (patch) | |
tree | d0ec0e7765b295ce6a201751f4d9d87c6642ed2b /mesonbuild/interpreter.py | |
parent | 646a073e36fb273f3267ecd424502c4d8480c0bb (diff) | |
download | meson-c0236e10f36448703ca2f85689aaa880810d93c6.zip meson-c0236e10f36448703ca2f85689aaa880810d93c6.tar.gz meson-c0236e10f36448703ca2f85689aaa880810d93c6.tar.bz2 |
Substitute output file then check for conflict.
Fixes Issue #4323.
The check to see if a call to configure_file() overwrites the output of
a preceding call should perform the substitution for the output file
before doing the check.
Added tests to ensure the proper behaviour.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index c05b92a..cf94fe5 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -3540,9 +3540,13 @@ 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 ifile_abs: + values = mesonlib.get_filenames_templates_dict([ifile_abs], None) + outputs = mesonlib.substitute_values([output], values) + output = outputs[0] + ofile_rpath = os.path.join(self.subdir, output) if ofile_rpath in self.configure_file_outputs: mesonbuildfile = os.path.join(self.subdir, 'meson.build') current_call = "{}:{}".format(mesonbuildfile, self.current_lineno) @@ -3550,10 +3554,6 @@ root and issuing %s. 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) - output = outputs[0] if os.path.dirname(output) != '': raise InterpreterException('Output file name must not contain a subdirectory.') (ofile_path, ofile_fname) = os.path.split(os.path.join(self.subdir, output)) |