88import platform as pm
99import subprocess
1010import sys
11- from collections .abc import Mapping , Sequence
11+ from collections .abc import Generator , Mapping , Sequence
1212from pathlib import Path
1313from tempfile import TemporaryDirectory
1414from typing import Any , Final
@@ -165,7 +165,7 @@ def expected_wheels(
165165 single_arch : bool = False ,
166166) -> list [str ]:
167167 """
168- Returns a list of expected wheels from a run of cibuildwheel.
168+ Returns the expected wheels from a run of cibuildwheel.
169169 """
170170 if machine_arch is None :
171171 machine_arch = pm .machine ()
@@ -186,22 +186,21 @@ def expected_wheels(
186186 elif platform == "windows" and machine_arch == "AMD64" :
187187 architectures .append ("x86" )
188188
189- wheels : list [str ] = []
190- for architecture in architectures :
191- wheels .extend (
192- _expected_wheels (
193- package_name ,
194- package_version ,
195- architecture ,
196- manylinux_versions ,
197- musllinux_versions ,
198- macosx_deployment_target ,
199- python_abi_tags ,
200- include_universal2 ,
201- single_python ,
202- )
189+ return [
190+ wheel
191+ for architecture in architectures
192+ for wheel in _expected_wheels (
193+ package_name ,
194+ package_version ,
195+ architecture ,
196+ manylinux_versions ,
197+ musllinux_versions ,
198+ macosx_deployment_target ,
199+ python_abi_tags ,
200+ include_universal2 ,
201+ single_python ,
203202 )
204- return wheels
203+ ]
205204
206205
207206def _expected_wheels (
@@ -214,7 +213,7 @@ def _expected_wheels(
214213 python_abi_tags : list [str ] | None ,
215214 include_universal2 : bool ,
216215 single_python : bool ,
217- ) -> list [str ]:
216+ ) -> Generator [str , None , None ]:
218217 """
219218 Returns a list of expected wheels from a run of cibuildwheel.
220219 """
@@ -264,13 +263,12 @@ def _expected_wheels(
264263 )
265264 ]
266265
267- wheels = []
268-
269266 if platform == "pyodide" :
270267 assert len (python_abi_tags ) == 1
271268 python_abi_tag = python_abi_tags [0 ]
272269 platform_tag = "pyodide_2024_0_wasm32"
273- return [f"{ package_name } -{ package_version } -{ python_abi_tag } -{ platform_tag } .whl" ]
270+ yield f"{ package_name } -{ package_version } -{ python_abi_tag } -{ platform_tag } .whl"
271+ return
274272
275273 for python_abi_tag in python_abi_tags :
276274 platform_tags = []
@@ -321,9 +319,7 @@ def _expected_wheels(
321319 raise Exception (msg )
322320
323321 for platform_tag in platform_tags :
324- wheels .append (f"{ package_name } -{ package_version } -{ python_abi_tag } -{ platform_tag } .whl" )
325-
326- return wheels
322+ yield f"{ package_name } -{ package_version } -{ python_abi_tag } -{ platform_tag } .whl"
327323
328324
329325def get_macos_version () -> tuple [int , int ]:
0 commit comments