feat: stricter selector parsing, refactor to platforms module (#2291)
* feat: stricter selector parsing, refactor to `platforms` module - Use a different method to build nothing - Make the check aware of enable groups * optimise unit tests - a specific platform module API for all configs Unit test time: 26.2s -> 13.1s * Remove unnecessary get_platform_module function
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import itertools
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from enum import StrEnum
|
||||
from fnmatch import fnmatch
|
||||
from typing import Any
|
||||
|
||||
@@ -24,7 +24,7 @@ def selector_matches(patterns: str, string: str) -> bool:
|
||||
return any(fnmatch(string, pat) for pat in expanded_patterns)
|
||||
|
||||
|
||||
class EnableGroup(Enum):
|
||||
class EnableGroup(StrEnum):
|
||||
"""
|
||||
Groups of build selectors that are not enabled by default.
|
||||
"""
|
||||
@@ -33,6 +33,10 @@ class EnableGroup(Enum):
|
||||
CPythonPrerelease = "cpython-prerelease"
|
||||
PyPy = "pypy"
|
||||
|
||||
@classmethod
|
||||
def all_groups(cls) -> frozenset["EnableGroup"]:
|
||||
return frozenset(cls)
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class BuildSelector:
|
||||
|
||||
Reference in New Issue
Block a user