diff options
| author | Egor Tensin <egor@tensin.name> | 2026-10-09 16:49:25 +0500 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-10-09 16:58:00 +0500 |
| commit | 21a16d5f91429cf2a61dcdae45c5448c096123d7 (patch) | |
| tree | 8052fd16287a06c4d0fd564cb62cf44de0b60d76 /project/configuration.py | |
| parent | ugprade to StrEnum (diff) | |
| download | cmake-common-21a16d5f91429cf2a61dcdae45c5448c096123d7.tar.gz cmake-common-21a16d5f91429cf2a61dcdae45c5448c096123d7.zip | |
use the match statement
Diffstat (limited to 'project/configuration.py')
| -rw-r--r-- | project/configuration.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/project/configuration.py b/project/configuration.py index 69dfe10..3e925d7 100644 --- a/project/configuration.py +++ b/project/configuration.py @@ -22,7 +22,7 @@ class Configuration(StrEnum): @staticmethod def parse(s): try: - return Configuration(s) + return Configuration(s.lower()) except ValueError as e: raise argparse.ArgumentTypeError(f"invalid configuration: {s}") from e @@ -34,9 +34,11 @@ class Configuration(StrEnum): install_dir/PLATFORM/CONFIGURATION/lib, if CONFIGURATION is MinSizeRel/RelWithDebInfo. """ - if self in (Configuration.MINSIZEREL, Configuration.RELWITHDEBINFO): - return Configuration.RELEASE.b2_variant() - return str(self).lower() + match self: + case Configuration.MINSIZEREL | Configuration.RELWITHDEBINFO: + return Configuration.RELEASE.b2_variant() + case _: + return self.lower() def b2_args(self): return [f"variant={self.b2_variant()}"] |
