Repository: pypa/cibuildwheel

Issue:
--only doesn't work for `-win32` identifiers
> - cp311 https://github.com/ddelange/asyncpg/actions/runs/3092263953/jobs/5003341864#step:4:43
> - same for all other win32 builds: `Invalid --only='cp310-win32', must be a build selector with a known platform`
> 
> in https://github.com/ddelange/asyncpg/pull/2
> 
> and before this change it was fine: https://github.com/ddelange/asyncpg/actions/runs/3072698535/jobs/4964355341#step:4:89
> 
> maybe it's an issue with the `--only` flag?
> 
> on my mac:
> 
> ```console
> $ cibuildwheel --print-build-identifiers --platform windows --arch x86,AMD64
> cp36-win32
> cp36-win_amd64
> cp37-win32
> cp37-win_amd64
> cp38-win32
> cp38-win_amd64
> cp39-win32
> cp39-win_amd64
> cp310-win32
> cp310-win_amd64
> cp311-win32
> cp311-win_amd64
> pp37-win_amd64
> pp38-win_amd64
> pp39-win_amd64
> ```
> 

_Originally posted by @ddelange in https://github.com/pypa/cibuildwheel/issues/1266#issuecomment-1252703994_
      

Discussion:

Patch:
diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py
index 4d1402d8..dcfc81d4 100644
--- a/cibuildwheel/__main__.py
+++ b/cibuildwheel/__main__.py
@@ -173,7 +173,7 @@ def build_in_directory(args: CommandLineArguments) -> None:
             platform = "linux"
         elif "macosx_" in args.only:
             platform = "macos"
-        elif "win_" in args.only:
+        elif "win_" in args.only or "win32" in args.only:
             platform = "windows"
         else:
             print(


Test patch:
diff --git a/unit_test/main_tests/main_platform_test.py b/unit_test/main_tests/main_platform_test.py
index 9136802c..b947ce4f 100644
--- a/unit_test/main_tests/main_platform_test.py
+++ b/unit_test/main_tests/main_platform_test.py
@@ -199,6 +199,7 @@ def test_archs_platform_all(platform, intercepted_build_args, monkeypatch):
     (
         ("cp311-manylinux_x86_64", "linux"),
         ("cp310-win_amd64", "windows"),
+        ("cp310-win32", "windows"),
         ("cp311-macosx_x86_64", "macos"),
     ),
 )