Skip to content

Commit e5af42b

Browse files
committed
feat: support Windows workaround on Travis CI
1 parent b386ad5 commit e5af42b

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

cibuildwheel/windows.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def get_python_configurations(
7070
'64': Architecture.AMD64,
7171
}
7272

73-
if IS_RUNNING_ON_TRAVIS:
73+
custom_compiler = os.environ.get('DISTUTILS_USE_SDK') and os.environ.get('MSSdk')
74+
if IS_RUNNING_ON_TRAVIS and not custom_compiler:
7475
# cannot install VCForPython27.msi which is needed for compiling C software
7576
# try with (and similar): msiexec /i VCForPython27.msi ALLUSERS=1 ACCEPT=YES /passive
7677
python_configurations = [c for c in python_configurations if not c.version.startswith('2.7')]

docs/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ To build Linux, Mac, and Windows wheels on Travis CI, create a `.travis.yml` fil
4444
{% include "../examples/travis-ci-minimal.yml" %}
4545
```
4646

47-
Note that building Windows Python 2.7 wheels on Travis is unsupported.
47+
Note that building Windows Python 2.7 wheels on Travis is unsupported unless using a newer compiler [via a workaround](cpp-standards.md).
4848

4949
Commit this file, enable building of your repo on Travis CI, and push.
5050

test/test_cpp_standards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def add_vcvars(prev_env, platform):
202202
add_env_x64['CIBW_BUILD'] = 'cp27-win_amd64'
203203
actual_wheels += utils.cibuildwheel_run(project_dir, add_env=add_env_x64)
204204

205-
expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0')
205+
expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', filter_27=False)
206206
if 'cp27-cp27m-win' in w
207207
or 'pp27-pypy_73-win32' in w]
208208

test/test_dependency_versions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def test_pinned_versions(tmp_path, python_version):
5252
if utils.platform == 'linux':
5353
pytest.skip('linux doesn\'t pin individual tool versions, it pins manylinux images instead')
5454

55+
if utils.IS_WINDOWS_RUNNING_ON_TRAVIS and python_version == '2.7':
56+
pytest.skip('Windows + Travis CI requires a workaround')
57+
5558
project_dir = tmp_path / 'project'
5659
project_with_expected_version_checks.generate(project_dir)
5760

test/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, outp
7676

7777

7878
def expected_wheels(package_name, package_version, manylinux_versions=None,
79-
macosx_deployment_target='10.9', machine_arch=None):
79+
macosx_deployment_target='10.9', machine_arch=None, *,
80+
filter_27=IS_WINDOWS_RUNNING_ON_TRAVIS):
8081
'''
8182
Returns a list of expected wheels from a run of cibuildwheel.
8283
'''
@@ -134,7 +135,7 @@ def expected_wheels(package_name, package_version, manylinux_versions=None,
134135
for platform_tag in platform_tags:
135136
wheels.append(f'{package_name}-{package_version}-{python_abi_tag}-{platform_tag}.whl')
136137

137-
if IS_WINDOWS_RUNNING_ON_TRAVIS:
138+
if filter_27:
138139
# Python 2.7 isn't supported on Travis.
139140
wheels = [w for w in wheels if '-cp27-' not in w and '-pp2' not in w]
140141

0 commit comments

Comments
 (0)