aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/basic.yml2
-rw-r--r--project/configuration.py15
-rw-r--r--project/linkage.py11
-rw-r--r--project/os.py13
-rw-r--r--project/platform.py13
-rw-r--r--project/toolset.py27
-rw-r--r--pyproject.toml4
7 files changed, 31 insertions, 54 deletions
diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml
index 94345b3..8d2bc1e 100644
--- a/.github/workflows/basic.yml
+++ b/.github/workflows/basic.yml
@@ -51,8 +51,6 @@ jobs:
strategy:
matrix:
python-version:
- - '3.9'
- - '3.10'
- '3.11'
- '3.12'
- '3.13'
diff --git a/project/configuration.py b/project/configuration.py
index e98b9c1..69dfe10 100644
--- a/project/configuration.py
+++ b/project/configuration.py
@@ -4,19 +4,16 @@
# Distributed under the MIT License.
import argparse
-from enum import Enum
+from enum import auto, StrEnum
-class Configuration(Enum):
+class Configuration(StrEnum):
"""Correspond to CMake's default CMAKE_BUILD_TYPE values."""
- DEBUG = "Debug"
- MINSIZEREL = "MinSizeRel"
- RELWITHDEBINFO = "RelWithDebInfo"
- RELEASE = "Release"
-
- def __str__(self):
- return str(self.value)
+ DEBUG = auto()
+ MINSIZEREL = auto()
+ RELWITHDEBINFO = auto()
+ RELEASE = auto()
@staticmethod
def all():
diff --git a/project/linkage.py b/project/linkage.py
index dfa474d..b952031 100644
--- a/project/linkage.py
+++ b/project/linkage.py
@@ -4,18 +4,15 @@
# Distributed under the MIT License.
import argparse
-from enum import Enum
+from enum import auto, StrEnum
import logging
from project.os import on_linux_like
-class Linkage(Enum):
- STATIC = "static"
- SHARED = "shared"
-
- def __str__(self):
- return str(self.value)
+class Linkage(StrEnum):
+ STATIC = auto()
+ SHARED = auto()
@staticmethod
def all():
diff --git a/project/os.py b/project/os.py
index 4ddf703..199086f 100644
--- a/project/os.py
+++ b/project/os.py
@@ -3,17 +3,14 @@
# For details, see https://github.com/egor-tensin/cmake-common
# Distributed under the MIT License.
-from enum import Enum
+from enum import auto, StrEnum
import platform
-class OS(Enum):
- WINDOWS = "Windows"
- LINUX = "Linux"
- MACOS = "macOS"
-
- def __str__(self):
- return str(self.value)
+class OS(StrEnum):
+ WINDOWS = auto()
+ LINUX = auto()
+ MACOS = auto()
@staticmethod
def current():
diff --git a/project/platform.py b/project/platform.py
index cae02a4..5091f7f 100644
--- a/project/platform.py
+++ b/project/platform.py
@@ -4,23 +4,20 @@
# Distributed under the MIT License.
import argparse
-from enum import Enum
+from enum import auto, StrEnum
import os.path
import platform
from project.os import on_windows
-class Platform(Enum):
+class Platform(StrEnum):
# I only build for x86(-64), so here it goes.
- X86 = "x86"
- X64 = "x64"
+ X86 = auto()
+ X64 = auto()
# 'auto' means that no additional arguments will be passed to either
# Boost's b2 nor CMake (except on Windows, see below).
- AUTO = "auto"
-
- def __str__(self):
- return str(self.value)
+ AUTO = auto()
@staticmethod
def windows_native():
diff --git a/project/toolset.py b/project/toolset.py
index 8b6ea07..f93881f 100644
--- a/project/toolset.py
+++ b/project/toolset.py
@@ -25,7 +25,7 @@ import abc
import argparse
from contextlib import contextmanager
from decimal import Decimal
-from enum import Enum
+from enum import auto, StrEnum
import logging
import os.path
import shutil
@@ -36,7 +36,7 @@ from project.platform import Platform
from project import utils
-class MSVCVersion(Enum):
+class MSVCVersion(StrEnum):
# It's the MSVC "toolset" version, or whatever.
# Source: https://cmake.org/cmake/help/latest/variable/MSVC_TOOLSET_VERSION.html
VS2010 = "100"
@@ -49,9 +49,6 @@ class MSVCVersion(Enum):
VS2026 = "145"
# ^^^ Update the mappings below.
- def __str__(self):
- return str(self.value)
-
def help(self):
if self in _msvc_to_vs_version:
return f"Visual Studio {_msvc_to_vs_version[self]}"
@@ -91,7 +88,7 @@ class MSVCVersion(Enum):
return f"v{self}"
-class VisualStudioVersion(Enum):
+class VisualStudioVersion(StrEnum):
VS2010 = "2010"
VS2012 = "2012"
VS2013 = "2013"
@@ -102,9 +99,6 @@ class VisualStudioVersion(Enum):
VS2026 = "2026"
# ^^^ Update the mappings below.
- def __str__(self):
- return str(self.value)
-
def help(self):
if self in _vs_to_msvc_version:
return f"Same as '{ToolsetType.MSVC}{_vs_to_msvc_version[self]}'"
@@ -145,18 +139,15 @@ _msvc_to_vs_version = {
_vs_to_msvc_version = {v: k for k, v in _msvc_to_vs_version.items()}
-class ToolsetType(Enum):
- AUTO = "auto"
- MSVC = "msvc"
+class ToolsetType(StrEnum):
+ AUTO = auto()
+ MSVC = auto()
VISUAL_STUDIO = "vs"
- GCC = "gcc"
- MINGW = "mingw"
- CLANG = "clang"
+ GCC = auto()
+ MINGW = auto()
+ CLANG = auto()
CLANG_CL = "clang-cl"
- def __str__(self):
- return str(self.value)
-
def help(self):
if self is ToolsetType.AUTO:
return "Means 'gcc' on Linux and 'msvc' on Windows"
diff --git a/pyproject.toml b/pyproject.toml
index 7b53a8b..58e4987 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,8 +12,8 @@ license-files = ["LICENSE.txt"]
dynamic = ["version"]
authors = [{name = "Egor Tensin", email = "egor@tensin.name"}]
readme = "README.md"
-requires-python = ">=3.8"
-# ^^^ For shlex.join, at least?
+requires-python = ">=3.11"
+# ^^^ For enum.StrEnum, at least?
classifiers = [
"Development Status :: 4 - Beta",