Allow extended exclude and disable patterns.

This commit is contained in:
Patrick Lehmann
2024-08-02 07:40:14 +02:00
parent ebd20f5aea
commit 2862238ee5
4 changed files with 52 additions and 13 deletions

View File

@@ -203,26 +203,44 @@ jobs:
for disable in disabled: for disable in disabled:
print(f"- {disable}") print(f"- {disable}")
def match(combination: str, pattern: str) -> bool:
system, version = combination.split(":")
sys, ver = pattern.split(":")
if sys == "*":
return (ver == "*") or (version == ver)
elif system == sys:
return (ver == "*") or (version == ver)
else:
return False
def notIn(combination: str, patterns: Iterable[str]) -> bool:
for pattern in patterns:
if match(combination, pattern):
return False
return True
combinations = [ combinations = [
(system, version) (system, version)
for system in systems for system in systems
if system in data["sys"] if system in data["sys"]
for version in versions for version in versions
if version in data["python"] if version in data["python"]
and f"{system}:{version}" not in excludes and notIn(f"{system}:{version}", excludes)
and f"{system}:{version}" not in disabled and notIn(f"{system}:{version}", disabled)
] + [ ] + [
(system, currentMSYS2Version) (system, currentMSYS2Version)
for system in systems for system in systems
if system in data["runtime"] if system in data["runtime"]
and f"{system}:{currentMSYS2Version}" not in excludes and notIn(f"{system}:{currentMSYS2Version}", excludes)
and f"{system}:{currentMSYS2Version}" not in disabled and notIn(f"{system}:{currentMSYS2Version}", disabled)
] + [ ] + [
(system, version) (system, version)
for system, version in includes for system, version in includes
if system in data["sys"] if system in data["sys"]
and version in data["python"] and version in data["python"]
and f"{system}:{version}" not in disabled and notIn(f"{system}:{version}", disabled)
] ]
print(f"Combinations ({len(combinations)}):") print(f"Combinations ({len(combinations)}):")
for system, version in combinations: for system, version in combinations:

View File

@@ -1,6 +1,6 @@
[build-system] [build-system]
requires = [ requires = [
"setuptools ~= 71.1", "setuptools ~= 72.1",
"wheel ~= 0.43", "wheel ~= 0.43",
"pyTooling ~= 6.5" "pyTooling ~= 6.5"
] ]

View File

@@ -2,10 +2,11 @@ from json import dumps as json_dumps
from os import getenv from os import getenv
from pathlib import Path from pathlib import Path
from textwrap import dedent from textwrap import dedent
from typing import Iterable
name = "example".strip() name = "example".strip()
python_version = "3.12".strip() python_version = "3.12".strip()
systems = "ubuntu windows macos mingw64 ucrt64".strip() systems = "ubuntu windows macos-arm mingw64 ucrt64".strip()
versions = "3.8 3.9 3.10 3.11 3.12".strip() versions = "3.8 3.9 3.10 3.11 3.12".strip()
include_list = "".strip() include_list = "".strip()
exclude_list = "".strip() exclude_list = "".strip()
@@ -93,26 +94,46 @@ print(f"disabled ({len(disabled)}):")
for disable in disabled: for disable in disabled:
print(f"- {disable}") print(f"- {disable}")
def match(combination: str, pattern: str) -> bool:
system, version = combination.split(":")
sys, ver = pattern.split(":")
if sys == "*":
return (ver == "*") or (version == ver)
elif system == sys:
return (ver == "*") or (version == ver)
else:
return False
def notIn(combination: str, patterns: Iterable[str]) -> bool:
for pattern in patterns:
if match(combination, pattern):
return False
return True
combinations = [ combinations = [
(system, version) (system, version)
for system in systems for system in systems
if system in data["sys"] if system in data["sys"]
for version in versions for version in versions
if version in data["python"] if version in data["python"]
and f"{system}:{version}" not in excludes and notIn(f"{system}:{version}", excludes)
and f"{system}:{version}" not in disabled and notIn(f"{system}:{version}", disabled)
] + [ ] + [
(system, currentMSYS2Version) (system, currentMSYS2Version)
for system in systems for system in systems
if system in data["runtime"] if system in data["runtime"]
and f"{system}:{currentMSYS2Version}" not in excludes and notIn(f"{system}:{currentMSYS2Version}", excludes)
and f"{system}:{currentMSYS2Version}" not in disabled and notIn(f"{system}:{currentMSYS2Version}", disabled)
] + [ ] + [
(system, version) (system, version)
for system, version in includes for system, version in includes
if system in data["sys"] if system in data["sys"]
and version in data["python"] and version in data["python"]
and f"{system}:{version}" not in disabled and notIn(f"{system}:{version}", disabled)
] ]
print(f"Combinations ({len(combinations)}):") print(f"Combinations ({len(combinations)}):")
for system, version in combinations: for system, version in combinations:

View File

@@ -8,6 +8,6 @@ pytest ~= 8.3
pytest-cov ~= 5.0 pytest-cov ~= 5.0
# Static Type Checking # Static Type Checking
mypy ~= 1.10 mypy ~= 1.11
typing_extensions ~= 4.12 typing_extensions ~= 4.12
lxml ~= 5.2 lxml ~= 5.2