From 6076a2ddc17b2458253a5ac199c2c59f9991111c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 1 Mar 2017 08:51:33 -0700 Subject: [PATCH] Format the two Apple-related SConscripts to Python coding standards No functional changes. Change is made preparatory to pushing a patch for iot-1862 for a problem in darwin/SConscript Change-Id: I8a8e492b352871252641d6ffa032c4f2b9f76f15 Signed-off-by: Mats Wichmann Reviewed-on: https://gerrit.iotivity.org/gerrit/17583 Tested-by: jenkins-iotivity Reviewed-by: George Nash Reviewed-by: Phil Coval --- build_common/darwin/SConscript | 65 +++++++++++++++++++++--------------------- build_common/ios/SConscript | 14 ++++----- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/build_common/darwin/SConscript b/build_common/darwin/SConscript index ec2b28e..b1ba8e4 100644 --- a/build_common/darwin/SConscript +++ b/build_common/darwin/SConscript @@ -1,6 +1,6 @@ # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*- ## -# This script set darwin specific flags (GNU GCC) +# This script sets darwin specific flags (GNU GCC) # ## import os @@ -13,71 +13,72 @@ Import('env') target_arch = env.get('TARGET_ARCH') target_os = env.get('TARGET_OS') -tc_path=commands.getoutput('xcode-select -p') +tc_path = commands.getoutput('xcode-select -p') -tc_sdks=commands.getoutput('xcodebuild -showsdks') +tc_sdks = commands.getoutput('xcodebuild -showsdks') -#Find the SDK's that are installed -sdks=[] +# Find the SDK's that are installed +sdks = [] for line in tc_sdks.split('\n'): if (line == ''): - bIn=False + bIn = False if (line[:10] == 'OS X SDKs:'): - bIn=(target_os == 'darwin') + bIn = (target_os == 'darwin') elif (line[:9] == 'iOS SDKs:'): - bIn=(target_os == 'ios') + bIn = (target_os == 'ios') elif bIn: sdks.append(line[:14].strip()) -#find the latest -maxsdk='0.0' +# find the latest sdk +maxsdk = '0.0' if len(sdks) > 0: for sdk in sdks: - p = sdk.rsplit(' ',1)[1] + p = sdk.rsplit(' ', 1)[1] if (StrictVersion(p)) > StrictVersion(maxsdk): - maxsdk=p + maxsdk = p # SYS_VERSION build option help_vars = Variables() -help_vars.Add('SYS_VERSION', 'MAC OS X SDK version / IOS SDK version', os.environ.get('SYS_VERSION')) +help_vars.Add('SYS_VERSION', 'MAC OS X SDK version / IOS SDK version', + os.environ.get('SYS_VERSION')) help_vars.Update(env) Help(help_vars.GenerateHelpText(env)) sys_version = env.get('SYS_VERSION') -#if they didn't explictly set it use the auto-detected one +# if they didn't explictly set it use the auto-detected one if sys_version is None: - sys_version=maxsdk + sys_version = maxsdk -env['SYS_VERSION']=sys_version +env['SYS_VERSION'] = sys_version # Set release/debug flags if env.get('RELEASE'): - env.AppendUnique(CCFLAGS = ['-Os']) - env.AppendUnique(CPPDEFINES = ['NDEBUG']) + env.AppendUnique(CCFLAGS=['-Os']) + env.AppendUnique(CPPDEFINES=['NDEBUG']) else: - env.AppendUnique(CCFLAGS = ['-g']) - env.AppendUnique(LINKFLAGS = ['-g']) + env.AppendUnique(CCFLAGS=['-g']) + env.AppendUnique(LINKFLAGS=['-g']) if env.get('LOGGING'): - env.AppendUnique(CPPDEFINES = ['TB_LOG']) + env.AppendUnique(CPPDEFINES=['TB_LOG']) if env.get('SECURED') == '1': - env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto']) + env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto']) if target_os == 'darwin': - sys_root = tc_path + '/Platforms/MacOSX.platform/Developer/SDKs/MacOSX' + sys_version + '.sdk/' + sys_root = tc_path + '/Platforms/MacOSX.platform/Developer/SDKs/MacOSX' + sys_version + '.sdk/' else: - if target_arch in ['i386', 'x86_64']: - sys_root = tc_path + '/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator' + sys_version + '.sdk/' - else: - sys_root = tc_path + '/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS' + sys_version + '.sdk/' + if target_arch in ['i386', 'x86_64']: + sys_root = tc_path + '/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator' + sys_version + '.sdk/' + else: + sys_root = tc_path + '/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS' + sys_version + '.sdk/' # Set arch flags -env.AppendUnique(CCFLAGS = ['-arch', target_arch, '-isysroot', sys_root]) -env.AppendUnique(LINKFLAGS = ['-arch', target_arch, '-isysroot', sys_root]) +env.AppendUnique(CCFLAGS=['-arch', target_arch, '-isysroot', sys_root]) +env.AppendUnique(LINKFLAGS=['-arch', target_arch, '-isysroot', sys_root]) if target_os == 'darwin': - flag = '-mmacosx-version-min=' + sys_version - env.AppendUnique(CCFLAGS = [flag]) - env.AppendUnique(LINKFLAGS = [flag]) + flag = '-mmacosx-version-min=' + sys_version + env.AppendUnique(CCFLAGS=[flag]) + env.AppendUnique(LINKFLAGS=[flag]) diff --git a/build_common/ios/SConscript b/build_common/ios/SConscript index fcf62aa..6455f04 100644 --- a/build_common/ios/SConscript +++ b/build_common/ios/SConscript @@ -8,11 +8,11 @@ Import('env') env.SConscript('../darwin/SConscript') sys_version = env.get('SYS_VERSION') -if env.get('TARGET_ARCH') in ['i386', 'x86_64']: #Simulator - flag = '-mios-simulator-version-min=' + sys_version - env.AppendUnique(CCFLAGS = [flag]) - env.AppendUnique(LINKFLAGS = [flag]) +if env.get('TARGET_ARCH') in ['i386', 'x86_64']: # Simulator + flag = '-mios-simulator-version-min=' + sys_version + env.AppendUnique(CCFLAGS=[flag]) + env.AppendUnique(LINKFLAGS=[flag]) else: - flag = '-miphoneos-version-min=' + sys_version - env.AppendUnique(CCFLAGS = [flag]) - env.AppendUnique(LINKFLAGS = [flag]) \ No newline at end of file + flag = '-miphoneos-version-min=' + sys_version + env.AppendUnique(CCFLAGS=[flag]) + env.AppendUnique(LINKFLAGS=[flag]) -- 2.7.4