From a2a2a7b3829cbe0a9339c24386229b5abdad44e3 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Tue, 11 Apr 2017 23:15:19 +0100 Subject: [PATCH] Add Mac and Windows implementations of CIBW_SKIP --- cibuildwheel/macos.py | 16 ++++++++++------ cibuildwheel/windows.py | 28 ++++++++++++++++------------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 3ea2271a..bc9fe388 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -10,13 +10,13 @@ except ImportError: from .util import prepare_command -def build(project_dir, package_name, output_dir, test_command, test_requires, before_build): - PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'url']) +def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip): + PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url']) python_configurations = [ - PythonConfiguration(version='2.7', url='https://www.python.org/ftp/python/2.7.13/python-2.7.13-macosx10.6.pkg'), - PythonConfiguration(version='3.4', url='https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg'), - PythonConfiguration(version='3.5', url='https://www.python.org/ftp/python/3.5.3/python-3.5.3-macosx10.6.pkg'), - PythonConfiguration(version='3.6', url='https://www.python.org/ftp/python/3.6.0/python-3.6.0-macosx10.6.pkg'), + PythonConfiguration(version='2.7', identifier='cp27-macosx_10_6_intel', url='https://www.python.org/ftp/python/2.7.13/python-2.7.13-macosx10.6.pkg'), + PythonConfiguration(version='3.4', identifier='cp34-macosx_10_6_intel', url='https://www.python.org/ftp/python/3.4.4/python-3.4.4-macosx10.6.pkg'), + PythonConfiguration(version='3.5', identifier='cp35-macosx_10_6_intel', url='https://www.python.org/ftp/python/3.5.3/python-3.5.3-macosx10.6.pkg'), + PythonConfiguration(version='3.6', identifier='cp36-macosx_10_6_intel', url='https://www.python.org/ftp/python/3.6.0/python-3.6.0-macosx10.6.pkg'), ] def shell(args, env=None, cwd=None): @@ -25,6 +25,10 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be return subprocess.check_call(args, env=env, cwd=cwd) for config in python_configurations: + if skip(config.identifier): + print('cibuildwheel: Skipping build %s' % config.identifier, file=sys.stderr) + continue + # download the pkg shell(['curl', '-L', '-o', '/tmp/Python.pkg', config.url]) # install diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index af28bdc2..173ffc21 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -5,7 +5,7 @@ from collections import namedtuple from .util import prepare_command -def build(project_dir, package_name, output_dir, test_command, test_requires, before_build): +def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip): # run_with_env is a cmd file that sets the right environment variables to run_with_env = os.path.join(tempfile.gettempdir(), 'appveyor_run_with_env.cmd') if not os.path.exists(run_with_env): @@ -19,21 +19,25 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be args = ['cmd', '/E:ON', '/V:ON', '/C', run_with_env] + args return subprocess.check_call(' '.join(args), env=env, cwd=cwd) - PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'arch', 'path']) + PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'arch', 'identifier', 'path']) python_configurations = [ - PythonConfiguration(version='2.7.x', arch="32", path='C:\Python27'), - PythonConfiguration(version='2.7.x', arch="64", path='C:\Python27-x64'), - PythonConfiguration(version='3.3.x', arch="32", path='C:\Python33'), - PythonConfiguration(version='3.3.x', arch="64", path='C:\Python33-x64'), - PythonConfiguration(version='3.4.x', arch="32", path='C:\Python34'), - PythonConfiguration(version='3.4.x', arch="64", path='C:\Python34-x64'), - PythonConfiguration(version='3.5.x', arch="32", path='C:\Python35'), - PythonConfiguration(version='3.5.x', arch="64", path='C:\Python35-x64'), - PythonConfiguration(version='3.6.x', arch="32", path='C:\Python36'), - PythonConfiguration(version='3.6.x', arch="64", path='C:\Python36-x64'), + PythonConfiguration(version='2.7.x', arch="32", identifier='cp27-win32', path='C:\Python27'), + PythonConfiguration(version='2.7.x', arch="64", identifier='cp27-win_amd64', path='C:\Python27-x64'), + PythonConfiguration(version='3.3.x', arch="32", identifier='cp33-win32', path='C:\Python33'), + PythonConfiguration(version='3.3.x', arch="64", identifier='cp33-win_amd64', path='C:\Python33-x64'), + PythonConfiguration(version='3.4.x', arch="32", identifier='cp34-win32', path='C:\Python34'), + PythonConfiguration(version='3.4.x', arch="64", identifier='cp34-win_amd64', path='C:\Python34-x64'), + PythonConfiguration(version='3.5.x', arch="32", identifier='cp35-win32', path='C:\Python35'), + PythonConfiguration(version='3.5.x', arch="64", identifier='cp35-win_amd64', path='C:\Python35-x64'), + PythonConfiguration(version='3.6.x', arch="32", identifier='cp36-win32', path='C:\Python36'), + PythonConfiguration(version='3.6.x', arch="64", identifier='cp36-win_amd64', path='C:\Python36-x64'), ] for config in python_configurations: + if skip(config.identifier): + print('cibuildwheel: Skipping build %s' % config.identifier, file=sys.stderr) + continue + env = os.environ.copy() # set up environment variables for run_with_env env['PYTHON_VERSION'] = config.version