From 0893731090b0a839efd8dd53ddeb4c339f6b98ff Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Mon, 28 Dec 2020 00:43:24 +0000 Subject: [PATCH] Simplify arch matching code --- cibuildwheel/linux.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 15932776..7e71bbae 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -1,4 +1,3 @@ -import re import subprocess import sys 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): version: 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'), ] - # skip builds as required - target_archs = architectures - + # return all configurations whose arch is in our `architectures` list, + # and match the build/skip rules return [ 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) ]