8
8
import platform as pm
9
9
import subprocess
10
10
import sys
11
- from collections .abc import Mapping , Sequence
11
+ from collections .abc import Generator , Mapping , Sequence
12
12
from pathlib import Path
13
13
from tempfile import TemporaryDirectory
14
14
from typing import Any , Final
@@ -165,7 +165,7 @@ def expected_wheels(
165
165
single_arch : bool = False ,
166
166
) -> list [str ]:
167
167
"""
168
- Returns a list of expected wheels from a run of cibuildwheel.
168
+ Returns the expected wheels from a run of cibuildwheel.
169
169
"""
170
170
if machine_arch is None :
171
171
machine_arch = pm .machine ()
@@ -186,22 +186,21 @@ def expected_wheels(
186
186
elif platform == "windows" and machine_arch == "AMD64" :
187
187
architectures .append ("x86" )
188
188
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 ,
203
202
)
204
- return wheels
203
+ ]
205
204
206
205
207
206
def _expected_wheels (
@@ -214,7 +213,7 @@ def _expected_wheels(
214
213
python_abi_tags : list [str ] | None ,
215
214
include_universal2 : bool ,
216
215
single_python : bool ,
217
- ) -> list [str ]:
216
+ ) -> Generator [str , None , None ]:
218
217
"""
219
218
Returns a list of expected wheels from a run of cibuildwheel.
220
219
"""
@@ -264,13 +263,12 @@ def _expected_wheels(
264
263
)
265
264
]
266
265
267
- wheels = []
268
-
269
266
if platform == "pyodide" :
270
267
assert len (python_abi_tags ) == 1
271
268
python_abi_tag = python_abi_tags [0 ]
272
269
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
274
272
275
273
for python_abi_tag in python_abi_tags :
276
274
platform_tags = []
@@ -321,9 +319,7 @@ def _expected_wheels(
321
319
raise Exception (msg )
322
320
323
321
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"
327
323
328
324
329
325
def get_macos_version () -> tuple [int , int ]:
0 commit comments