Skip to content

Commit 8d10ec5

Browse files
committed
Make distinction between 32- and 64-bit Python wheels
1 parent 832e0d2 commit 8d10ec5

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

test/10_cpp_standards/cibuildwheel_test.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,29 @@ def test_cpp17_modern_msvc_workaround(tmp_path):
7979
add_env = {'CIBW_ENVIRONMENT': 'STANDARD=17',
8080
'DISTUTILS_USE_SDK': '1', 'MSSdk': '1'}
8181

82-
# Use existing setuptools code to run Visual Studio's vcvarsall.bat
83-
import setuptools.msvc
82+
# Use existing setuptools code to run Visual Studio's vcvarsall.bat and get the
83+
# necessary environment variables, since running vcvarsall.bat in a subprocess
84+
# does not keep the relevant environment variables
85+
# In normal CI setup: run vcvarsall.bat before running cibuildwheel
86+
import setuptools
87+
88+
# Different environment variables for 32-bit/64-bit targets
89+
# First, 32-bit (or x86)
8490
vcvarsall_env = setuptools.msvc.msvc14_get_vc_env('x86')
91+
add_env_x86 = add_env.copy()
92+
add_env_x86['CIBW_BUILD'] = '*-win32'
8593
for vc_var in ['path', 'include', 'lib']:
86-
if vc_var in vcvarsall_env:
87-
add_env[vc_var] = vcvarsall_env[vc_var]
94+
add_env_x86[vc_var] = vcvarsall_env[vc_var]
95+
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env_x86)
96+
97+
# Then, 64-bit (or x64)
98+
vcvarsall_env = setuptools.msvc.msvc14_get_vc_env('x64')
99+
add_env_x64 = add_env.copy()
100+
add_env_x64['CIBW_BUILD'] = '*-win_amd64'
101+
for vc_var in ['path', 'include', 'lib']:
102+
add_env_x64[vc_var] = vcvarsall_env[vc_var]
103+
actual_wheels += utils.cibuildwheel_run(project_dir, add_env=add_env_x64)
88104

89-
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
90105
expected_wheels = utils.expected_wheels('spam', '0.1.0')
91106

92107
assert set(actual_wheels) == set(expected_wheels)

0 commit comments

Comments
 (0)