From 4c933db11cb72da3e727110d1c83541b2e539b5e Mon Sep 17 00:00:00 2001 From: Eyal Itkin Date: Sat, 23 Nov 2024 18:21:09 +0200 Subject: [PATCH] Allow setting build_by_default to False when install is True Allow setting build_by_default to False even when install is True. An improper code check for the default case accidently covered also the case in which the value is explicitly being passed by the user, causing the user's value to be ignored. Resolves #13498. Signed-off-by: Eyal Itkin --- mesonbuild/build.py | 2 +- test cases/common/129 build by default/meson.build | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index a00209ad45a8..6f5ed2a36f2c 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -650,7 +650,7 @@ def process_kwargs_base(self, kwargs: T.Dict[str, T.Any]) -> None: if not isinstance(self.build_by_default, bool): raise InvalidArguments('build_by_default must be a boolean value.') - if not self.build_by_default and kwargs.get('install', False): + elif not self.build_by_default and kwargs.get('install', False): # For backward compatibility, if build_by_default is not explicitly # set, use the value of 'install' if it's enabled. self.build_by_default = True diff --git a/test cases/common/129 build by default/meson.build b/test cases/common/129 build by default/meson.build index b797f76e9cef..0d63e77e76ce 100644 --- a/test cases/common/129 build by default/meson.build +++ b/test cases/common/129 build by default/meson.build @@ -9,6 +9,7 @@ executable('fooprog', 'foo.c', executable('barprog', 'foo.c', build_by_default : false, + install : true, ) comp = files('mygen.py')