From d3804d057976b08d37b64ccd1eb8c02fc36e5f78 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 16 Mar 2023 18:56:06 -0400 Subject: Remove pointless install_umask validation check for None This option can never have a value of None. There are only two sources of values at all: - the class instance initializer when defining BUILTIN_CORE_OPTIONS - user-provided command-line or machine file values etc. which can only be meson types We know we don't construct the Option instance with None, and users cannot pass a None anywhere since that's not a meson type. The only reason this was ever checked for was as an artifact during the initial implementation of the option in commit 8651d55c6a317de37dcaa9965157151095a88292. At the time, a review comment was made that `-Dinstall_umask=none` was a bad UX and "preserve" should be used instead. Before that, this option type accepted `None` (in the BUILTIN_CORE_OPTIONS initializer) and `'none'` (provided by users) which is odd and should have consistently been the latter. Then inside set_value, it checked for the magic initializer value and converted it to the real value. After review comments and a force-push, the patch ended up using `None` in the initializer, and `'preserve'` everywhere else, and still handling both in set_value and converting both to a proper string. In the very next commit in the patch series, the initializer was migrated to use an actual umask of 022, and now `None` was entirely impossible to get anywhere at all. But the wart of checking for it was never removed. Remove it at long last. --- mesonbuild/coredata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild') diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 5365f6d..f1cf0e0 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -191,7 +191,7 @@ class UserUmaskOption(UserIntegerOption, UserOption[T.Union[str, OctalInt]]): return format(self.value, '04o') def validate_value(self, value: T.Any) -> T.Union[str, OctalInt]: - if value is None or value == 'preserve': + if value == 'preserve': return 'preserve' return OctalInt(super().validate_value(value)) -- cgit v1.1