Simplify arch matching code
This commit is contained in:
+3
-14
@@ -1,4 +1,3 @@
|
|||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
@@ -14,15 +13,6 @@ from .util import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
re_pattern = re.compile(r'[cp]p\d{2}-manylinux_(\w*)')
|
|
||||||
|
|
||||||
|
|
||||||
def matches_platform(identifier: str, architectures: List[Architecture]) -> bool:
|
|
||||||
matched_architecture = re_pattern.search(identifier)
|
|
||||||
id_architecture = matched_architecture.group(1) if matched_architecture else ''
|
|
||||||
return id_architecture in architectures
|
|
||||||
|
|
||||||
|
|
||||||
class PythonConfiguration(NamedTuple):
|
class PythonConfiguration(NamedTuple):
|
||||||
version: str
|
version: str
|
||||||
identifier: str
|
identifier: str
|
||||||
@@ -71,12 +61,11 @@ def get_python_configurations(
|
|||||||
PythonConfiguration(version='3.9', identifier='cp39-manylinux_s390x', path_str='/opt/python/cp39-cp39'),
|
PythonConfiguration(version='3.9', identifier='cp39-manylinux_s390x', path_str='/opt/python/cp39-cp39'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# skip builds as required
|
# return all configurations whose arch is in our `architectures` list,
|
||||||
target_archs = architectures
|
# and match the build/skip rules
|
||||||
|
|
||||||
return [
|
return [
|
||||||
c for c in python_configurations
|
c for c in python_configurations
|
||||||
if matches_platform(c.identifier, target_archs)
|
if any(c.identifier.endswith(arch) for arch in architectures)
|
||||||
and build_selector(c.identifier)
|
and build_selector(c.identifier)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user