diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-03-22 21:48:45 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-05-31 17:49:29 -0400 |
commit | e3d70d89b1ff17a34dd7e8d3de18647b26d171f0 (patch) | |
tree | 78a3bc56ec15dce368dd74e0a7e9a13a0d0ae04a /mesonbuild/interpreter | |
parent | ae0b40945b08482d04b594187f266c77878a32b5 (diff) | |
download | meson-e3d70d89b1ff17a34dd7e8d3de18647b26d171f0.zip meson-e3d70d89b1ff17a34dd7e8d3de18647b26d171f0.tar.gz meson-e3d70d89b1ff17a34dd7e8d3de18647b26d171f0.tar.bz2 |
fix regression that broke type checking of CustomTarget outputs
We validate a few things here, such as the non-presence of '@INPUT' in
an output name. These got moved out of the CustomTarget constructor in
commit 11f96380351a88059ec55f1070fdebc1b1033117 and into KwargInfo, but
only for kwargs that took multiple values. This caused configure_file()
and unstable_rust.bindgen() to stop checking for this.
Add a shared single-output KW and use it in both places. This now
dispatches to _output_validator.
configure_file now validates subdirectories in output names the same way
we do elsewhere, directly in the typed_kwargs and by specifying the
erroring kwarg.
Diffstat (limited to 'mesonbuild/interpreter')
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 5 | ||||
-rw-r--r-- | mesonbuild/interpreter/type_checking.py | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 1876f21..8411285 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -58,6 +58,7 @@ from .type_checking import ( CT_INPUT_KW, CT_INSTALL_DIR_KW, CT_OUTPUT_KW, + OUTPUT_KW, DEFAULT_OPTIONS, DEPENDS_KW, DEPEND_FILES_KW, @@ -2392,7 +2393,7 @@ class Interpreter(InterpreterBase, HoldableObject): KwargInfo('install', (bool, NoneType), since='0.50.0'), KwargInfo('install_dir', (str, bool), default='', validator=lambda x: 'must be `false` if boolean' if x is True else None), - KwargInfo('output', str, required=True), + OUTPUT_KW, KwargInfo('output_format', str, default='c', since='0.47.0', validator=in_set_validator({'c', 'nasm'})), ) @@ -2448,8 +2449,6 @@ class Interpreter(InterpreterBase, HoldableObject): 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 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)) ofile_abs = os.path.join(self.environment.build_dir, ofile_path, ofile_fname) diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 407e10d..e83624c 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -277,6 +277,13 @@ CT_OUTPUT_KW: KwargInfo[T.List[str]] = KwargInfo( validator=_output_validator, ) +OUTPUT_KW: KwargInfo[str] = KwargInfo( + 'output', + str, + required=True, + validator=lambda x: _output_validator([x]) +) + CT_INPUT_KW: KwargInfo[T.List[T.Union[str, File, ExternalProgram, BuildTarget, CustomTarget, CustomTargetIndex, ExtractedObjects, GeneratedList]]] = KwargInfo( 'input', ContainerTypeInfo(list, (str, File, ExternalProgram, BuildTarget, CustomTarget, CustomTargetIndex, ExtractedObjects, GeneratedList)), |