cibuildwheel icon indicating copy to clipboard operation
cibuildwheel copied to clipboard

set VSCMD_ARG_TGT_ARCH based on targetted architecture

Open MusicalNinjaDad opened this issue 8 months ago • 2 comments

This fixes #1861 and any other build setups which make use of setuptools._distutils.util.get_platform() on windows

Approach

  • Uses dict lookup pattern analog to many other places within the code
  • Only sets the variable if it has not already been set manually
  • Will overwrite a pre-set VSCMD_ARG_TGT_ARCH=""
  • Tests monkeypatch the environment before calling setuptools._distutils.util.get_platform() and validating returned platform

Test availability

  • Tests are set to only run on windows
  • monkeypatching os.name in a tight context worked locally (Win11 + WSL2 + Ubunutu 22.04), but fails in pipeline on github actions
  • all tests pass on github actions windows runner but tests targeting arm64 fail on azure pipeline. I'm assuming this is a weird, azure-specific thing in their environment and have set the arm64 test to skip on azure

Potential refactoring idea for a future PR

  • I'd like to refactor the various mapping lookups into a WindowsArchitecture dataclass - there are many places with the pattern somevar = architecture_mapping_dict[arch] which would be more readable as somevar = targetarchitecure.somevar

MusicalNinjaDad avatar Jun 12 '24 18:06 MusicalNinjaDad