Select the correct macos 11 SDK for the version of xcode available
This commit is contained in:
@@ -53,6 +53,18 @@ def get_macos_version() -> Tuple[int, int]:
|
|||||||
return cast(Tuple[int, int], version)
|
return cast(Tuple[int, int], version)
|
||||||
|
|
||||||
|
|
||||||
|
def get_xcode_version() -> Tuple[int, int]:
|
||||||
|
output = subprocess.check_output(
|
||||||
|
['xcodebuild', '-version'],
|
||||||
|
universal_newlines=True,
|
||||||
|
)
|
||||||
|
lines = output.splitlines()
|
||||||
|
_, version_str = lines[0].split()
|
||||||
|
|
||||||
|
version_parts = version_str.split('.')
|
||||||
|
return (int(version_parts[0]), int(version_parts[1]))
|
||||||
|
|
||||||
|
|
||||||
class PythonConfiguration(NamedTuple):
|
class PythonConfiguration(NamedTuple):
|
||||||
version: str
|
version: str
|
||||||
identifier: str
|
identifier: str
|
||||||
@@ -246,7 +258,13 @@ def setup_python(python_configuration: PythonConfiguration,
|
|||||||
if get_macos_version() < (10, 16):
|
if get_macos_version() < (10, 16):
|
||||||
# xcode 12 or higher can build arm64 on macos 10.15 or below, but
|
# xcode 12 or higher can build arm64 on macos 10.15 or below, but
|
||||||
# needs the correct SDK selected
|
# needs the correct SDK selected
|
||||||
|
|
||||||
|
# however, different versions of Xcode contain different SDK
|
||||||
|
# versions...
|
||||||
|
if get_xcode_version() == (12, 2):
|
||||||
env.setdefault('SDKROOT', 'macosx11.0')
|
env.setdefault('SDKROOT', 'macosx11.0')
|
||||||
|
else:
|
||||||
|
env.setdefault('SDKROOT', 'macosx11.1')
|
||||||
|
|
||||||
log.step('Installing build tools...')
|
log.step('Installing build tools...')
|
||||||
call(['pip', 'install', '--upgrade', 'setuptools', 'wheel', 'delocate', *dependency_constraint_flags], env=env)
|
call(['pip', 'install', '--upgrade', 'setuptools', 'wheel', 'delocate', *dependency_constraint_flags], env=env)
|
||||||
|
|||||||
Reference in New Issue
Block a user