diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-11 14:50:58 -0700 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-09-30 21:01:38 +0200 |
commit | bb706231bd3bfd8983f1a5df24111efe1ad0734d (patch) | |
tree | 5deb12d9e904723ac08a6f269cfa3c578748387c | |
parent | 7e417ac0fa20ce8ddc3018f7c947c352730bc518 (diff) | |
download | meson-bb706231bd3bfd8983f1a5df24111efe1ad0734d.zip meson-bb706231bd3bfd8983f1a5df24111efe1ad0734d.tar.gz meson-bb706231bd3bfd8983f1a5df24111efe1ad0734d.tar.bz2 |
build: Prepare CustomTarget.process_kwargs to co-exist
We still need this to co-exist as long as there are interfaces for
CustomTarget other than `func_custom_target`, this gets us there.
-rw-r--r-- | mesonbuild/build.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index e5900ac..a7051ad 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -2388,7 +2388,7 @@ class CustomTarget(Target, CommandBase): raise InvalidArguments("Can't both capture output and output to console") if 'command' not in kwargs: raise InvalidArguments('Missing keyword argument "command".') - if 'depfile' in kwargs: + if kwargs.get('depfile') is not None: depfile = kwargs['depfile'] if not isinstance(depfile, str): raise InvalidArguments('Depfile must be a string.') @@ -2410,32 +2410,32 @@ class CustomTarget(Target, CommandBase): raise InvalidArguments('"install_dir" must be specified ' 'when installing a target') - if isinstance(kwargs['install_dir'], list): - FeatureNew.single_use('multiple install_dir for custom_target', '0.40.0', self.subproject) - # If an item in this list is False, the output corresponding to - # the list index of that item will not be installed - self.install_dir = typeslistify(kwargs['install_dir'], (str, bool)) - self.install_mode = kwargs.get('install_mode', None) - # If only one tag is provided, assume all outputs have the same tag. - # Otherwise, we must have as much tags as outputs. - self.install_tag = typeslistify(kwargs.get('install_tag', [None]), (str, bool)) - if len(self.install_tag) == 1: - self.install_tag = self.install_tag * len(self.outputs) - elif len(self.install_tag) != len(self.outputs): - m = f'Target {self.name!r} has {len(self.outputs)} outputs but {len(self.install_tag)} "install_tag"s were found.' - raise InvalidArguments(m) + if isinstance(kwargs['install_dir'], list): + FeatureNew.single_use('multiple install_dir for custom_target', '0.40.0', self.subproject) + # If an item in this list is False, the output corresponding to + # the list index of that item will not be installed + self.install_dir = typeslistify(kwargs['install_dir'], (str, bool)) + self.install_mode = kwargs.get('install_mode', None) + # If only one tag is provided, assume all outputs have the same tag. + # Otherwise, we must have as much tags as outputs. + self.install_tag = typeslistify(kwargs.get('install_tag', [None]), (str, bool)) + if len(self.install_tag) == 1: + self.install_tag = self.install_tag * len(self.outputs) + elif len(self.install_tag) != len(self.outputs): + m = f'Target {self.name!r} has {len(self.outputs)} outputs but {len(self.install_tag)} "install_tag"s were found.' + raise InvalidArguments(m) else: self.install = False self.install_dir = [None] self.install_mode = None self.install_tag = [] - if 'build_always' in kwargs and 'build_always_stale' in kwargs: + if kwargs.get('build_always') is not None and kwargs.get('build_always_stale') is not None: raise InvalidArguments('build_always and build_always_stale are mutually exclusive. Combine build_by_default and build_always_stale.') - elif 'build_always' in kwargs: - if 'build_by_default' not in kwargs: + elif kwargs.get('build_always') is not None: + if kwargs.get('build_by_default') is not None: self.build_by_default = kwargs['build_always'] self.build_always_stale = kwargs['build_always'] - elif 'build_always_stale' in kwargs: + elif kwargs.get('build_always_stale') is not None: self.build_always_stale = kwargs['build_always_stale'] if not isinstance(self.build_always_stale, bool): raise InvalidArguments('Argument build_always_stale must be a boolean.') |