diff options
| author | Egor Tensin <egor@tensin.name> | 2026-03-30 11:00:09 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-03-30 11:00:09 +0200 |
| commit | 4401ef912c9e22404f7e8fd1b6e01d1d89d9c25a (patch) | |
| tree | ce622791140f8dc556ec17efa5feafb9fd436206 /project | |
| parent | project.configuration: refactoring (diff) | |
| download | cmake-common-4401ef912c9e22404f7e8fd1b6e01d1d89d9c25a.tar.gz cmake-common-4401ef912c9e22404f7e8fd1b6e01d1d89d9c25a.zip | |
project.os: refactoring
Diffstat (limited to 'project')
| -rw-r--r-- | project/os.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/project/os.py b/project/os.py index db489ce..e60e118 100644 --- a/project/os.py +++ b/project/os.py @@ -18,13 +18,14 @@ class OS(Enum): @staticmethod def current(): system = platform.system() - if system == 'Windows': - return OS.WINDOWS - if system == 'Linux': - return OS.LINUX - if system == 'Darwin': - return OS.MACOS - raise NotImplementedError(f'unsupported OS: {system}') + mapping = { + 'Windows': OS.WINDOWS, + 'Linux': OS.LINUX, + 'Darwin': OS.MACOS, + } + if system not in mapping: + raise NotImplementedError(f'unsupported OS: {system}') + return mapping[system] def on_windows(): |
