From 01dd18bbf85cc5d108780f78b43638f9a62d0f04 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Sun, 1 Mar 2020 01:50:45 +0100 Subject: [PATCH 01/17] change 02_test to check if virtualenv is properly used --- cibuildwheel/linux.py | 2 ++ cibuildwheel/macos.py | 1 + cibuildwheel/windows.py | 1 + test/02_test/test/spam_test.py | 17 +++++++++++++++++ 4 files changed, 21 insertions(+) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index dc7238a6..20dae7e6 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -145,6 +145,8 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef venv_dir=`mktemp -d`/venv python -m virtualenv "$venv_dir" + export __CIBW_VIRTUALENV_PATH__=$venv_dir + # run the tests in a subshell to keep that `activate` # script from polluting the env ( diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index dd2a412b..3b3edcba 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -209,6 +209,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef os.path.join(venv_dir, 'bin'), virtualenv_env['PATH'], ]) + virtualenv_env["__CIBW_VIRTUALENV_PATH__"] = venv_dir # check that we are using the Python from the virtual environment call(['which', 'python'], env=virtualenv_env) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index bd93e1db..f179be94 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -197,6 +197,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef os.path.join(venv_dir, 'Scripts'), virtualenv_env['PATH'], ]) + virtualenv_env["__CIBW_VIRTUALENV_PATH__"] = venv_dir # check that we are using the Python from the virtual environment shell(['which', 'python'], env=virtualenv_env) diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index faf7e6bc..58ce05d0 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -1,9 +1,26 @@ +from __future__ import print_function +import os +import sys from unittest import TestCase import spam +def normalize_path(path_str): + """because of windows short path""" + return os.path.normcase(path_str).replace("vssadm~1", "vssadministrator") + + class TestSpam(TestCase): def test_system(self): self.assertEqual(0, spam.system('python -c "exit(0)"')) self.assertNotEqual(0, spam.system('python -c "exit(1)"')) + + def test_virtualenv(self): + virtualenv_path = normalize_path(os.environ.get("__CIBW_VIRTUALENV_PATH__")) + print("=[executable]", sys.executable) + print("=[spam location]", spam.__file__) + print("=[virtualenv path]", virtualenv_path) + self.assertTrue(virtualenv_path in normalize_path(sys.executable)) + self.assertTrue(virtualenv_path in normalize_path(spam.__file__)) + From e0c456604d10ed13fd4b715547650da5ae5714f4 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Sun, 1 Mar 2020 19:48:11 +0100 Subject: [PATCH 02/17] verify if __CIBW_VIRTUALENV_PATH__ is set --- test/02_test/test/spam_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index 58ce05d0..0271b672 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -18,9 +18,11 @@ class TestSpam(TestCase): def test_virtualenv(self): virtualenv_path = normalize_path(os.environ.get("__CIBW_VIRTUALENV_PATH__")) + if not virtualenv_path: + self.fail("No virtualenv path defined in environment variable __CIBW_VIRTUALENV_PATH__") + print("=[executable]", sys.executable) print("=[spam location]", spam.__file__) print("=[virtualenv path]", virtualenv_path) self.assertTrue(virtualenv_path in normalize_path(sys.executable)) self.assertTrue(virtualenv_path in normalize_path(spam.__file__)) - From 6e41e729fe2b261ef3b0e0ef45f2a81ac5df24c0 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Mon, 2 Mar 2020 14:34:39 +0100 Subject: [PATCH 03/17] pin virtualenv to <20 on windows list dir in test use bin directory in pypy --- cibuildwheel/windows.py | 20 +++++++++++++++----- test/02_test/test/spam_test.py | 5 +++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index f179be94..63565018 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -188,15 +188,25 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef if test_command: # set up a virtual environment to install and test from, to make sure # there are no dependencies that were pulled in at build time. - shell(['pip', 'install', 'virtualenv'], env=env) + shell(['pip', 'install', '"virtualenv<20"'], env=env) venv_dir = tempfile.mkdtemp() shell(['python', '-m', 'virtualenv', venv_dir], env=env) virtualenv_env = env.copy() - virtualenv_env['PATH'] = os.pathsep.join([ - os.path.join(venv_dir, 'Scripts'), - virtualenv_env['PATH'], - ]) + if os.path.exists(os.path.join(venv_dir, 'Scripts')): + virtualenv_env['PATH'] = os.pathsep.join([ + os.path.join(venv_dir, 'Scripts'), + virtualenv_env['PATH'], + ]) + elif os.path.exists(os.path.join(venv_dir, 'bin')): + # pypy2.7 bugfix + virtualenv_env['PATH'] = os.pathsep.join([ + os.path.join(venv_dir, 'bin'), + virtualenv_env['PATH'], + ]) + else: + print("Fail to create virtualenv", file=sys.stderr) + sys.exit(2) virtualenv_env["__CIBW_VIRTUALENV_PATH__"] = venv_dir # check that we are using the Python from the virtual environment diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index 0271b672..f5a33ad8 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -24,5 +24,10 @@ class TestSpam(TestCase): print("=[executable]", sys.executable) print("=[spam location]", spam.__file__) print("=[virtualenv path]", virtualenv_path) + print("=[listdir]", os.listdir(virtualenv_path)) + if os.path.exists(os.path.join(virtualenv_path, 'Scripts')): + print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'Scripts'))) + if os.path.exists(os.path.join(virtualenv_path, 'bin')): + print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'bin'))) self.assertTrue(virtualenv_path in normalize_path(sys.executable)) self.assertTrue(virtualenv_path in normalize_path(spam.__file__)) From 281caf3d2e00ce24799dca99d437751e60b8ebaa Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Mon, 2 Mar 2020 14:54:48 +0100 Subject: [PATCH 04/17] bugfix for pypy --- cibuildwheel/windows.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 63565018..0877a603 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -188,25 +188,20 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef if test_command: # set up a virtual environment to install and test from, to make sure # there are no dependencies that were pulled in at build time. - shell(['pip', 'install', '"virtualenv<20"'], env=env) + shell(['pip', 'install', 'virtualenv'], env=env) venv_dir = tempfile.mkdtemp() shell(['python', '-m', 'virtualenv', venv_dir], env=env) virtualenv_env = env.copy() - if os.path.exists(os.path.join(venv_dir, 'Scripts')): - virtualenv_env['PATH'] = os.pathsep.join([ - os.path.join(venv_dir, 'Scripts'), - virtualenv_env['PATH'], - ]) - elif os.path.exists(os.path.join(venv_dir, 'bin')): + + venv_script_path = os.path.join(venv_dir, 'Scripts') + if os.path.exists(os.path.join(venv_dir, 'bin')): # pypy2.7 bugfix - virtualenv_env['PATH'] = os.pathsep.join([ - os.path.join(venv_dir, 'bin'), - virtualenv_env['PATH'], - ]) - else: - print("Fail to create virtualenv", file=sys.stderr) - sys.exit(2) + venv_script_path = os.pathsep.join([venv_script_path, os.path.join(venv_dir, 'bin')]) + virtualenv_env['PATH'] = os.pathsep.join([ + venv_script_path, + virtualenv_env['PATH'], + ]) virtualenv_env["__CIBW_VIRTUALENV_PATH__"] = venv_dir # check that we are using the Python from the virtual environment From be9eae6828018d45dbf229eb6acd6bc1396fa3d4 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Tue, 3 Mar 2020 22:40:13 +0100 Subject: [PATCH 05/17] test path_contains --- test/02_test/test/spam_test.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index f5a33ad8..4eb8ca1f 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -6,9 +6,15 @@ from unittest import TestCase import spam -def normalize_path(path_str): - """because of windows short path""" - return os.path.normcase(path_str).replace("vssadm~1", "vssadministrator") +def path_contains(parent, child): + parent = os.path.abspath(parent) + child = os.path.abspath(child) + + while child != os.path.dirname(child): + child = os.path.dirname(child) + if os.stat(parent) == os.stat(child): + return True + return False class TestSpam(TestCase): @@ -17,7 +23,7 @@ class TestSpam(TestCase): self.assertNotEqual(0, spam.system('python -c "exit(1)"')) def test_virtualenv(self): - virtualenv_path = normalize_path(os.environ.get("__CIBW_VIRTUALENV_PATH__")) + virtualenv_path = os.environ.get("__CIBW_VIRTUALENV_PATH__") if not virtualenv_path: self.fail("No virtualenv path defined in environment variable __CIBW_VIRTUALENV_PATH__") @@ -29,5 +35,5 @@ class TestSpam(TestCase): print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'Scripts'))) if os.path.exists(os.path.join(virtualenv_path, 'bin')): print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'bin'))) - self.assertTrue(virtualenv_path in normalize_path(sys.executable)) - self.assertTrue(virtualenv_path in normalize_path(spam.__file__)) + self.assertTrue(path_contains(virtualenv_path, sys.executable)) + self.assertTrue(path_contains(virtualenv_path, spam.__file__)) From 83452b75dd945d148c4a6c8c4b241a04b154339e Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Thu, 5 Mar 2020 18:28:16 +0000 Subject: [PATCH 06/17] Apply suggestions from code review --- test/02_test/test/spam_test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index 4eb8ca1f..d26535fa 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -7,12 +7,18 @@ import spam def path_contains(parent, child): + ''' returns True if `child` is inside `parent`. + + Works around path-comparison bugs caused by short-paths on Windows e.g. + vssadm~1 instead of vssadministrator + ''' parent = os.path.abspath(parent) child = os.path.abspath(child) while child != os.path.dirname(child): child = os.path.dirname(child) if os.stat(parent) == os.stat(child): + # parent and child refer to the same directory on the filesystem return True return False From 4e3cef81d7a10a1b57efc1ad443dfd51b6e486cf Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Fri, 6 Mar 2020 09:08:20 +0000 Subject: [PATCH 07/17] Fix style errors --- test/02_test/test/spam_test.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index d26535fa..ba5f5e91 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -6,20 +6,20 @@ from unittest import TestCase import spam -def path_contains(parent, child): +def path_contains(parent, child): ''' returns True if `child` is inside `parent`. Works around path-comparison bugs caused by short-paths on Windows e.g. vssadm~1 instead of vssadministrator ''' - parent = os.path.abspath(parent) - child = os.path.abspath(child) + parent = os.path.abspath(parent) + child = os.path.abspath(child) - while child != os.path.dirname(child): - child = os.path.dirname(child) - if os.stat(parent) == os.stat(child): + while child != os.path.dirname(child): + child = os.path.dirname(child) + if os.stat(parent) == os.stat(child): # parent and child refer to the same directory on the filesystem - return True + return True return False From 850db69eb730da169683d50469cc9e82be864f50 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Fri, 6 Mar 2020 10:14:54 +0000 Subject: [PATCH 08/17] Try removing appveyor_run_with_env.cmd --- .../resources/appveyor_run_with_env.cmd | 88 ------------------- cibuildwheel/windows.py | 36 +++----- 2 files changed, 11 insertions(+), 113 deletions(-) delete mode 100644 cibuildwheel/resources/appveyor_run_with_env.cmd diff --git a/cibuildwheel/resources/appveyor_run_with_env.cmd b/cibuildwheel/resources/appveyor_run_with_env.cmd deleted file mode 100644 index d549afe5..00000000 --- a/cibuildwheel/resources/appveyor_run_with_env.cmd +++ /dev/null @@ -1,88 +0,0 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific -:: environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ -:: -:: Notes about batch files for Python people: -:: -:: Quotes in values are literally part of the values: -:: SET FOO="bar" -:: FOO is now five characters long: " b a r " -:: If you don't want quotes, don't include them on the right-hand side. -:: -:: The CALL lines at the end of this file look redundant, but if you move them -:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y -:: case, I don't know why. -@ECHO OFF - -SET COMMAND_TO_RUN=%* -SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows -SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf - -:: Extract the major and minor versions, and allow for the minor version to be -:: more than 9. This requires the version number to have two dots in it. -SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1% -IF "%PYTHON_VERSION:~3,1%" == "." ( - SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% -) ELSE ( - SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2% -) - -:: Based on the Python version, determine what SDK version to use, and whether -:: to set the SDK for 64-bit. -IF %MAJOR_PYTHON_VERSION% == 2 ( - SET WINDOWS_SDK_VERSION="v7.0" - SET SET_SDK_64=Y -) ELSE ( - IF %MAJOR_PYTHON_VERSION% == 3 ( - SET WINDOWS_SDK_VERSION="v7.1" - IF %MINOR_PYTHON_VERSION% LEQ 4 ( - SET SET_SDK_64=Y - ) ELSE ( - SET SET_SDK_64=N - IF EXIST "%WIN_WDK%" ( - :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ - REN "%WIN_WDK%" 0wdf - ) - ) - ) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 - ) -) - -IF %PYTHON_ARCH% == 64 ( - IF %SET_SDK_64% == Y ( - ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 - ) ELSE ( - ECHO Using default MSVC build environment for 64 bit architecture - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 - ) -) ELSE ( - ECHO Using default MSVC build environment for 32 bit architecture - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) \ No newline at end of file diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index bd93e1db..59f67460 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -18,26 +18,12 @@ IS_RUNNING_ON_AZURE = os.path.exists('C:\\hostedtoolcache') IS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows' -def simple_shell(args, env=None, cwd=None): +def shell(args, env=None, cwd=None): print('+ ' + ' '.join(args)) args = ['cmd', '/E:ON', '/V:ON', '/C'] + args return subprocess.check_call(' '.join(args), env=env, cwd=cwd) -if IS_RUNNING_ON_AZURE or IS_RUNNING_ON_TRAVIS: - shell = simple_shell -else: - run_with_env = os.path.abspath(os.path.join(os.path.dirname(__file__), 'resources', 'appveyor_run_with_env.cmd')) - - # run_with_env is a cmd file that sets the right environment variables - # to build on AppVeyor. - def shell(args, env=None, cwd=None): - # print the command executing for the logs - print('+ ' + ' '.join(args)) - args = ['cmd', '/E:ON', '/V:ON', '/C', run_with_env] + args - return subprocess.check_call(' '.join(args), env=env, cwd=cwd) - - def get_nuget_args(version, arch): python_name = 'python' if version[0] == '3' else 'python2' if arch == '32': @@ -81,7 +67,7 @@ def extract_zip(zip_src, dest): def install_cpython(version, arch, nuget): nuget_args = get_nuget_args(version, arch) installation_path = os.path.join(nuget_args[-1], nuget_args[0] + '.' + version, 'tools') - simple_shell([nuget, 'install'] + nuget_args) + shell([nuget, 'install'] + nuget_args) return installation_path @@ -96,8 +82,8 @@ def install_pypy(version, arch, url): # Extract to the parent directory because the zip file still contains a directory extract_zip(pypy_zip, os.path.dirname(installation_path)) pypy_exe = 'pypy3.exe' if version[0] == '3' else 'pypy.exe' - simple_shell(['mklink', os.path.join(installation_path, 'python.exe'), os.path.join(installation_path, pypy_exe)]) - simple_shell(['mklink', '/d', os.path.join(installation_path, 'Scripts'), os.path.join(installation_path, 'bin')]) + shell(['mklink', os.path.join(installation_path, 'python.exe'), os.path.join(installation_path, pypy_exe)]) + shell(['mklink', '/d', os.path.join(installation_path, 'Scripts'), os.path.join(installation_path, 'bin')]) return installation_path @@ -139,9 +125,9 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef env = environment.as_dictionary(prev_environment=env) # for the logs - check we're running the right version of python - simple_shell(['where', 'python'], env=env) - simple_shell(['python', '--version'], env=env) - simple_shell(['python', '-c', '"import struct; print(struct.calcsize(\'P\') * 8)"'], env=env) + shell(['where', 'python'], env=env) + shell(['python', '--version'], env=env) + shell(['python', '-c', '"import struct; print(struct.calcsize(\'P\') * 8)"'], env=env) where_python = subprocess.check_output(['where', 'python'], env=env, universal_newlines=True).splitlines()[0].strip() if where_python != os.path.join(installation_path, 'python.exe'): print("cibuildwheel: python available on PATH doesn't match our installed instance. If you have modified PATH, ensure that you don't overwrite cibuildwheel's entry or insert python above it.", file=sys.stderr) @@ -149,7 +135,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef # make sure pip is installed if not os.path.exists(os.path.join(installation_path, 'Scripts', 'pip.exe')): - simple_shell(['python', get_pip_script], env=env, cwd="C:\\cibw") + shell(['python', get_pip_script], env=env, cwd="C:\\cibw") assert os.path.exists(os.path.join(installation_path, 'Scripts', 'pip.exe')) where_pip = subprocess.check_output(['where', 'pip'], env=env, universal_newlines=True).splitlines()[0].strip() if where_pip.strip() != os.path.join(installation_path, 'Scripts', 'pip.exe'): @@ -157,9 +143,9 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef exit(1) # prepare the Python environment - simple_shell(['python', '-m', 'pip', 'install', '--upgrade', 'pip'], env=env) - simple_shell(['pip', '--version'], env=env) - simple_shell(['pip', 'install', '--upgrade', 'setuptools', 'wheel'], env=env) + shell(['python', '-m', 'pip', 'install', '--upgrade', 'pip'], env=env) + shell(['pip', '--version'], env=env) + shell(['pip', 'install', '--upgrade', 'setuptools', 'wheel'], env=env) # run the before_build command if before_build: From ec42cb6f425fc119e75dc13c865878e1117f8c4d Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Fri, 6 Mar 2020 10:30:16 +0000 Subject: [PATCH 09/17] Fix example references to python3 on Windows, where it's only `python` Fix #285 --- examples/azure-pipelines-minimal.yml | 4 ++-- examples/travis-ci-deploy-only.yml | 2 ++ examples/travis-ci-minimal.yml | 2 ++ examples/travis-ci-test-and-deploy.yml | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/azure-pipelines-minimal.yml b/examples/azure-pipelines-minimal.yml index 2e9a4311..d5504b2d 100644 --- a/examples/azure-pipelines-minimal.yml +++ b/examples/azure-pipelines-minimal.yml @@ -28,8 +28,8 @@ jobs: - script: choco install vcpython27 -f -y displayName: Install Visual C++ for Python 2.7 - bash: | - python3 -m pip install --upgrade pip - pip3 install cibuildwheel==1.1.0 + python -m pip install --upgrade pip + pip install cibuildwheel==1.1.0 cibuildwheel --output-dir wheelhouse . - task: PublishBuildArtifacts@1 inputs: {pathtoPublish: 'wheelhouse'} diff --git a/examples/travis-ci-deploy-only.yml b/examples/travis-ci-deploy-only.yml index 1e7e55d5..1e08893f 100644 --- a/examples/travis-ci-deploy-only.yml +++ b/examples/travis-ci-deploy-only.yml @@ -16,6 +16,8 @@ jobs: before_install: - choco install python --version 3.8.0 - export PATH="/c/Python38:/c/Python38/Scripts:$PATH" + # make sure it's on PATH as 'python3' + - ln -s /c/Python38/python.exe /c/Python38/python3.exe env: global: diff --git a/examples/travis-ci-minimal.yml b/examples/travis-ci-minimal.yml index 30356762..d3bb5a75 100644 --- a/examples/travis-ci-minimal.yml +++ b/examples/travis-ci-minimal.yml @@ -22,6 +22,8 @@ jobs: before_install: - choco install python --version 3.8.0 - export PATH="/c/Python38:/c/Python38/Scripts:$PATH" + # make sure it's on PATH as 'python3' + - ln -s /c/Python38/python.exe /c/Python38/python3.exe install: - python3 -m pip install cibuildwheel==1.1.0 diff --git a/examples/travis-ci-test-and-deploy.yml b/examples/travis-ci-test-and-deploy.yml index 81b206dc..2012a06f 100644 --- a/examples/travis-ci-test-and-deploy.yml +++ b/examples/travis-ci-test-and-deploy.yml @@ -17,6 +17,8 @@ before_install: if [[ "$TRAVIS_OS_NAME" = windows ]]; then choco install python --version 3.8.0 export PATH="/c/Python38:/c/Python38/Scripts:$PATH" + # make sure it's on PATH as 'python3' + ln -s /c/Python38/python.exe /c/Python38/python3.exe fi install: From 863829f67bc0ef1b53d574a455a1219445c11d48 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 7 Mar 2020 10:21:50 +0000 Subject: [PATCH 10/17] Allow the failure of x390x and update Travis job names --- .travis.yml | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46de3bac..ea6f382b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,42 +2,35 @@ language: generic matrix: include: - # Linux Python 3 - - sudo: required + - name: Linux | x86_64 + i686 | Python 3.5 + sudo: required language: python python: 3.5 services: docker env: PYTHON=python - # Linux Python 3 - - sudo: required + - name: Linux | arm64 | Python 3.5 + sudo: required language: python python: 3.5 services: docker arch: arm64 env: PYTHON=python - # Linux Python 3 - - sudo: required + - name: Linux | ppc64le | Python 3.5 + sudo: required language: python python: 3.5 services: docker arch: ppc64le env: PYTHON=python - # Linux Python 3 - - sudo: required - language: python - python: 3.5 - services: docker - arch: s390x - env: PYTHON=python - - # macOS Python 3 - - os: osx + - name: macOS | Python 3 + os: osx env: PYTHON=python3 - - os: windows + - name: Windows | Python 3.5 + os: windows language: shell before_install: - choco install python3 --version 3.5.4 --no-progress -y @@ -46,6 +39,26 @@ matrix: script: - C:\\Python35\\python ./bin/run_tests.py + - name: Linux | s390x | Python 3.5 + sudo: required + language: python + python: 3.5 + services: docker + arch: s390x + env: PYTHON=python + script: false + + allow_failures: + # must repeat the s390x job above exactly to match + - name: Linux | s390x | Python 3.5 + sudo: required + language: python + python: 3.5 + services: docker + arch: s390x + env: PYTHON=python + script: false + install: $PYTHON -m pip install -r requirements-dev.txt script: $PYTHON ./bin/run_tests.py From 38fef4e1d863355bcb13a4e62ebad86b1ea9c658 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 7 Mar 2020 10:37:21 +0000 Subject: [PATCH 11/17] Consistent build names --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea6f382b..4e26c9b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,11 +25,11 @@ matrix: arch: ppc64le env: PYTHON=python - - name: macOS | Python 3 + - name: macOS | x86_64 | Python 3.x os: osx env: PYTHON=python3 - - name: Windows | Python 3.5 + - name: Windows | x86_64 | Python 3.5 os: windows language: shell before_install: From 1238c9d7e556da51b1c0ff9737cd14febb5b34f1 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 7 Mar 2020 10:38:27 +0000 Subject: [PATCH 12/17] Try 'minimal' build image --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4e26c9b4..ea07dada 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: generic +language: minimal matrix: include: From d0692932fbb5ae402af88a2b63767ca08728273d Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 7 Mar 2020 10:46:26 +0000 Subject: [PATCH 13/17] Fix travis deprecation warnings --- .travis.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea07dada..cb535531 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,14 @@ language: minimal -matrix: +jobs: include: - name: Linux | x86_64 + i686 | Python 3.5 - sudo: required language: python python: 3.5 services: docker env: PYTHON=python - name: Linux | arm64 | Python 3.5 - sudo: required language: python python: 3.5 services: docker @@ -18,7 +16,6 @@ matrix: env: PYTHON=python - name: Linux | ppc64le | Python 3.5 - sudo: required language: python python: 3.5 services: docker @@ -40,7 +37,6 @@ matrix: - C:\\Python35\\python ./bin/run_tests.py - name: Linux | s390x | Python 3.5 - sudo: required language: python python: 3.5 services: docker @@ -51,7 +47,6 @@ matrix: allow_failures: # must repeat the s390x job above exactly to match - name: Linux | s390x | Python 3.5 - sudo: required language: python python: 3.5 services: docker From 07fae7e0e5b462ec8633aa7ea81c17cb1fea5eb6 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 7 Mar 2020 10:52:53 +0000 Subject: [PATCH 14/17] Try neatening windows config --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb535531..aa807aff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,10 +31,8 @@ jobs: language: shell before_install: - choco install python3 --version 3.5.4 --no-progress -y - install: - - C:\\Python35\\python -m pip install -r requirements-dev.txt - script: - - C:\\Python35\\python ./bin/run_tests.py + env: + - PYTHON=C:\\Python35\\python - name: Linux | s390x | Python 3.5 language: python From 028c1dbf10e33f2b74a7b2a04fed348007b9a0bd Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 23 Nov 2019 12:51:11 +0100 Subject: [PATCH 15/17] Add macOS support on AppVeyor --- README.md | 4 ++-- appveyor.yml | 30 ++++++++++++++++++++---------- docs/setup.md | 4 ++-- examples/appveyor-minimal.yml | 26 ++++++++++++++++---------- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index d918c808..7f5f0a8c 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ What does it do? Usage ----- -`cibuildwheel` currently works on **Travis CI** and **Azure Pipelines** to build wheels for all three supported platforms (Linux, macOS, Windows). On **CircleCI** Linux and macOS wheels can be built, and on **AppVeyor** Linux and Windows are supported. +`cibuildwheel` currently works on **Travis CI**, **Azure Pipelines** and **AppVeyor** to build wheels for all three supported platforms (Linux, macOS, Windows). On **CircleCI** Linux and macOS wheels can be built. | | Linux | macOS | Windows | |-----------------|-------|-------|---------| | Azure Pipelines | ✅ | ✅ | ✅ | | Travis CI | ✅ | ✅ | ✅ | -| AppVeyor | ✅ | | ✅ | +| AppVeyor | ✅ | ✅ | ✅ | | CircleCI | ✅ | ✅ | | `cibuildwheel` is not intended to run on your development machine. Because it uses system Python from Python.org it will try to install packages globally - not what you expect from a build tool! Instead, isolated CI services like Travis CI, CircleCI, Azure Pipelines and AppVeyor are ideal. diff --git a/appveyor.yml b/appveyor.yml index d3f321d9..f7f7e3b9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,21 @@ -image: - - Ubuntu - - Visual Studio 2015 +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu + APPVEYOR_JOB_NAME: "python37-x64-ubuntu" + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + APPVEYOR_JOB_NAME: "python37-x64-vs2015" + - APPVEYOR_BUILD_WORKER_IMAGE: macos-mojave + APPVEYOR_JOB_NAME: "python37-x64-macos-mojave" -build_script: - - cmd: "C:\\Python37\\python.exe -m pip install -r requirements-dev.txt" - - sh: "${HOME}/.localpython3.7.4/bin/python3 -m pip install -r requirements-dev.txt" - # the '-u' flag is required so the output is in the correct order. - # See https://github.com/joerick/cibuildwheel/pull/24 for more info. - - cmd: "C:\\Python37\\python.exe -u ./bin/run_tests.py" - - sh: "${HOME}/.localpython3.7.4/bin/python3 ./bin/run_tests.py" +stack: python 3.7 + +build: off + +init: +- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH% + +install: python -m pip install -r requirements-dev.txt + +# the '-u' flag is required so the output is in the correct order. +# See https://github.com/joerick/cibuildwheel/pull/24 for more info. +test_script: python -u ./bin/run_tests.py diff --git a/docs/setup.md b/docs/setup.md index c45c4333..9f74269b 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -49,9 +49,9 @@ Commit this file, enable building of your repo on CircleCI, and push. CircleCI will store the built wheels for you - you can access them from the project console. Check out the CircleCI [docs](https://circleci.com/docs/2.0/configuration-reference/#section=configuration) for more info on this config file. -# AppVeyor [linux/windows] {: #appveyor} +# AppVeyor [linux/mac/windows] {: #appveyor} -To build Linux and Windows wheels on AppVeyor, create an `appveyor.yml` file in your repo. +To build Linux, Mac, and Windows wheels on AppVeyor, create an `appveyor.yml` file in your repo. > appveyor.yml diff --git a/examples/appveyor-minimal.yml b/examples/appveyor-minimal.yml index 23f71e19..a6d8654b 100644 --- a/examples/appveyor-minimal.yml +++ b/examples/appveyor-minimal.yml @@ -1,14 +1,20 @@ -image: - - Ubuntu - - Visual Studio 2015 +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu + APPVEYOR_JOB_NAME: "python37-x64-ubuntu" + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + APPVEYOR_JOB_NAME: "python37-x64-vs2015" + - APPVEYOR_BUILD_WORKER_IMAGE: macos-mojave + APPVEYOR_JOB_NAME: "python37-x64-macos-mojave" -build_script: - # windows - - cmd: pip3 install cibuildwheel==1.1.0 - - cmd: cibuildwheel --output-dir wheelhouse - # linux - - sh: "${HOME}/.localpython3.7.4/bin/python3 -m pip install cibuildwheel==1.1.0" - - sh: "${HOME}/.localpython3.7.4/bin/python3 -m cibuildwheel --output-dir wheelhouse" +stack: python 3.7 + +init: +- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH% + +install: python -m pip install cibuildwheel==1.1.0 + +build_script: python -m cibuildwheel --output-dir wheelhouse artifacts: - path: "wheelhouse\\*.whl" From 7903ff60f906fba5210622394bb16283ca406b19 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 7 Mar 2020 11:37:11 +0100 Subject: [PATCH 16/17] Update CPython 3.8 from 3.8.1 to 3.8.2 on macOS/Windows Changelog: https://docs.python.org/release/3.8.2/whatsnew/changelog.html#python-3-8-2-final --- cibuildwheel/macos.py | 2 +- cibuildwheel/windows.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 3b3edcba..bcc87d83 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -31,7 +31,7 @@ def get_python_configurations(build_selector): PythonConfiguration(version='3.5', identifier='cp35-macosx_x86_64', url='https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg'), PythonConfiguration(version='3.6', identifier='cp36-macosx_x86_64', url='https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg'), PythonConfiguration(version='3.7', identifier='cp37-macosx_x86_64', url='https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.9.pkg'), - PythonConfiguration(version='3.8', identifier='cp38-macosx_x86_64', url='https://www.python.org/ftp/python/3.8.1/python-3.8.1-macosx10.9.pkg'), + PythonConfiguration(version='3.8', identifier='cp38-macosx_x86_64', url='https://www.python.org/ftp/python/3.8.2/python-3.8.2-macosx10.9.pkg'), PythonConfiguration(version='2.7-v7.3.0', identifier='pp27-macosx_x86_64', url='https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.3.0-osx64.tar.bz2'), PythonConfiguration(version='3.6-v7.3.0', identifier='pp36-macosx_x86_64', url='https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.3.0-osx64.tar.bz2'), ] diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 24e19c38..16afdbbe 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -42,8 +42,8 @@ def get_python_configurations(build_selector): PythonConfiguration(version='3.6.8', arch='64', identifier='cp36-win_amd64', url=None), PythonConfiguration(version='3.7.6', arch='32', identifier='cp37-win32', url=None), PythonConfiguration(version='3.7.6', arch='64', identifier='cp37-win_amd64', url=None), - PythonConfiguration(version='3.8.1', arch='32', identifier='cp38-win32', url=None), - PythonConfiguration(version='3.8.1', arch='64', identifier='cp38-win_amd64', url=None), + PythonConfiguration(version='3.8.2', arch='32', identifier='cp38-win32', url=None), + PythonConfiguration(version='3.8.2', arch='64', identifier='cp38-win_amd64', url=None), PythonConfiguration(version='2.7-v7.3.0', arch='32', identifier='pp27-win32', url='https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.3.0-win32.zip'), PythonConfiguration(version='3.6-v7.3.0', arch='32', identifier='pp36-win32', url='https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.3.0-win32.zip'), ] From 93913ef2fa17d0536f238d333ed515755dc128c7 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 7 Mar 2020 11:19:52 +0000 Subject: [PATCH 17/17] Remove debugging fail on s390x --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa807aff..02b90836 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,6 @@ jobs: services: docker arch: s390x env: PYTHON=python - script: false allow_failures: # must repeat the s390x job above exactly to match @@ -50,7 +49,6 @@ jobs: services: docker arch: s390x env: PYTHON=python - script: false install: $PYTHON -m pip install -r requirements-dev.txt