diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index bd929358..5e8c1683 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -70,7 +70,8 @@ def get_python_configurations( '64': Architecture.AMD64, } - if IS_RUNNING_ON_TRAVIS: + custom_compiler = os.environ.get('DISTUTILS_USE_SDK') and os.environ.get('MSSdk') + if IS_RUNNING_ON_TRAVIS and not custom_compiler: # cannot install VCForPython27.msi which is needed for compiling C software # try with (and similar): msiexec /i VCForPython27.msi ALLUSERS=1 ACCEPT=YES /passive python_configurations = [c for c in python_configurations if not c.version.startswith('2.7')] diff --git a/docs/setup.md b/docs/setup.md index 282edde9..c86ebf13 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -44,7 +44,7 @@ To build Linux, Mac, and Windows wheels on Travis CI, create a `.travis.yml` fil {% include "../examples/travis-ci-minimal.yml" %} ``` -Note that building Windows Python 2.7 wheels on Travis is unsupported. +Note that building Windows Python 2.7 wheels on Travis is unsupported unless using a newer compiler [via a workaround](cpp-standards.md). Commit this file, enable building of your repo on Travis CI, and push. diff --git a/test/test_cpp_standards.py b/test/test_cpp_standards.py index 0ecf196d..8ab5becd 100644 --- a/test/test_cpp_standards.py +++ b/test/test_cpp_standards.py @@ -202,7 +202,7 @@ def test_cpp17_py27_modern_msvc_workaround(tmp_path): add_env_x64['CIBW_BUILD'] = 'cp27-win_amd64' actual_wheels += utils.cibuildwheel_run(project_dir, add_env=add_env_x64) - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') + expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', filter_27=False) if 'cp27-cp27m-win' in w or 'pp27-pypy_73-win32' in w] diff --git a/test/test_dependency_versions.py b/test/test_dependency_versions.py index 07d22e24..1b415bb4 100644 --- a/test/test_dependency_versions.py +++ b/test/test_dependency_versions.py @@ -52,6 +52,9 @@ def test_pinned_versions(tmp_path, python_version): if utils.platform == 'linux': pytest.skip('linux doesn\'t pin individual tool versions, it pins manylinux images instead') + if utils.IS_WINDOWS_RUNNING_ON_TRAVIS and python_version == '2.7': + pytest.skip('Windows + Travis CI requires a workaround') + project_dir = tmp_path / 'project' project_with_expected_version_checks.generate(project_dir) @@ -114,6 +117,9 @@ def test_dependency_constraints_file(tmp_path, python_version): if utils.platform == 'linux': pytest.skip('linux doesn\'t pin individual tool versions, it pins manylinux images instead') + if utils.IS_WINDOWS_RUNNING_ON_TRAVIS and python_version == '2.7': + pytest.skip('Windows + Travis CI requires a workaround') + project_dir = tmp_path / 'project' project_with_expected_version_checks.generate(project_dir) diff --git a/test/utils.py b/test/utils.py index bae3853b..4fcdba47 100644 --- a/test/utils.py +++ b/test/utils.py @@ -76,7 +76,8 @@ def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, outp def expected_wheels(package_name, package_version, manylinux_versions=None, - macosx_deployment_target='10.9', machine_arch=None): + macosx_deployment_target='10.9', machine_arch=None, *, + filter_27=IS_WINDOWS_RUNNING_ON_TRAVIS): ''' Returns a list of expected wheels from a run of cibuildwheel. ''' @@ -134,7 +135,7 @@ def expected_wheels(package_name, package_version, manylinux_versions=None, for platform_tag in platform_tags: wheels.append(f'{package_name}-{package_version}-{python_abi_tag}-{platform_tag}.whl') - if IS_WINDOWS_RUNNING_ON_TRAVIS: + if filter_27: # Python 2.7 isn't supported on Travis. wheels = [w for w in wheels if '-cp27-' not in w and '-pp2' not in w]