diff options
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 5 | ||||
-rw-r--r-- | mesonbuild/interpreter/type_checking.py | 7 | ||||
-rw-r--r-- | mesonbuild/modules/unstable_rust.py | 4 | ||||
-rw-r--r-- | test cases/failing/26 output subdir/test.json | 2 |
4 files changed, 12 insertions, 6 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)), diff --git a/mesonbuild/modules/unstable_rust.py b/mesonbuild/modules/unstable_rust.py index 4d6718e..e31a697 100644 --- a/mesonbuild/modules/unstable_rust.py +++ b/mesonbuild/modules/unstable_rust.py @@ -19,7 +19,7 @@ from . import ExtensionModule, ModuleReturnValue from .. import mlog from ..build import BothLibraries, BuildTarget, CustomTargetIndex, Executable, ExtractedObjects, GeneratedList, IncludeDirs, CustomTarget, StructuredSources from ..dependencies import Dependency, ExternalLibrary -from ..interpreter.interpreter import TEST_KWARGS +from ..interpreter.interpreter import TEST_KWARGS, OUTPUT_KW from ..interpreterbase import ContainerTypeInfo, InterpreterException, KwargInfo, FeatureNew, typed_kwargs, typed_pos_args, noPosargs from ..mesonlib import File @@ -173,7 +173,7 @@ class RustModule(ExtensionModule): listify=True, required=True, ), - KwargInfo('output', str, required=True), + OUTPUT_KW, ) def bindgen(self, state: 'ModuleState', args: T.List, kwargs: 'FuncBindgen') -> ModuleReturnValue: """Wrapper around bindgen to simplify it's use. diff --git a/test cases/failing/26 output subdir/test.json b/test cases/failing/26 output subdir/test.json index 796468d..df09726 100644 --- a/test cases/failing/26 output subdir/test.json +++ b/test cases/failing/26 output subdir/test.json @@ -1,7 +1,7 @@ { "stdout": [ { - "line": "test cases/failing/26 output subdir/meson.build:3:0: ERROR: Output file name must not contain a subdirectory." + "line": "test cases/failing/26 output subdir/meson.build:3:0: ERROR: configure_file keyword argument \"output\" Output 'subdir/foo' must not contain a path segment." } ] } |