diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-03-16 18:56:06 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-05-24 19:05:06 -0400 |
commit | d3804d057976b08d37b64ccd1eb8c02fc36e5f78 (patch) | |
tree | 45d44e25f5e48e952fdc6ee3d944b850d8400fec /mesonbuild/coredata.py | |
parent | a1157780ce7ddc93ebc7824215d2a667a7390f8e (diff) | |
download | meson-d3804d057976b08d37b64ccd1eb8c02fc36e5f78.zip meson-d3804d057976b08d37b64ccd1eb8c02fc36e5f78.tar.gz meson-d3804d057976b08d37b64ccd1eb8c02fc36e5f78.tar.bz2 |
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.
Diffstat (limited to 'mesonbuild/coredata.py')
-rw-r--r-- | mesonbuild/coredata.py | 2 |
1 files changed, 1 insertions, 1 deletions
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)) |