diff options
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 4ee0485..7ee4bb9 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2280,6 +2280,7 @@ class Interpreter(InterpreterBase): 'they are mutually exclusive.') # Validate input inputfile = None + ifile_abs = None if 'input' in kwargs: inputfile = kwargs['input'] if isinstance(inputfile, list): @@ -2290,8 +2291,8 @@ class Interpreter(InterpreterBase): if not isinstance(inputfile, (str, mesonlib.File)): raise InterpreterException('Input must be a string or a file') ifile_abs = os.path.join(self.environment.source_dir, self.subdir, inputfile) - elif 'command' in kwargs: - raise InterpreterException('Required keyword argument \'input\' missing') + elif 'command' in kwargs and '@INPUT@' in kwargs['command']: + raise InterpreterException('@INPUT@ used as command argument, but no input file specified.') # Validate output output = kwargs['output'] if not isinstance(output, str): @@ -2320,7 +2321,10 @@ class Interpreter(InterpreterBase): # We use absolute paths for input and output here because the cwd # that the command is run from is 'unspecified', so it could change. # Currently it's builddir/subdir for in_builddir else srcdir/subdir. - values = mesonlib.get_filenames_templates_dict([ifile_abs], [ofile_abs]) + if ifile_abs: + values = mesonlib.get_filenames_templates_dict([ifile_abs], [ofile_abs]) + else: + values = mesonlib.get_filenames_templates_dict(None, [ofile_abs]) # Substitute @INPUT@, @OUTPUT@, etc here. cmd = mesonlib.substitute_values(kwargs['command'], values) mlog.log('Configuring', mlog.bold(output), 'with command') |