From 666c10465a760e965678e45bdf11a4ba1275a5de Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 10 Sep 2017 22:40:49 +0100 Subject: [PATCH 1/2] Speed up mac CI by only installing python if it's not already installed --- cibuildwheel/macos.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 1074f0a2..a4c8bd46 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -19,6 +19,8 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be 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'), ] + installed_system_packages = subprocess.check_output(['pkgutil', '--pkgs']).splitlines() + def call(args, env=None, cwd=None, shell=False): # print the command executing for the logs if shell: @@ -33,10 +35,13 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be print('cibuildwheel: Skipping build %s' % config.identifier, file=sys.stderr) continue - # download the pkg - call(['curl', '-L', '-o', '/tmp/Python.pkg', config.url]) - # install - call(['sudo', 'installer', '-pkg', '/tmp/Python.pkg', '-target', '/']) + # if this version of python isn't installed, get it from python.org and install + python_package_identifier = 'org.python.Python.PythonFramework-%s' % config.version + if python_package_identifier not in installed_system_packages: + # download the pkg + call(['curl', '-L', '-o', '/tmp/Python.pkg', config.url]) + # install + call(['sudo', 'installer', '-pkg', '/tmp/Python.pkg', '-target', '/']) env = os.environ.copy() env['PATH'] = os.pathsep.join([ From 9a6a7d3375b1f9e767b617d5b16b9b30fa418d00 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Mon, 11 Sep 2017 10:51:30 +0100 Subject: [PATCH 2/2] Python 3 faster builds too --- cibuildwheel/macos.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index a4c8bd46..87dab631 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -19,8 +19,11 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be 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'), ] - installed_system_packages = subprocess.check_output(['pkgutil', '--pkgs']).splitlines() - + pkgs_output = subprocess.check_output(['pkgutil', '--pkgs']) + if sys.version_info[0] >= 3: + pkgs_output = pkgs_output.decode('utf8') + installed_system_packages = pkgs_output.splitlines() + def call(args, env=None, cwd=None, shell=False): # print the command executing for the logs if shell: