1414def get_python_configurations (build_selector ):
1515 PythonConfiguration = namedtuple ('PythonConfiguration' , ['version' , 'identifier' , 'url' ])
1616 python_configurations = [
17- PythonConfiguration (version = '2.7' , identifier = 'cp27-macosx_10_6_intel ' , url = 'https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.6 .pkg' ),
18- PythonConfiguration (version = '3.5' , identifier = 'cp35-macosx_10_6_intel ' , url = 'https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg' ),
19- PythonConfiguration (version = '3.6' , identifier = 'cp36-macosx_10_6_intel ' , url = 'https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.6 .pkg' ),
20- PythonConfiguration (version = '3.7' , identifier = 'cp37-macosx_10_6_intel ' , url = 'https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.6 .pkg' ),
17+ PythonConfiguration (version = '2.7' , identifier = 'cp27-macosx_10_9_x86_64 ' , url = 'https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.9 .pkg' ),
18+ PythonConfiguration (version = '3.5' , identifier = 'cp35-macosx_10_9_x86_64 ' , url = 'https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg' ),
19+ PythonConfiguration (version = '3.6' , identifier = 'cp36-macosx_10_9_x86_64 ' , url = 'https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9 .pkg' ),
20+ PythonConfiguration (version = '3.7' , identifier = 'cp37-macosx_10_9_x86_64 ' , url = 'https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.9 .pkg' ),
2121 PythonConfiguration (version = '3.8' , identifier = 'cp38-macosx_10_9_x86_64' , url = 'https://www.python.org/ftp/python/3.8.1/python-3.8.1-macosx10.9.pkg' ),
2222 ]
2323
@@ -31,7 +31,8 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
3131 built_wheel_dir = os .path .join (temp_dir , 'built_wheel' )
3232 repaired_wheel_dir = os .path .join (temp_dir , 'repaired_wheel' )
3333
34- python_configurations = get_python_configurations (build_selector )
34+ python_configurations = get_python_configurations (build_selector , machine )
35+
3536 get_pip_url = 'https://bootstrap.pypa.io/get-pip.py'
3637 get_pip_script = '/tmp/get-pip.py'
3738
@@ -50,20 +51,19 @@ def call(args, env=None, cwd=None, shell=False):
5051 return subprocess .check_call (args , env = env , cwd = cwd , shell = shell )
5152
5253 # get latest pip once and for all
53-
54- call (['curl' , '-L' , '--retry' , '3' , '--retry-delay' , '3' , '-o' , get_pip_script , get_pip_url ])
54+ call (['curl' , '--retry' , '3' , '--retry-delay' , '3' , '-sSLo' , get_pip_script , get_pip_url ])
5555
5656 for config in python_configurations :
5757 # if this version of python isn't installed, get it from python.org and install
5858 python_package_identifier = 'org.python.Python.PythonFramework-%s' % config .version
5959 if python_package_identifier not in installed_system_packages :
6060 # download the pkg
61- call (['curl' , '-L ' , '-o ' , '/tmp/Python.pkg' , config .url ])
61+ call (['curl' , '--retry ' , '3' , '--retry-delay' , '3' , '-sSLo ' , '/tmp/Python.pkg' , config .url ])
6262 # install
6363 call (['sudo' , 'installer' , '-pkg' , '/tmp/Python.pkg' , '-target' , '/' ])
6464 # patch open ssl
6565 if config .version == '3.5' :
66- call (['curl' , '-fsSLo' , '/tmp/python-patch.tar.gz' , 'https://github.com/mayeut/patch-macos-python-openssl/releases/download/v1.0.2t/patch-macos-python-%s-openssl-v1.0.2t.tar.gz' % config .version ])
66+ call (['curl' , '--retry' , '3' , '--retry-delay' , '3' , '- fsSLo' , '/tmp/python-patch.tar.gz' , 'https://github.com/mayeut/patch-macos-python-openssl/releases/download/v1.0.2t/patch-macos-python-%s-openssl-v1.0.2t.tar.gz' % config .version ])
6767 call (['sudo' , 'tar' , '-C' , '/Library/Frameworks/Python.framework/Versions/%s/' % config .version , '-xmf' , '/tmp/python-patch.tar.gz' ])
6868
6969 installation_bin_path = '/Library/Frameworks/Python.framework/Versions/{}/bin' .format (config .version )
@@ -98,6 +98,15 @@ def call(args, env=None, cwd=None, shell=False):
9898 call (['pip' , '--version' ], env = env )
9999 call (['pip' , 'install' , '--upgrade' , 'setuptools' , 'wheel' , 'delocate' ], env = env )
100100
101+ # setup target platform, only required for python 3.5
102+ current_platform = subprocess .check_output (['python' , '-c' , 'import distutils.util; print(distutils.util.get_platform())' ], env = env )
103+ if sys .version_info [0 ] >= 3 :
104+ current_platform = current_platform .decode ('utf8' )
105+ current_platform = current_platform .strip ()
106+ if current_platform .endswith ('intel' ):
107+ env ['_PYTHON_HOST_PLATFORM' ] = current_platform .replace ('intel' , 'x86_64' ) # cross-compilation platform override
108+ env ['ARCHFLAGS' ] = '-arch x86_64' # https://github.com/python/cpython/blob/a5ed2fe0eedefa1649aa93ee74a0bafc8e628a10/Lib/_osx_support.py#L260
109+
101110 # run the before_build command
102111 if before_build :
103112 before_build_prepared = prepare_command (before_build , project = abs_project_dir )
0 commit comments