aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorMathieu Duponchelle <MathieuDuponchelle@users.noreply.github.com>2018-06-01 19:53:07 +0200
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-01 17:53:07 +0000
commit14750b50ea9c9f53237bed59a79365e1ebbdacda (patch)
tree9497bd107cc4889bdb6daf60094bf650c1315e82 /mesonbuild/interpreter.py
parent17cb364046661c2d72193b4d8691070fd0fb276b (diff)
downloadmeson-14750b50ea9c9f53237bed59a79365e1ebbdacda.zip
meson-14750b50ea9c9f53237bed59a79365e1ebbdacda.tar.gz
meson-14750b50ea9c9f53237bed59a79365e1ebbdacda.tar.bz2
configure_file: Add output_format kwarg (#3636)
* configure_file: Add output_format kwarg * docs: Reference-manual.md output_format was added in 0.47 [skip ci]
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 4f2d45e..d2238d7 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1697,7 +1697,7 @@ permitted_kwargs = {'add_global_arguments': {'language'},
'add_test_setup': {'exe_wrapper', 'gdb', 'timeout_multiplier', 'env'},
'benchmark': {'args', 'env', 'should_fail', 'timeout', 'workdir', 'suite'},
'build_target': known_build_target_kwargs,
- 'configure_file': {'input', 'output', 'configuration', 'command', 'copy', 'install_dir', 'capture', 'install', 'format'},
+ 'configure_file': {'input', 'output', 'configuration', 'command', 'copy', 'install_dir', 'capture', 'install', 'format', 'output_format'},
'custom_target': {'input', 'output', 'command', 'install', 'install_dir', 'build_always', 'capture', 'depends', 'depend_files', 'depfile', 'build_by_default'},
'dependency': {'default_options', 'fallback', 'language', 'main', 'method', 'modules', 'optional_modules', 'native', 'required', 'static', 'version', 'private_headers'},
'declare_dependency': {'include_directories', 'link_with', 'sources', 'dependencies', 'compile_args', 'link_args', 'link_whole', 'version'},
@@ -3196,6 +3196,16 @@ root and issuing %s.
if fmt not in ('meson', 'cmake', 'cmake@'):
raise InterpreterException('"format" possible values are "meson", "cmake" or "cmake@".')
+ if 'output_format' in kwargs:
+ output_format = kwargs['output_format']
+ if not isinstance(output_format, str):
+ raise InterpreterException('"output_format" keyword must be a string.')
+ else:
+ output_format = 'c'
+
+ if output_format not in ('c', 'nasm'):
+ raise InterpreterException('"format" possible values are "c" or "nasm".')
+
# Validate input
inputfile = None
ifile_abs = None
@@ -3258,7 +3268,7 @@ root and issuing %s.
"present in the given configuration data." % (
var_list, inputfile), location=node)
else:
- mesonlib.dump_conf_header(ofile_abs, conf.held_object)
+ mesonlib.dump_conf_header(ofile_abs, conf.held_object, output_format)
conf.mark_used()
elif 'command' in kwargs:
# We use absolute paths for input and output here because the cwd