From 35bdaada1dfb64366f1533a79fea670502f69732 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 1 Jun 2021 21:13:38 -0700 Subject: interpreter|build: Do Generator keyword argument checking in the interpreter For qt we already have all of the necissary checking in place. Now in the interpreter we have the same, the intrperter does all of the checking, then passed the arguments to the Generator initializer, which just assigns the passed values. This is nice, neat, and clean and fixes the layering violatino between build and interpreter. --- mesonbuild/modules/qt.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 76cc4db..f328027 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -344,12 +344,12 @@ class QtBaseModule(ExtensionModule): "please check your qt{2} installation") raise MesonException(err_msg.format('UIC', f'uic-qt{self.qt_version}', self.qt_version)) - ui_kwargs: T.Dict[str, T.Any] = { # TODO: if Generator was properly annotated… - 'output': 'ui_@BASENAME@.h', - 'arguments': kwargs['extra_args'] + ['-o', '@OUTPUT@', '@INPUT@']} # TODO: This generator isn't added to the generator list in the Interpreter - gen = build.Generator(self.uic, ui_kwargs) # type: ignore - out = gen.process_files(f'Qt{self.qt_version} ui', kwargs['sources'], state) + gen = build.Generator( + self.uic, + kwargs['extra_args'] + ['-o', '@OUTPUT@', '@INPUT@'], + ['ui_@BASENAME@.h']) + out = gen.process_files(f'Qt{self.qt_version} ui', kwargs['sources'], state) # type: ignore return ModuleReturnValue(out, [out]) @FeatureNew('qt.compile_moc', '0.59.0') @@ -382,15 +382,11 @@ class QtBaseModule(ExtensionModule): arguments = kwargs['extra_args'] + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@'] if kwargs['headers']: - moc_kwargs = {'output': 'moc_@BASENAME@.cpp', - 'arguments': arguments} - moc_gen = build.Generator(self.moc, moc_kwargs) # type: ignore - output.append(moc_gen.process_files(f'Qt{self.qt_version} moc header', kwargs['headers'], state)) + moc_gen = build.Generator(self.moc, arguments, ['moc_@BASENAME@.cpp']) + output.append(moc_gen.process_files(f'Qt{self.qt_version} moc header', kwargs['headers'], state)) # type: ignore if kwargs['sources']: - moc_kwargs = {'output': '@BASENAME@.moc', - 'arguments': arguments} - moc_gen = build.Generator(self.moc, moc_kwargs) # type: ignore - output.append(moc_gen.process_files(f'Qt{self.qt_version} moc source', kwargs['sources'], state)) + moc_gen = build.Generator(self.moc, arguments, ['@BASENAME@.moc']) + output.append(moc_gen.process_files(f'Qt{self.qt_version} moc source', kwargs['sources'], state)) # type: ignore return ModuleReturnValue(output, [output]) -- cgit v1.1