From e49fbcbce4286da0f2ed322348b17d2461a52fa3 Mon Sep 17 00:00:00 2001 From: matham Date: Thu, 15 Oct 2020 13:12:34 -0400 Subject: [PATCH] Respect SDKROOT and use_osx_frameworks --- setup.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 5e190b722..6d47bf9dc 100644 --- a/setup.py +++ b/setup.py @@ -600,21 +600,24 @@ def determine_base_flags(): environ.get('LOCALBASE', '/usr/local'), 'include')] flags['library_dirs'] += [join( environ.get('LOCALBASE', '/usr/local'), 'lib')] - elif platform == 'darwin': + elif platform == 'darwin' and c_options['use_osx_frameworks']: v = os.uname() if v[2] >= '13.0.0': - # use xcode-select to search on the right Xcode path - # XXX use the best SDK available instead of a specific one - import platform as _platform - xcode_dev = getoutput('xcode-select -p').splitlines()[0] - sdk_mac_ver = '.'.join(_platform.mac_ver()[0].split('.')[:2]) - print('Xcode detected at {}, and using OS X{} sdk'.format( - xcode_dev, sdk_mac_ver)) - sysroot = join( - xcode_dev.decode('utf-8'), - 'Platforms/MacOSX.platform/Developer/SDKs', - 'MacOSX{}.sdk'.format(sdk_mac_ver), - 'System/Library/Frameworks') + if 'SDKROOT' in environ: + sysroot = join(environ['SDKROOT'], 'System/Library/Frameworks') + else: + # use xcode-select to search on the right Xcode path + # XXX use the best SDK available instead of a specific one + import platform as _platform + xcode_dev = getoutput('xcode-select -p').splitlines()[0] + sdk_mac_ver = '.'.join(_platform.mac_ver()[0].split('.')[:2]) + print('Xcode detected at {}, and using OS X{} sdk'.format( + xcode_dev, sdk_mac_ver)) + sysroot = join( + xcode_dev.decode('utf-8'), + 'Platforms/MacOSX.platform/Developer/SDKs', + 'MacOSX{}.sdk'.format(sdk_mac_ver), + 'System/Library/Frameworks') else: sysroot = ('/System/Library/Frameworks/' 'ApplicationServices.framework/Frameworks')