interpreter: use typed_kwargs for gui_app

pull/12038/head
Dylan Baker 1 year ago committed by Eli Schwartz
parent 020610cfbe
commit 67035a181e
  1. 4
      mesonbuild/build.py
  2. 3
      mesonbuild/interpreter/interpreter.py
  3. 3
      mesonbuild/interpreter/kwargs.py
  4. 4
      mesonbuild/interpreter/type_checking.py

@ -1151,12 +1151,10 @@ class BuildTarget(Target):
# This kwarg is deprecated. The value of "none" means that the kwarg
# was not specified and win_subsystem should be used instead.
self.gui_app = None
if 'gui_app' in kwargs:
if kwargs.get('gui_app') is not None:
if 'win_subsystem' in kwargs:
raise InvalidArguments('Can specify only gui_app or win_subsystem for a target, not both.')
self.gui_app = kwargs['gui_app']
if not isinstance(self.gui_app, bool):
raise InvalidArguments('Argument gui_app must be boolean.')
self.win_subsystem = self.validate_win_subsystem(kwargs.get('win_subsystem', 'console'))
elif 'gui_app' in kwargs:
raise InvalidArguments('Argument gui_app can only be used on executables.')

@ -33,7 +33,7 @@ from ..interpreterbase import ContainerTypeInfo, InterpreterBase, KwargInfo, typ
from ..interpreterbase import noPosargs, noKwargs, permittedKwargs, noArgsFlattening, noSecondLevelHolderResolving, unholder_return
from ..interpreterbase import InterpreterException, InvalidArguments, InvalidCode, SubdirDoneRequest
from ..interpreterbase import Disabler, disablerIfNotFound
from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureBroken, FeatureNewKwargs, FeatureDeprecatedKwargs
from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureBroken, FeatureNewKwargs
from ..interpreterbase import ObjectHolder, ContextManagerObject
from ..modules import ExtensionModule, ModuleObject, MutableModuleObject, NewExtensionModule, NotFoundExtensionModule
@ -1808,7 +1808,6 @@ class Interpreter(InterpreterBase, HoldableObject):
@FeatureNewKwargs('executable', '0.42.0', ['implib'])
@FeatureNewKwargs('executable', '0.56.0', ['win_subsystem'])
@FeatureDeprecatedKwargs('executable', '0.56.0', ['gui_app'], extra_message="Use 'win_subsystem' instead.")
@permittedKwargs(build.known_exe_kwargs)
@typed_pos_args('executable', str, varargs=(str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList, build.StructuredSources, build.ExtractedObjects, build.BuildTarget))
@typed_kwargs('executable', *EXECUTABLE_KWS, allow_unknown=True)

@ -327,7 +327,8 @@ class _BuildTarget(_BaseBuildTarget):
class Executable(_BuildTarget):
pass
gui_app: T.Optional[bool]
class StaticLibrary(_BuildTarget):

@ -492,7 +492,9 @@ _BUILD_TARGET_KWS: T.List[KwargInfo] = [
# Arguments exclusive to Executable. These are separated to make integrating
# them into build_target easier
_EXCLUSIVE_EXECUTABLE_KWS: T.List[KwargInfo] = []
_EXCLUSIVE_EXECUTABLE_KWS: T.List[KwargInfo] = [
KwargInfo('gui_app', (bool, NoneType), deprecated='0.56.0', deprecated_message="Use 'win_subsystem' instead")
]
# The total list of arguments used by Executable
EXECUTABLE_KWS = [

Loading…
Cancel
Save