From 1ab059711996bb22d79484f57ea94e9e8dc5d661 Mon Sep 17 00:00:00 2001 From: "biao716.wang" Date: Wed, 8 Feb 2023 12:40:36 +0900 Subject: [PATCH] Fix build error with scons-4.4.0 version which is based on python3 Change-Id: I00b46873cc9131477e999fa07bdd7c54ca833708 Signed-off-by: biao716.wang --- android/android_api/SConscript | 6 +- auto_build.py | 6 +- build_common/SConscript | 18 ++-- build_common/android/SConscript | 20 ++-- build_common/arduino/SConscript | 22 ++--- build_common/darwin/SConscript | 6 +- build_common/external_libs.scons | 20 ++-- build_common/iotivityconfig/__init__.py | 2 +- .../compiler/default_configuration.py | 2 +- build_common/iotivityconfig/compiler/factory.py | 4 +- .../iotivityconfig/compiler/gcc_configuration.py | 4 +- build_common/linux/SConscript | 2 +- build_common/tizen/SConscript | 2 +- build_common/tizenrt/SConscript | 12 +-- build_common/tools/UnpackAll.py | 26 ++--- build_common/windows/SConscript | 2 +- extlibs/android/gradle/SConscript | 6 +- extlibs/android/sdk/SConscript | 10 +- extlibs/arduino/SConscript | 58 +++++------ extlibs/boost/SConscript | 10 +- extlibs/gtest/SConscript | 30 +++--- extlibs/hippomocks.scons | 6 +- extlibs/libcoap/SConscript | 12 +-- extlibs/libstrophe/SConscript | 38 ++++---- extlibs/mbedtls/SConscript | 8 +- extlibs/mbedtls/mbedtls/scripts/abi_check.py | 6 +- .../mbedtls/mbedtls/tests/scripts/check-files.py | 4 +- .../mbedtls/tests/scripts/generate_test_code.py | 4 +- .../mbedtls/mbedtls/tests/scripts/mbedtls_test.py | 2 +- .../tests/scripts/test_generate_test_code.py | 6 +- extlibs/raxmpp/SConscript | 18 ++-- extlibs/sqlite3/SConscript | 2 +- extlibs/tinycbor/SConscript | 12 +-- extlibs/wksxmppxep/SConscript | 28 +++--- extlibs/yaml/SConscript | 108 ++++++++++----------- plugins/src/SConscript | 6 +- plugins/zigbee_wrapper/SConscript | 2 +- plugins/zigbee_wrapper/src/SConscript | 2 +- .../zigbee_wrapper/telegesis_wrapper/SConscript | 2 +- .../telegesis_wrapper/src/SConscript | 2 +- resource/SConscript | 2 +- resource/c_common/SConscript | 2 +- resource/csdk/connectivity/SConscript | 42 ++++---- resource/csdk/connectivity/build/SConscript | 14 +-- .../csdk/connectivity/build/android/SConscript | 16 +-- .../csdk/connectivity/build/arduino/SConscript | 24 ++--- resource/csdk/connectivity/build/linux/SConscript | 2 +- resource/csdk/connectivity/build/tizen/SConscript | 6 +- .../csdk/connectivity/build/tizen/scons/SConscript | 16 +-- resource/csdk/connectivity/common/SConscript | 2 +- resource/csdk/connectivity/src/SConscript | 8 +- .../connectivity/src/bt_edr_adapter/SConscript | 2 +- .../csdk/connectivity/src/bt_le_adapter/SConscript | 2 +- .../src/bt_le_adapter/linux/SConscript | 2 +- .../src/bt_le_adapter/tizen/SConscript | 8 +- .../csdk/connectivity/src/ip_adapter/SConscript | 2 +- .../csdk/connectivity/src/nfc_adapter/SConscript | 2 +- .../csdk/connectivity/src/ra_adapter/SConscript | 2 +- .../csdk/connectivity/src/tcp_adapter/SConscript | 2 +- .../src/tcp_adapter/arduino/SConscript | 2 +- resource/csdk/connectivity/util/SConscript | 2 +- resource/csdk/logger/SConscript | 10 +- .../arduino/SimpleClientServer/ocserver/SConscript | 2 +- .../samples/tizen/SimpleClientServer/SConscript | 16 +-- .../tizen/SimpleClientServer/scons/SConscript | 16 +-- resource/csdk/stack/samples/tizen/build/SConscript | 10 +- .../stack/samples/tizen/build/scons/SConscript | 20 ++-- resource/examples/SConscript | 2 +- resource/provisioning/SConscript | 4 +- resource/provisioning/examples/SConscript | 6 +- resource/provisioning/unittests/SConscript | 6 +- resource/third_party_libs.scons | 8 +- service/easy-setup/mediator/richsdk/SConscript | 8 +- .../easy-setup/mediator/richsdk/android/SConscript | 4 +- .../sampleapp/enrollee/arduino/SConscript | 2 +- .../sampleapp/enrollee/linux-samsung/SConscript | 4 +- .../easy-setup/sampleapp/enrollee/linux/SConscript | 4 +- .../enrollee/tizen-sdb/EnrolleeSample/SConscript | 14 +-- .../tizen-sdb/EnrolleeSample/build/SConscript | 14 +-- .../EnrolleeSample/build/tizen/SConscript | 12 +-- .../sampleapp/mediator/android-samsung/SConscript | 4 +- .../sampleapp/mediator/android/SConscript | 4 +- service/notification/SConscript | 6 +- service/notification/android/SConscript | 4 +- .../notification/cpp-wrapper/consumer/SConscript | 6 +- .../cpp-wrapper/examples/linux/SConscript | 6 +- .../notification/cpp-wrapper/provider/SConscript | 6 +- .../android/NotiConsumerExample/SConscript | 4 +- .../android/NotiProviderExample/SConscript | 4 +- service/notification/examples/linux/SConscript | 6 +- service/resource-container/SConscript | 24 +++-- service/resource-container/android/SConscript | 4 +- service/resource-container/unittests/SConscript | 20 ++-- service/resource-encapsulation/android/SConscript | 4 +- service/simulator/SConscript | 4 +- service/third_party_libs.scons | 12 +-- tools/scons/BoostBootstrap.py | 4 +- tools/scons/BoostBuild.py | 4 +- tools/scons/Configure.py | 4 +- tools/scons/URLDownload.py | 16 +-- tools/scons/UnpackAll.py | 8 +- 101 files changed, 504 insertions(+), 508 deletions(-) diff --git a/android/android_api/SConscript b/android/android_api/SConscript index 7e79144..dd5b3a3 100644 --- a/android/android_api/SConscript +++ b/android/android_api/SConscript @@ -42,7 +42,7 @@ if 'ALL' in ANDROID_TRANSPORT: ANDROID_TRANSPORT_EDR = 1 ANDROID_TRANSPORT_BLE = 1 ANDROID_TRANSPORT_NFC = 1 - print "Android Transport is ALL" + print("Android Transport is ALL") else: if 'BT' in ANDROID_TRANSPORT: ANDROID_TRANSPORT_EDR = 1 @@ -62,7 +62,7 @@ else: ANDROID_VER = '5.0.1' if not os.path.exists(android_home + '/platforms/android-' + ANDROID_API_LEVEL) or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API %s' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -87,7 +87,7 @@ if not os.path.exists(android_home + '/platforms/android-' + ANDROID_API_LEVEL) ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' % (ANDROID_API_LEVEL, ANDROID_VER, ANDROID_API_LEVEL) +''' % (ANDROID_API_LEVEL, ANDROID_VER, ANDROID_API_LEVEL)) os.system(android_home + '/tools/android') def ensure_libs(target, source, env): diff --git a/auto_build.py b/auto_build.py index d40bf2f..2fa72a7 100644 --- a/auto_build.py +++ b/auto_build.py @@ -19,7 +19,7 @@ Usage: clean: python %s -c ''' - print (helpstr % (script, script)) + print((helpstr % (script, script))) sys.exit() def call_scons(build_options, extra_option_str): @@ -35,7 +35,7 @@ def call_scons(build_options, extra_option_str): cmd_line += " " + str(extra_option_str) - print ("Running : " + cmd_line) + print(("Running : " + cmd_line)) sys.stdout.flush() exit_code = subprocess.Popen([cmd_line], shell=True).wait() if exit_code != 0: @@ -277,7 +277,7 @@ def build_arduino(flag, extra_option_str): def build_tizen(flag, extra_option_str): print ("*********** Build for Tizen *************") cmd_line = "/bin/sh " + os.getcwd() + "/gbsbuild.sh" - print ("Running : " + cmd_line) + print(("Running : " + cmd_line)) subprocess.Popen([cmd_line], shell=True).wait() print ("*********** Build for Tizen octbstack lib and sample *************") diff --git a/build_common/SConscript b/build_common/SConscript index 4bed93b..ea739b2 100755 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -37,8 +37,8 @@ host = platform.system().lower() if 'msys_nt' in host: host = 'msys_nt' -if not host_target_map.has_key(host): - print "\nError: Current system (%s) isn't supported\n" % host +if host not in host_target_map: + print(("\nError: Current system (%s) isn't supported\n" % host)) Exit(1) ###################################################################### @@ -47,7 +47,7 @@ if not host_target_map.has_key(host): target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os if target_os not in host_target_map[host]: - print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]) + print(("\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]))) Exit(1) if target_os == 'android': @@ -80,7 +80,7 @@ else: # targets that do not support the DTLS build (SECURED=1 build option) targets_without_dtls_support = ['arduino']; if ARGUMENTS.get('SECURED') == '1' and target_os in targets_without_dtls_support: - print "\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os) + print(("\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os))) Exit(1) ###################################################################### @@ -217,11 +217,11 @@ if target_os in targets_support_cc: env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root]) env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root]) - if target_os == 'tizenrt': + if target_os == 'tizenrt': env.PrependENVPath('PATH', os.environ['PATH']) if prefix or tc_path: - print tc_set_msg + print(tc_set_msg) # If cross-compiling, honor environment settings for toolchain to avoid picking up native tools if os.environ.get('PKG_CONFIG') != None: @@ -244,12 +244,12 @@ env.SConscriptChdir(1) def __set_dir(env, dir): if not os.path.exists(dir + '/SConstruct'): - print ''' + print((''' *************************************** Error ********************************* * The directory(%s) seems isn't a source code directory, no SConstruct file is * found. * ******************************************************************************* -''' % dir +''' % dir)) Exit(1) if env.get('RELEASE'): @@ -445,7 +445,7 @@ if target_os == "yocto": if os.environ['LDFLAGS'] != None: env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS'])) except: - print "ERROR in Yocto cross-toolchain environment" + print("ERROR in Yocto cross-toolchain environment") Exit(1) ''' Now reset TARGET_OS to linux so that all linux specific build configurations diff --git a/build_common/android/SConscript b/build_common/android/SConscript index 2de28b1..46f08d7 100644 --- a/build_common/android/SConscript +++ b/build_common/android/SConscript @@ -24,25 +24,25 @@ if not env.get('ANDROID_HOME'): if env.get('ANDROID_NDK'): android_ndk = env.get('ANDROID_NDK') else: - print ''' + print(''' *************************************** Info ********************************** * Android NDK path isn't set, the default will be used. You can set * * environment variable ANDROID_NDK or add it in command line as: * * # scons ANDROID_NDK= ... * ******************************************************************************* -''' +''') android_ndk = os.path.join(env.get('SRC_DIR'), 'extlibs', 'android', 'ndk', 'android-ndk-r10d') if env.get('ANDROID_GRADLE'): android_gradle = env.get('ANDROID_GRADLE') else: - print ''' + print(''' *************************************** Info ********************************** * Android Gradle path isn't set, the default will be used. You can set * * environment variable ANDROID_GRADLE or add it in command line as: * * # scons ANDROID_GRADLE= ... * ******************************************************************************* -''' +''') android_gradle = os.path.join(env.get('SRC_DIR'), 'extlibs', 'android', 'gradle', 'gradle-2.2.1', 'bin', 'gradle') help_vars.Update(env) @@ -84,12 +84,12 @@ if env['HOST_OS'] == 'win32': ndk_build_cmd += '.cmd' if not os.path.isfile(ndk_build_cmd): - print ''' + print(''' *************************************** Error ********************************* * It seems android ndk path is not set properly, please check if "%s" * is the root directory of android ndk. * ******************************************************************************* -''' % android_ndk +''' % android_ndk) Exit(1) # ANDROID_HOME build option @@ -100,13 +100,13 @@ else: help_vars.Add(PathVariable('ANDROID_HOME', 'ANDROID SDK root directory', os.environ.get('ANDROID_HOME'))) help_vars.Update(env) Help(help_vars.GenerateHelpText(env)) - print ''' + print(''' *************************************** Info ********************************** * Environment variable ANDROID_HOME will use default value. To override * * root directory of android sdk, please specify ANDROID_HOME as follows: * * scons ANDROID_HOME= * ******************************************************************************* -''' +''') target_arch = env.get('TARGET_ARCH') @@ -127,12 +127,12 @@ else: if tc_ver != '': cmd.append('NDK_TOOLCHAIN_VERSION=' + tc_ver) else: - print ''' + print(''' *************************************** Warning ******************************* * To support C++11, the toolchain should be >= 4.7, please make sure your * * android NDK is at least r8e! * ******************************************************************************* -''' +''') cmd.append('-n') diff --git a/build_common/arduino/SConscript b/build_common/arduino/SConscript index 5dffa92..dea95b9 100644 --- a/build_common/arduino/SConscript +++ b/build_common/arduino/SConscript @@ -27,7 +27,7 @@ def __parse_config(f): def __get_boards(dict): boards = [] - keys = dict.keys() + keys = list(dict.keys()) for key in keys: idx = key.find('.name') if idx > 0: @@ -37,7 +37,7 @@ def __get_boards(dict): def __get_cpu(dict, board): cpus = [] - keys = dict.keys() + keys = list(dict.keys()) for key in keys: idx = key.find(board + '.menu.cpu.') start = len(board + '.menu.cpu.') @@ -190,13 +190,13 @@ def __upload(env, binary): port = '/dev/ttyACM0' upload_cmd = arduino_home + '/hardware/tools/avr/bin/avrdude -C' + arduino_home +'/hardware/tools/avr/etc/avrdude.conf -p' \ + mcu + ' -c' + protocol + ' -P' + port + ' -b' + speed + ' -D -Uflash:w:' + binary + ':i' - print "Upload command: %s" %upload_cmd + print("Upload command: %s" %upload_cmd) install_cmd = env.Command('install_cmd', None, upload_cmd) env.Default('install_cmd') elif target_arch == 'arm': port = 'ttyACM0' upload_cmd = 'stty -F /dev/' + port + ' speed 1200 cs8 -cstopb -parenb \n' + arduino_home + '/hardware/tools/bossac -i --port=' + port + ' -U false -e -w -b ' + binary + ' -R' - print "Upload command: %s" %upload_cmd + print("Upload command: %s" %upload_cmd) install_cmd = env.Command('install_cmd', None, upload_cmd) env.Default('install_cmd') @@ -234,7 +234,7 @@ target_arch = env.get('TARGET_ARCH') # installed. If not, get them and install them. SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'arduino', 'SConscript')) arduino_home = env.get('ARDUINO_HOME') -print 'ARDUINO_HOME = ' + env.get('ARDUINO_HOME') +print('ARDUINO_HOME = ' + env.get('ARDUINO_HOME')) # Overwrite suffixes and prefixes if env['HOST_OS'] == 'win32': @@ -269,12 +269,12 @@ if os.path.exists(os.path.join(arduino_home, 'lib', 'version.txt')): vf = open(os.path.join(arduino_home, 'lib', 'version.txt'), 'r') version = vf.readline().replace('.', '').strip() else: - print ''' + print(''' ************************************* Error *********************************** * Can't find version file (lib/version.txt), please check if (%s) * is arduino root directory. * ******************************************************************************* -''' % arduino_home +''' % arduino_home) Exit(1) if version[0:2] == '10': @@ -288,12 +288,12 @@ if version[0:2] == '10': env.Replace(LINK = 'avr-gcc') env.Replace(RANLIB = 'avr-ranlib') if target_arch != 'avr': - print ''' + print(''' ************************************* Error *********************************** * Arduino 1.0.x IDE only support 'avr', to support other arch at least 1.5.x * * is required. ******************************************************************************* -''' +''') Exit(1) else: is_1_0_x = False @@ -304,11 +304,11 @@ else: boards_info = __parse_config(os.path.join(arduino_home, 'hardware', 'arduino', 'sam', 'boards.txt')) platform_info = __parse_config(os.path.join(arduino_home, 'hardware', 'arduino', 'sam', 'platform.txt')) else: - print ''' + print(''' ************************************* Error *********************************** * CPU arch %s isn't supported currently. ******************************************************************************* -''' % target_arch +''' % target_arch) #Board option, let user to select the board boards = __get_boards(boards_info) diff --git a/build_common/darwin/SConscript b/build_common/darwin/SConscript index 06fdac6..ca35673 100644 --- a/build_common/darwin/SConscript +++ b/build_common/darwin/SConscript @@ -5,7 +5,7 @@ ## import os import platform -import commands +import subprocess from distutils.version import StrictVersion Import('env') @@ -13,9 +13,9 @@ Import('env') target_arch = env.get('TARGET_ARCH') target_os = env.get('TARGET_OS') -tc_path=commands.getoutput('xcode-select -p') +tc_path=subprocess.getoutput('xcode-select -p') -tc_sdks=commands.getoutput('xcodebuild -showsdks') +tc_sdks=subprocess.getoutput('xcodebuild -showsdks') #Find the SDK's that are installed sdks=[] diff --git a/build_common/external_libs.scons b/build_common/external_libs.scons index 85550d0..b9c6947 100644 --- a/build_common/external_libs.scons +++ b/build_common/external_libs.scons @@ -21,7 +21,7 @@ # ## import os, subprocess -import urllib2, urlparse +import urllib.request, urllib.error, urllib.parse, urllib.parse import SCons.Errors Import('env') @@ -79,21 +79,21 @@ def __prepare_lib(ienv, libname, lib = None, path = None, script = None): SConscript(st) else: if target_os in ['linux', 'darwin', 'tizen']: - print 'Don\'t find library(%s), please intall it, exit ...' % libname + print(('Don\'t find library(%s), please intall it, exit ...' % libname)) else: - print 'Don\'t find library(%s) and don\'t find the process script (%s), exit ...' % (libname, st) + print(('Don\'t find library(%s) and don\'t find the process script (%s), exit ...' % (libname, st))) Exit(1) conf.Finish() # Run configure command (usually it's done before build a library) def __configure(env, cwd, cmd) : - print "Configuring using [%s/%s] ..." % (cwd, cmd) + print(("Configuring using [%s/%s] ..." % (cwd, cmd))) # build it now (we need the shell, because some programs need it) devnull = open(os.devnull, "wb") handle = subprocess.Popen(cmd, shell=True, cwd=cwd, stdout=devnull) - if handle.wait() <> 0 : + if handle.wait() != 0 : raise SCons.Errors.BuildError( "Run configuring script [%s]" % (cmd) ) # Download from URL 'url', will save as 'target' @@ -102,15 +102,15 @@ def __download(ienv, target, url) : return target try : - print "Download %s from %s" % (target, url) - print "Downloading ..." - stream = urllib2.urlopen(url) + print(("Download %s from %s" % (target, url))) + print("Downloading ...") + stream = urllib.request.urlopen(url) file = open(target, 'wb') file.write(stream.read()) file.close() - print "Download %s from %s complete" % (target, url) + print(("Download %s from %s complete" % (target, url))) return target - except Exception, e : + except Exception as e : raise SCons.Errors.StopError( '%s [%s]' % (e, url) ) # Install header file(s) to /deps//include diff --git a/build_common/iotivityconfig/__init__.py b/build_common/iotivityconfig/__init__.py index 3a2ef6a..5a276ca 100644 --- a/build_common/iotivityconfig/__init__.py +++ b/build_common/iotivityconfig/__init__.py @@ -17,7 +17,7 @@ # This file contains compiler tests for use in scons 'Configure' # tests. -from compiler import factory +from .compiler import factory def _check_for_broken_gcc_headers(context, flag): # Check for issue in some older (pre-C++11) C library headers that diff --git a/build_common/iotivityconfig/compiler/default_configuration.py b/build_common/iotivityconfig/compiler/default_configuration.py index ed90f40..76f000d 100644 --- a/build_common/iotivityconfig/compiler/default_configuration.py +++ b/build_common/iotivityconfig/compiler/default_configuration.py @@ -14,7 +14,7 @@ # limitations under the License. # ------------------------------------------------------------------------ -from configuration import Configuration +from .configuration import Configuration # Default (very simple) compiler configuration class DefaultConfiguration(Configuration): diff --git a/build_common/iotivityconfig/compiler/factory.py b/build_common/iotivityconfig/compiler/factory.py index 7b0bee7..975a081 100644 --- a/build_common/iotivityconfig/compiler/factory.py +++ b/build_common/iotivityconfig/compiler/factory.py @@ -14,8 +14,8 @@ # limitations under the License. # ------------------------------------------------------------------------ -from default_configuration import * -from gcc_configuration import * +from .default_configuration import * +from .gcc_configuration import * # Canonicalize the C or C++ compiler name to "gcc" if gcc is being # used to simplify mapping to the GCC compiler configuration since GCC diff --git a/build_common/iotivityconfig/compiler/gcc_configuration.py b/build_common/iotivityconfig/compiler/gcc_configuration.py index fbc8f38..436caeb 100644 --- a/build_common/iotivityconfig/compiler/gcc_configuration.py +++ b/build_common/iotivityconfig/compiler/gcc_configuration.py @@ -14,7 +14,7 @@ # limitations under the License. # ------------------------------------------------------------------------ -from configuration import Configuration +from .configuration import Configuration # GCC compiler-specific configuration class GccConfiguration(Configuration): @@ -31,7 +31,7 @@ class GccConfiguration(Configuration): # flag is required to compile C99 code without warning or # error. - from default_configuration import DefaultConfiguration + from .default_configuration import DefaultConfiguration def_config = DefaultConfiguration(self._context) return """ diff --git a/build_common/linux/SConscript b/build_common/linux/SConscript index 137fad0..dbd881c 100644 --- a/build_common/linux/SConscript +++ b/build_common/linux/SConscript @@ -5,7 +5,7 @@ ## Import('env') -print "Reading linux configuration script" +print("Reading linux configuration script") # Set release/debug flags if env.get('RELEASE'): diff --git a/build_common/tizen/SConscript b/build_common/tizen/SConscript index 69bf224..824ab15 100644 --- a/build_common/tizen/SConscript +++ b/build_common/tizen/SConscript @@ -7,7 +7,7 @@ import SCons.Util Import('env') -print "Reading linux configuration script" +print("Reading linux configuration script") # Set release/debug flags if env.get('RELEASE'): diff --git a/build_common/tizenrt/SConscript b/build_common/tizenrt/SConscript index 6325807..f3a8db6 100644 --- a/build_common/tizenrt/SConscript +++ b/build_common/tizenrt/SConscript @@ -24,7 +24,7 @@ import platform Import('env') -print "Reading tizenrt configuration script" +print("Reading tizenrt configuration script") host = platform.system().lower() @@ -33,15 +33,15 @@ default_os_dir = env.GetLaunchDir() + '/../../../os' # TIZENRT_OS_DIR build option if env.get('TIZENRT_OS_DIR'): tizenrt_os_dir = ARGUMENTS.get('TIZENRT_OS_DIR',default_os_dir) - print 'TIZENRT_OS_DIR = ' + tizenrt_os_dir + print('TIZENRT_OS_DIR = ' + tizenrt_os_dir) else: - print ''' + print(''' *************************************** Info ********************************** * Environment variable TIZENRT_OS_DIR must be set to absolute path of * * tizenrt os directory. To set, please specify TIZENRT_OS_DIR as follows: * * scons TIZENRT_OS_DIR= * ******************************************************************************* -''' +''') target_arch = env.get('TARGET_ARCH') @@ -59,7 +59,7 @@ env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__TIZENRT__']) # Set device name to __OIC_DEVICE_NAME__ env.AppendUnique(CPPDEFINES = ['-D__OIC_DEVICE_NAME__=' + "\'\"" + env.get('DEVICE_NAME') + "\"\'"]) if env.get('LOGGING'): - print 'LOGGING is enabled' + print('LOGGING is enabled') env.AppendUnique(CPPDEFINES = ['TB_LOG']) @@ -74,4 +74,4 @@ dep_lib_dir = '/usr/lib/arm-none-eabi/include' env.AppendUnique(CPPPATH = [ dep_src_dir1, dep_src_dir2 ]) env.AppendUnique(LIBPATH = [ dep_lib_dir ]) -print env.get('CPPPATH') +print(env.get('CPPPATH')) diff --git a/build_common/tools/UnpackAll.py b/build_common/tools/UnpackAll.py index 85e1689..9788992 100644 --- a/build_common/tools/UnpackAll.py +++ b/build_common/tools/UnpackAll.py @@ -99,7 +99,7 @@ import SCons.Util # enables Scons warning for this builder -class UnpackWarning(SCons.Warnings.Warning) : +class UnpackWarning(SCons.Warnings.SConsWarning) : pass SCons.Warnings.enableWarningClass(UnpackWarning) @@ -156,7 +156,7 @@ def __fileextractor_win_7zip( env, count, no, i ) : def __getExtractor( source, env ) : # we check each unpacker and get the correc list command first, run the command and # replace the target filelist with the list values, we sorte the extractors by their priority - for unpackername, extractor in sorted(env["UNPACK"]["EXTRACTOR"].iteritems(), key = lambda (k,v) : (v["PRIORITY"],k)): + for unpackername, extractor in sorted(iter(env["UNPACK"]["EXTRACTOR"].items()), key = lambda k_v : (k_v[1]["PRIORITY"],k_v[0])): # if the run command not set, we continue the extractor search, otherwise we check the extractor parameters if not SCons.Util.is_String(extractor["RUN"]) : @@ -193,7 +193,7 @@ def __getExtractor( source, env ) : # @param source source name # @param env environment object def __message( s, target, source, env ) : - print "extract [%s] ..." % (source[0]) + print("extract [%s] ..." % (source[0])) # action function for extracting of the data @@ -220,7 +220,7 @@ def __action( target, source, env ) : devnull = open(os.devnull, "wb") handle = subprocess.Popen( cmd, shell=True, stdout=devnull ) - if handle.wait() <> 0 : + if handle.wait() != 0 : raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source[0]) ) @@ -239,7 +239,7 @@ def __emitter( target, source, env ) : # the targets. On physical files we can do this with the LISTCMD, but on # non-physical files we hope the user knows the target files, so we inject # this knowledge into the return target. - if env.has_key("UNPACKLIST") : + if "UNPACKLIST" in env : if not SCons.Util.is_List(env["UNPACKLIST"]) and not SCons.Util.is_String(env["UNPACKLIST"]) : raise SCons.Errors.StopError( "manual target list of [%s] must be a string or list" % (source[0]) ) if not env["UNPACKLIST"] : @@ -257,7 +257,7 @@ def __emitter( target, source, env ) : handle = subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE ) target = handle.stdout.readlines() handle.communicate() - if handle.returncode <> 0 : + if handle.returncode != 0 : raise SCons.Errors.StopError("error on running list command [%s] of the source file [%s]" % (cmd, source[0]) ) # if the returning output exists and the listseperator is a callable structure @@ -265,8 +265,8 @@ def __emitter( target, source, env ) : # a string we push it back to the target list try : if callable(extractor["LISTEXTRACTOR"]) : - target = filter( lambda s : SCons.Util.is_String(s), [ extractor["LISTEXTRACTOR"]( env, len(target), no, i) for no, i in enumerate(target) ] ) - except Exception, e : + target = [s for s in [ extractor["LISTEXTRACTOR"]( env, len(target), no, i) for no, i in enumerate(target) ] if SCons.Util.is_String(s)] + except Exception as e : raise SCons.Errors.StopError( "%s" % (e) ) # the line removes duplicated names - we need this line, otherwise an cyclic dependency error will occured, @@ -276,7 +276,7 @@ def __emitter( target, source, env ) : SCons.Warnings.warn(UnpackWarning, "emitter file list on target [%s] is empty, please check your extractor list function [%s]" % (source[0], cmd) ) # we append the extractdir to each target if is not absolut - if env["UNPACK"]["EXTRACTDIR"] <> "." : + if env["UNPACK"]["EXTRACTDIR"] != "." : target = [i if os.path.isabs(i) else os.path.join(env["UNPACK"]["EXTRACTDIR"], i) for i in target] return target, source @@ -285,7 +285,7 @@ def __unpack_all(env, target, source) : if os.path.exists(target): return - print "Unpacking %s ..." % source + print("Unpacking %s ..." % source) __action(target, source, env) # generate function, that adds the builder to the environment @@ -378,7 +378,7 @@ def generate( env ) : } # read tools for Windows system - if env["PLATFORM"] <> "darwin" and "win" in env["PLATFORM"] : + if env["PLATFORM"] != "darwin" and "win" in env["PLATFORM"] : if env.WhereIs('7z', env.get('PATH')): toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "7z" @@ -423,12 +423,12 @@ def generate( env ) : toolset["EXTRACTOR"]["TAR"]["EXTRACTFLAGS"] = "x" toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-y -ttar -o${UNPACK['EXTRACTDIR']}" else: - print '''*********************** Error ************************ + print('''*********************** Error ************************ * * * Please make sure that 7-zip is in your System PATH * * * ****************************************************** -''' +''') # here can add some other Windows tools, that can handle the archive files # but I don't know which ones can handle all file types diff --git a/build_common/windows/SConscript b/build_common/windows/SConscript index 48eee71..1718d67 100644 --- a/build_common/windows/SConscript +++ b/build_common/windows/SConscript @@ -37,6 +37,6 @@ if env['CC'] == 'cl': env.AppendUnique(PATH = os.environ['PATH']) elif env['CC'] == 'gcc': - print "\nError: gcc not supported on Windows. Use Visual Studio!\n" + print("\nError: gcc not supported on Windows. Use Visual Studio!\n") Exit(1); diff --git a/extlibs/android/gradle/SConscript b/extlibs/android/gradle/SConscript index 9cece4b..de33da2 100644 --- a/extlibs/android/gradle/SConscript +++ b/extlibs/android/gradle/SConscript @@ -8,7 +8,7 @@ SConscript('../../../build_common/external_libs.scons') target_os = env.get('TARGET_OS') host_os = sys.platform -print host_os +print(host_os) SConscript('../../../build_common/external_libs.scons') ###################################################################### # Build flags @@ -21,9 +21,9 @@ path = os.path.join(src_dir, 'extlibs', 'android', 'gradle', 'gradle-2.2.1') if not os.path.exists(path): gradle_zip = env.Download('gradle2.2.1.zip', 'https://services.gradle.org/distributions/gradle-2.2.1-all.zip') gradle_dir = env.UnpackAll('gradle-2.2.1', gradle_zip) - print ''' + print(''' *********************************************************************** * Downloading gradle: * ******************************************************************************* -''' +''') diff --git a/extlibs/android/sdk/SConscript b/extlibs/android/sdk/SConscript index 7b7b1ba..4792253 100644 --- a/extlibs/android/sdk/SConscript +++ b/extlibs/android/sdk/SConscript @@ -3,7 +3,7 @@ ## import os, subprocess, struct -import urllib2, urlparse +import urllib.request, urllib.error, urllib.parse, urllib.parse import SCons.Errors import shutil @@ -19,7 +19,7 @@ SConscript(src_dir + '/build_common/external_libs.scons') if target_os == 'android': android_home = env.get('ANDROID_HOME') if not android_home: - print 'Creating ANDROID_HOME for Android SDK' + print('Creating ANDROID_HOME for Android SDK') # older IoTivity versions expected the SDK at this position, this is left for backwards compatibility androidlib_dir = src_dir + '/extlibs/android/sdk/android-sdk_r24.2' @@ -47,9 +47,9 @@ if target_os == 'android': androidlib_zip = androidlib_zip_file # Unzip the lib - print 'Unzipping android lib...' + print('Unzipping android lib...') env.UnpackAll(androidlib_dir, androidlib_zip) - print 'Unzipping android lib complete' + print('Unzipping android lib complete') # Remove downloaded file # os.remove(androidlib_zip_file) @@ -58,6 +58,6 @@ if target_os == 'android': # Set the ANDROID_HOME env.Replace(ANDROID_HOME = androidlib_dir) -print 'ANDROID_HOME = ' + env.get('ANDROID_HOME') +print('ANDROID_HOME = ' + env.get('ANDROID_HOME')) diff --git a/extlibs/arduino/SConscript b/extlibs/arduino/SConscript index 879fe2c..368fe07 100644 --- a/extlibs/arduino/SConscript +++ b/extlibs/arduino/SConscript @@ -4,7 +4,7 @@ ## import os, subprocess, struct -import urllib2, urlparse +import urllib.request, urllib.error, urllib.parse, urllib.parse import SCons.Errors import shutil @@ -20,8 +20,8 @@ SConscript(src_dir + '/build_common/external_libs.scons') if target_os == 'arduino': arduino_home = env.get('ARDUINO_HOME') if not arduino_home: - print 'Creating ARDUINO_HOME for Arduino lib' - print ''' + print('Creating ARDUINO_HOME for Arduino lib') + print(''' ******************************************************************************* * Arduino root directory isn't set, you can set enviornment variable * * ARDUINO_HOME or add it in command line as follows (Only set if your * @@ -29,14 +29,14 @@ if target_os == 'arduino': * wish to manually set ARDUINO_HOME.): * * # scons ARDUINO_HOME= ... * ******************************************************************************* - ''' + ''') arduinolib_dir = src_dir + '/extlibs/arduino/arduino-1.5.8' if not os.path.exists(arduinolib_dir): from sys import platform as _platform if _platform == "linux" or _platform == "linux2": archType = 8 * struct.calcsize("P") - print 'On %s-bit machine.' % (archType) + print('On %s-bit machine.' % (archType)) if archType == 32: arduinolib_zip_file = src_dir + '/extlibs/arduino/arduino-1.5.8-linux32.tgz' arduinolib_url = 'http://arduino.cc/download.php?f=/arduino-1.5.8-linux32.tgz' @@ -57,9 +57,9 @@ if target_os == 'arduino': arduinolib_zip = arduinolib_zip_file # Unzip the lib - print 'Unzipping arduino lib...' + print('Unzipping arduino lib...') env.UnpackAll(arduinolib_dir, arduinolib_zip) - print 'Unzipping arduino lib complete' + print('Unzipping arduino lib complete') # Remove downloaded file os.remove(arduinolib_zip_file) @@ -82,12 +82,12 @@ if target_os == 'arduino': timelib_zip = timelib_zip_file # Unzip the lib - print 'Unzipping Arduino Time lib...' + print('Unzipping Arduino Time lib...') env.UnpackAll(timelib_dir + '/Time', timelib_zip) # Apply patches to ARDUINO_HOME directory. os.chdir(arduinolib_dir) - print 'Patching Arduino libraries...' + print('Patching Arduino libraries...') os.system("find ./libraries/Time/Time/DateStrings.cpp -type f -exec dos2unix {} \;") os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch --directory=" + arduinolib_dir) @@ -95,11 +95,11 @@ if target_os == 'arduino': # Remove downloaded file os.remove(timelib_zip_file) else: - print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.' - print 'You may likely retrieve this package as follows:' - print ' sudo apt-get install dos2unix' - print ' or' - print ' sudo yum install dos2unix' + print('Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.') + print('You may likely retrieve this package as follows:') + print(' sudo apt-get install dos2unix') + print(' or') + print(' sudo yum install dos2unix') exit(1) redbearlib_dir = arduinolib_dir + '/libraries/RBL_nRF8001' @@ -114,7 +114,7 @@ if target_os == 'arduino': redbearlib_zip = redbearlib_zip_file # Unzip the lib - print 'Unzipping Red Bear lib...' + print('Unzipping Red Bear lib...') os.chdir(arduinolib_dir + '/libraries') env.UnpackAll(redbearlib_dir, redbearlib_zip) @@ -123,7 +123,7 @@ if target_os == 'arduino': shutil.rmtree('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747') # Apply Red Bear patches - print 'Patching Red Bear library...' + print('Patching Red Bear library...') os.chdir(arduinolib_dir + '/libraries/RBL_nRF8001/') os.system("find . -type f -exec dos2unix {} \;") @@ -132,11 +132,11 @@ if target_os == 'arduino': # Remove downloaded file os.remove(redbearlib_zip_file) else: - print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.' - print 'You may likely retrieve this package as follows:' - print ' sudo apt-get install dos2unix' - print ' or' - print ' sudo yum install dos2unix' + print('Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.') + print('You may likely retrieve this package as follows:') + print(' sudo apt-get install dos2unix') + print(' or') + print(' sudo yum install dos2unix') exit(1) nordiclib_dir = arduinolib_dir + '/libraries/BLE' @@ -151,7 +151,7 @@ if target_os == 'arduino': nordiclib_zip = nordiclib_zip_file # Unzip the lib - print 'Unzipping Nordic lib...' + print('Unzipping Nordic lib...') os.chdir(arduinolib_dir + '/libraries') env.UnpackAll(nordiclib_dir, nordiclib_zip) @@ -160,7 +160,7 @@ if target_os == 'arduino': shutil.rmtree('ble-sdk-arduino-0.9.5.beta') # Apply Nordic lib patches - print 'Patching Nordic library...' + print('Patching Nordic library...') os.chdir(arduinolib_dir + '/libraries/BLE/') os.system("find . -type f -exec dos2unix {} \;") @@ -169,13 +169,13 @@ if target_os == 'arduino': # Remove downloaded file os.remove(nordiclib_zip_file) else: - print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.' - print 'You may likely retrieve this package as follows:' - print ' sudo apt-get install dos2unix' - print ' or' - print ' sudo yum install dos2unix' + print('Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.') + print('You may likely retrieve this package as follows:') + print(' sudo apt-get install dos2unix') + print(' or') + print(' sudo yum install dos2unix') exit(1) # Set the ARDUINO_HOME env.Replace(ARDUINO_HOME = arduinolib_dir) -print 'ARDUINO_HOME = ' + env.get('ARDUINO_HOME') +print('ARDUINO_HOME = ' + env.get('ARDUINO_HOME')) diff --git a/extlibs/boost/SConscript b/extlibs/boost/SConscript index cae1be1..729fbfc 100644 --- a/extlibs/boost/SConscript +++ b/extlibs/boost/SConscript @@ -26,7 +26,7 @@ boost_bootstrap = os.path.join(boost_dir,'bootstrap.bat') if 'linux' == target_os : # Check for Boost libraries in /usr/boost - print 'TODO: Perform platform check for linux' + print('TODO: Perform platform check for linux') raise SCons.Errors.EnvironmentError('Unsupported platform') elif target_os in ['windows']: @@ -38,11 +38,11 @@ elif target_os in ['windows']: if os.path.exists(boost_zip_file): boost_zip = boost_zip_file else: - print '*** Downloading Boost zip file (> 100MB). Please wait... ***' + print('*** Downloading Boost zip file (> 100MB). Please wait... ***') boost_zip = env.Download(boost_zip_file, boost_url) # Unzip boost - print '*** Unpacking boost %s zip file ... ***' % boost_version + print('*** Unpacking boost %s zip file ... ***' % boost_version) env.UnpackAll(boost_dir, boost_zip) # Rename from boost_1_60_0 -> boost @@ -50,7 +50,7 @@ elif target_os in ['windows']: # Sanity check, in case the above method didn't work if not os.path.exists(boost_bootstrap): - print ''' + print(''' *********************************** Error: **************************************** * Please download boost from the following website: * @@ -65,7 +65,7 @@ elif target_os in ['windows']: * ''' + boost_bootstrap + ''' * *********************************************************************************** -''' +''') Exit(1) elif target_os in ['android']: diff --git a/extlibs/gtest/SConscript b/extlibs/gtest/SConscript index df306f4..30102ea 100644 --- a/extlibs/gtest/SConscript +++ b/extlibs/gtest/SConscript @@ -22,10 +22,10 @@ gtest_zip_file = os.path.join(src_dir, 'extlibs', 'gtest', 'gtest-1.7.0.zip') gtest_url = 'http://pkgs.fedoraproject.org/repo/pkgs/gtest/gtest-1.7.0.zip/2d6ec8ccdf5c46b05ba54a9fd1d130d7/gtest-1.7.0.zip' if target_os in targets_need_gtest: - print '*** Checking for installation of google unit test 1.7.0 ***' + print('*** Checking for installation of google unit test 1.7.0 ***') env_lib_path = env.get('LIBPATH') if gtest_lib_dir in env_lib_path: - print '*** Found google unit test, set environments ***' + print('*** Found google unit test, set environments ***') gtest_env.AppendUnique(LIBPATH = [gtest_dotlib_dir]) gtest_env.PrependUnique(CPPPATH = [os.path.join(gtest_dir, 'include')]) gtest_env.AppendENVPath('LD_LIBRARY_PATH', gtest_dotlib_dir) @@ -40,7 +40,7 @@ if target_os in targets_need_gtest: gtest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE']) Return('gtest_env') else: - print '*** Prepare to build google unit test 1.7.0 ***' + print('*** Prepare to build google unit test 1.7.0 ***') if os.path.exists(gtest_dir): shutil.rmtree(gtest_dir) # If the gtest zip file is not already present, download it @@ -48,7 +48,7 @@ if target_os in targets_need_gtest: gtest_zip = gtest_env.Download(gtest_zip_file, gtest_url) else: gtest_zip = gtest_zip_file - print 'Unzipping to : ' + gtest_dir + print('Unzipping to : ' + gtest_dir) gtest_env.UnpackAll(gtest_dir, gtest_zip) if target_os == 'darwin': @@ -60,39 +60,39 @@ if target_os == 'darwin': # os.mkdir(gtest_lib_dir) - print 'Invoke cmake command to generate appropriate make files' + print('Invoke cmake command to generate appropriate make files') gtest_env.Configure(gtest_dir, './configure') # Run make on gtest - print 'Making google unit test' + print('Making google unit test') gtest_env.Configure(gtest_dir, 'make') # print 'Create a directory' # os.mkdir(gtest_dotlib_dir) - print 'Change to a directory' + print('Change to a directory') os.chdir(gtest_dotlib_dir) ## print 'Change to a directory' # os.chdir(gtest_lib_dir) - print 'Create hard links pointing to gtest libraries' + print('Create hard links pointing to gtest libraries') os.link('libgtest.a', gtest_lib_dir + 'libgtest.a') os.link('libgtest_main.a', gtest_lib_dir + 'libgtest_main.a') - print 'Create hard links pointing to gtest libraries - DONE' + print('Create hard links pointing to gtest libraries - DONE') elif target_os in ['linux']: if os.path.exists(gtest_dir): if not os.path.exists(gtest_lib_dir): # Run configure on gtest - print 'Configuring google unit test' + print('Configuring google unit test') if env.get('CROSS_COMPILE'): env.Configure(gtest_dir, './configure --disable-shared --host=' + env['CROSS_COMPILE']) else: env.Configure(gtest_dir, './configure --disable-shared') # Run make on gtest - print 'Making google unit test' + print('Making google unit test') gtest_env.Configure(gtest_dir, 'make') env.AppendUnique(LIBPATH = [gtest_lib_dir]) @@ -104,14 +104,14 @@ elif target_os == 'msys_nt': os.mkdir(gtest_dotlib_dir) # Run configure on gtest - print 'Configuring google unit test for compilation' + print('Configuring google unit test for compilation') gtest_env.Configure(gtest_dir, 'cmake -G "Unix Makefiles" .') # Run make on gtest - print 'Making google unit test' + print('Making google unit test') gtest_env.Configure(gtest_dir, 'make') - print 'Moving libraries to lib folder' + print('Moving libraries to lib folder') gtest_env.Configure(gtest_dir, 'cp libgtest.a lib') gtest_env.Configure(gtest_dir, 'mv libgtest.a lib/.libs') gtest_env.Configure(gtest_dir, 'cp libgtest_main.a lib') @@ -120,7 +120,7 @@ elif target_os == 'msys_nt': elif target_os == 'windows': # Avoid building the same StaticLibrary in more than one environment, by using the # IOTIVITY_GTEST_HAS_BEEN_BUILT environment variable - if not env.has_key('IOTIVITY_GTEST_HAS_BEEN_BUILT'): + if 'IOTIVITY_GTEST_HAS_BEEN_BUILT' not in env: gtest_env.Append(CPPPATH = [ gtest_dir ]) gtest = gtest_env.StaticLibrary(target = 'gtest', source = [ '%s/src/gtest-all.cc' % gtest_dir ]) gtest_main = gtest_env.StaticLibrary(target = 'gtest_main', source = [ '%s/src/gtest_main.cc' % gtest_dir ]) diff --git a/extlibs/hippomocks.scons b/extlibs/hippomocks.scons index 5832177..412c6f2 100644 --- a/extlibs/hippomocks.scons +++ b/extlibs/hippomocks.scons @@ -33,7 +33,7 @@ src_dir = env.get('SRC_DIR') # Only verify/install on linux if target_os in ['linux']: - print '*** Checking for installation of hippomocks ***' + print('*** Checking for installation of hippomocks ***') hippomocks_sha = '8e210c5808d490b26fff69151c801fa28d291fcb' hippomocks_dir_src = src_dir + '/extlibs/hippomocks-' + hippomocks_sha @@ -49,9 +49,9 @@ if target_os in ['linux']: hippomocks_zip = hippomocks_zip_file # Unzip hippomocks - print 'Unzipping hippomocks' + print('Unzipping hippomocks') env.UnpackAll(hippomocks_dir_src, hippomocks_zip) - print 'Renaming hippomocks directory' + print('Renaming hippomocks directory') os.rename(hippomocks_dir_src, hippomocks_dir_dest) diff --git a/extlibs/libcoap/SConscript b/extlibs/libcoap/SConscript index 6441a5a..dbcc889 100644 --- a/extlibs/libcoap/SConscript +++ b/extlibs/libcoap/SConscript @@ -51,7 +51,7 @@ libcoap_url = libcoap_repo_url + '/archive/' + libcoap_branch + '.z libcoap_checkout_command = 'git clone ' + libcoap_repo_url + '.git extlibs/libcoap/libcoap --branch ' + libcoap_branch if with_upstream_libcoap == '1': - print '*** Checking for installation of libCoAP ***' + print('*** Checking for installation of libCoAP ***') if not os.path.exists(libcoap_dir): # If the libcoap zip file is not already present, download it if not os.path.exists(libcoap_zip_file): @@ -60,28 +60,28 @@ if with_upstream_libcoap == '1': libcoap_zip = libcoap_zip_file # Unzip libcoap if libcoap_zip and not os.path.exists(os.path.join(libcoap_dir, 'configure')): - print 'Unzipping libCoAP' + print('Unzipping libCoAP') env.UnpackAll(libcoap_dir, libcoap_zip) # Rename libcoap libcoap_unzip_dir = os.path.join(src_dir, 'extlibs', 'libcoap', 'libcoap-' + libcoap_branch) if os.path.exists(os.path.join(libcoap_unzip_dir)): os.rename(libcoap_unzip_dir, libcoap_dir) if not os.path.exists(os.path.join(libcoap_dir, 'README')): - print ''' + print(''' *********************************** Error: **************************************** * Unable to download and unpack libcoap! * * Please download libcoap using the following command: * * * ''' + libcoap_checkout_command + ''' * * -***********************************************************************************''' +***********************************************************************************''') Exit() else: - print ''' + print(''' *********************************** Info: ***************************************** * Using FORKED copy of libCoap located in: * * resource/csdk/connectivity/lib/libcoap-4.1.1 * -***********************************************************************************''' +***********************************************************************************''') ###################################################################### # Build libCoAP diff --git a/extlibs/libstrophe/SConscript b/extlibs/libstrophe/SConscript index 9d20cb2..c8e0b65 100644 --- a/extlibs/libstrophe/SConscript +++ b/extlibs/libstrophe/SConscript @@ -3,7 +3,7 @@ # ###################################################################### import os -import commands +import subprocess Import('env') @@ -31,48 +31,48 @@ if with_ra_ibb: 'cd ' + SRC_NAME + ' && git checkout 527bc0573a52f2af3ecad5b9ef39aeec7b669f77' ]) - print 'Downloading xmpp library ...' + print('Downloading xmpp library ...') if raxmpp_env.Execute(c): - print ''' + print(''' *********************************** Error: *********************************************** * Please download ra_xmpp as following: * $ git clone https://github.com/strophe/libstrophe.git extlibs/libstrophe/libstrophe * $ cd extlibs/libstrophe/libstrophe * $ git checkout 527bc0573a52f2af3ecad5b9ef39aeec7b669f77 ****************************************************************************************** - ''' + ''') Exit(1) else: - print 'Download xmpp library complete' + print('Download xmpp library complete') if not env.GetOption('clean'): - print 'Building with ' + SRC_NAME + print('Building with ' + SRC_NAME) #print 'base_dir', base_dir #print 'target_os', target_os #print 'target_arch', target_arch - foo=commands.getoutput('patch -N -p1 -d libstrophe < strophe-xmpp_conn_is_secured.patch') - print foo + foo=subprocess.getoutput('patch -N -p1 -d libstrophe < strophe-xmpp_conn_is_secured.patch') + print(foo) os.chdir(SRC_NAME) #sconsflags = ' RELEASE=true' if env['RELEASE'] else ' RELEASE=false' if not os.path.exists('configure') : - foo=commands.getoutput('./bootstrap.sh') - print foo + foo=subprocess.getoutput('./bootstrap.sh') + print(foo) if not os.path.exists('config.status') : - foo=commands.getoutput('./configure') - print foo + foo=subprocess.getoutput('./configure') + print(foo) if not os.path.exists('.libs/libstrophe.a') : - foo=commands.getoutput('make libstrophe.la') - print foo + foo=subprocess.getoutput('make libstrophe.la') + print(foo) if not os.path.exists('.libs/libstrophe.a') : - print 'Building with ' + SRC_NAME + ' failed.' + print('Building with ' + SRC_NAME + ' failed.') Exit(2) else: - foo = commands.getoutput('cp .libs/libstrophe.a ' + env.get('BUILD_DIR')) - foo = commands.getoutput('cp .libs/libstrophe.so* ' + env.get('BUILD_DIR')) - print foo + foo = subprocess.getoutput('cp .libs/libstrophe.a ' + env.get('BUILD_DIR')) + foo = subprocess.getoutput('cp .libs/libstrophe.so* ' + env.get('BUILD_DIR')) + print(foo) - print 'Building with ' + SRC_NAME + ' Completely.' + print('Building with ' + SRC_NAME + ' Completely.') env.AppendUnique(CPPPATH = [INC_PATH], RALIBS = LIBSTROPHY_LIBS, RALIBPATH = [LIB_PATH], RARPATH = [LIB_PATH]) env.AppendUnique(LIBS= LIBSTROPHY_LIBS, LIBPATH = [LIB_PATH]) diff --git a/extlibs/mbedtls/SConscript b/extlibs/mbedtls/SConscript index 53f618d..82be141 100644 --- a/extlibs/mbedtls/SConscript +++ b/extlibs/mbedtls/SConscript @@ -35,12 +35,12 @@ start_dir = os.getcwd() mbedtls_revision = 'mbedtls-2.16.2' if not os.path.exists(mbedtls_dir): - print ''' + print(''' *********************************** Error: **************************************** * Please download mbedtls using the following command: * * $ git clone https://github.com/ARMmbed/mbedtls.git extlibs/mbedtls/mbedtls -b %s *********************************************************************************** - ''' % mbedtls_revision + ''' % mbedtls_revision) Exit(1) #cd extlib/mbedtls/mbedtls os.chdir(mbedtls_dir) @@ -68,7 +68,7 @@ if os.path.exists('.git/HEAD'): cmd = 'git checkout development && git reset --hard ' + mbedtls_revision + ' && git apply --whitespace=fix ../ocf.patch' os.system(cmd) else: - print 'mbedtls: Assume ocf.patch (TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256) was applied in %s' % mbedtls_dir + print('mbedtls: Assume ocf.patch (TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256) was applied in %s' % mbedtls_dir) os.chdir(start_dir) @@ -78,7 +78,7 @@ mbedtls_env.AppendUnique(CPPPATH = [mbedtls_dir+'include/']) mbedtls_env.AppendUnique(CFLAGS = ['-fPIC', '-Wall']) asan_build = env.get('WITH_ASAN') -print 'Asan build: {}'.format(asan_build) +print('Asan build: {}'.format(asan_build)) if asan_build: mbedtls_env.AppendUnique(CFLAGS = ['-UMBEDTLS_HAVE_ASM']) diff --git a/extlibs/mbedtls/mbedtls/scripts/abi_check.py b/extlibs/mbedtls/mbedtls/scripts/abi_check.py index 502c7ae..b2b1eb2 100755 --- a/extlibs/mbedtls/mbedtls/scripts/abi_check.py +++ b/extlibs/mbedtls/mbedtls/scripts/abi_check.py @@ -167,7 +167,7 @@ class AbiChecker(object): """Generate the ABI dumps for the specified git revision. The shared libraries must have been built and the module paths present in version.modules.""" - for mbed_module, module_path in version.modules.items(): + for mbed_module, module_path in list(version.modules.items()): output_path = os.path.join( self.report_dir, "{}-{}-{}.dump".format( mbed_module, version.revision, version.version @@ -281,7 +281,7 @@ class AbiChecker(object): if not (self.keep_all_reports or self.brief): os.remove(output_path) for version in [self.old_version, self.new_version]: - for mbed_module, mbed_module_dump in version.abi_dumps.items(): + for mbed_module, mbed_module_dump in list(version.abi_dumps.items()): os.remove(mbed_module_dump) if self.can_remove_report_dir: os.rmdir(self.report_dir) @@ -365,7 +365,7 @@ def run_main(): ) abi_args = parser.parse_args() if os.path.isfile(abi_args.report_dir): - print("Error: {} is not a directory".format(abi_args.report_dir)) + print(("Error: {} is not a directory".format(abi_args.report_dir))) parser.exit() old_version = SimpleNamespace( version="old", diff --git a/extlibs/mbedtls/mbedtls/tests/scripts/check-files.py b/extlibs/mbedtls/mbedtls/tests/scripts/check-files.py index 00fd0ed..d315840 100755 --- a/extlibs/mbedtls/mbedtls/tests/scripts/check-files.py +++ b/extlibs/mbedtls/mbedtls/tests/scripts/check-files.py @@ -48,12 +48,12 @@ class FileIssueTracker(object): raise NotImplementedError def record_issue(self, filepath, line_number): - if filepath not in self.files_with_issues.keys(): + if filepath not in list(self.files_with_issues.keys()): self.files_with_issues[filepath] = [] self.files_with_issues[filepath].append(line_number) def output_file_issues(self, logger): - if self.files_with_issues.values(): + if list(self.files_with_issues.values()): logger.info(self.heading) for filename, lines in sorted(self.files_with_issues.items()): if lines: diff --git a/extlibs/mbedtls/mbedtls/tests/scripts/generate_test_code.py b/extlibs/mbedtls/mbedtls/tests/scripts/generate_test_code.py index 1fff099..f5e81a0 100755 --- a/extlibs/mbedtls/mbedtls/tests/scripts/generate_test_code.py +++ b/extlibs/mbedtls/mbedtls/tests/scripts/generate_test_code.py @@ -223,7 +223,7 @@ class FileWrapper(io.FileIO, object): super(FileWrapper, self).__init__(file_name, 'r') self._line_no = 0 - def next(self): + def __next__(self): """ Python 2 iterator method. This method overrides base class's next method and extends the next method to count the line @@ -238,7 +238,7 @@ class FileWrapper(io.FileIO, object): if hasattr(parent, '__next__'): line = parent.__next__() # Python 3 else: - line = parent.next() # Python 2 # pylint: disable=no-member + line = next(parent) # Python 2 # pylint: disable=no-member if line is not None: self._line_no += 1 # Convert byte array to string with correct encoding and diff --git a/extlibs/mbedtls/mbedtls/tests/scripts/mbedtls_test.py b/extlibs/mbedtls/mbedtls/tests/scripts/mbedtls_test.py index ac2912d..0036bc2 100755 --- a/extlibs/mbedtls/mbedtls/tests/scripts/mbedtls_test.py +++ b/extlibs/mbedtls/mbedtls/tests/scripts/mbedtls_test.py @@ -79,7 +79,7 @@ class TestDataParser(object): split_colon_fn = lambda x: re.sub(r'\\' + split_char, split_char, x) if len(split_char) > 1: raise ValueError('Expected split character. Found string!') - out = map(split_colon_fn, re.split(r'(? ... * ******************************************************************************* -''' +''') Exit(1) # Overwrite suffixes and prefixes @@ -58,12 +58,12 @@ if env['HOST_OS'] == 'win32': ndk_build_cmd += '.cmd' if not os.path.isfile(ndk_build_cmd): - print ''' + print(''' *************************************** Error ********************************* * It seems android ndk path is not set properly, please check if "%s" * is the root directory of android ndk. * ******************************************************************************* -''' % android_ndk +''' % android_ndk) Exit(1) ANDROID_HOME = os.environ.get('ANDROID_HOME') @@ -71,12 +71,12 @@ if ANDROID_HOME is not None: ANDROID_HOME = os.path.abspath(ANDROID_HOME) if ANDROID_HOME is None or not os.path.exists(ANDROID_HOME): - print ''' + print(''' *************************************** Warning ******************************* * Enviornment variable ANDROID_HOME is not set properly. It should be the * * root directory of android sdk. If you'd like build Java code, it's required.* ******************************************************************************* -''' +''') target_arch = env.get('TARGET_ARCH') @@ -96,12 +96,12 @@ else: if tc_ver != '': cmd.append('NDK_TOOLCHAIN_VERSION=' + tc_ver) else: - print ''' + print(''' *************************************** Warning ******************************* * To support C++11, the toolchain should be >= 4.7, please make sure your * * android NDK is at least r8e! * ******************************************************************************* -''' +''') cmd.append('-n') diff --git a/resource/csdk/connectivity/build/arduino/SConscript b/resource/csdk/connectivity/build/arduino/SConscript index d97d596..df062e0 100644 --- a/resource/csdk/connectivity/build/arduino/SConscript +++ b/resource/csdk/connectivity/build/arduino/SConscript @@ -27,7 +27,7 @@ def __parse_config(f): def __get_boards(dict): boards = [] - keys = dict.keys() + keys = list(dict.keys()) for key in keys: idx = key.find('.name') if idx > 0: @@ -37,7 +37,7 @@ def __get_boards(dict): def __get_cpu(dict, board): cpus = [] - keys = dict.keys() + keys = list(dict.keys()) for key in keys: idx = key.find(board + '.menu.cpu.') start = len(board + '.menu.cpu.') @@ -176,14 +176,14 @@ def __upload(env, binary): upload_cmd = arduino_home + '/hardware/tools/avr/bin/avrdude -C' + arduino_home +'/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -p' \ + mcu + ' -c' + protocol + ' -P' + port + ' -b' + speed + ' -D -Uflash:w:' + binary + ':i' - print "Upload command: %s" %upload_cmd + print("Upload command: %s" %upload_cmd) install_cmd = env.Command('install_cmd', None, upload_cmd) env.Default('install_cmd') else: uu = __get_board_info(board, '.upload.native_usb') port = 'ttyACM0' upload_cmd = 'stty -F /dev/' + port + ' speed 1200 cs8 -cstopb -parenb \n' + arduino_home + '/hardware/tools/bossac -i -d --port=' + port + ' -U ' + uu + ' -e -w -v -b ' + binary + ' -R' - print "Upload command: %s" %upload_cmd + print("Upload command: %s" %upload_cmd) install_cmd = env.Command('install_cmd', None, upload_cmd) env.Default('install_cmd') @@ -218,13 +218,13 @@ Help(help_vars.GenerateHelpText(env)) target_arch = env.get('TARGET_ARCH') arduino_home = env.get('ARDUINO_HOME') if not arduino_home: - print ''' + print(''' ************************************* Error *********************************** * Arduino root directory isn't set, you can set enviornment variable * * ARDUINO_HOME or add it in command line as: * * # scons ARDUINO_HOME= ... * ******************************************************************************* -''' +''') Exit(1) # Overwrite suffixes and prefixes @@ -257,12 +257,12 @@ if os.path.exists(arduino_home + '/lib/version.txt'): vf = open(arduino_home + '/lib/version.txt', 'r') version = vf.readline().replace('.', '') else: - print ''' + print(''' ************************************* Error *********************************** * Can't find version file (lib/version.txt), please check if (%s) * is arduino root directory. * ******************************************************************************* -''' % arduino_home +''' % arduino_home) Exit(1) if version[0:2] == '10': @@ -276,12 +276,12 @@ if version[0:2] == '10': env.Replace(LINK = 'avr-gcc') env.Replace(RANLIB = 'avr-ranlib') if target_arch != 'avr': - print ''' + print(''' ************************************* Error *********************************** * Arduino 1.0.x IDE only support 'avr', to support other arch at least 1.5.x * * is required. ******************************************************************************* -''' +''') Exit(1) else: is_1_0_x = False @@ -292,11 +292,11 @@ else: boards_info = __parse_config(arduino_home + '/hardware/arduino/sam/boards.txt') platform_info = __parse_config(arduino_home + '/hardware/arduino/sam/platform.txt') else: - print ''' + print(''' ************************************* Error *********************************** * CPU arch %s isn't supported currently. ******************************************************************************* -''' % target_arch +''' % target_arch) #Board option, let user to select the board boards = __get_boards(boards_info) diff --git a/resource/csdk/connectivity/build/linux/SConscript b/resource/csdk/connectivity/build/linux/SConscript index 448d606..be4c1d0 100644 --- a/resource/csdk/connectivity/build/linux/SConscript +++ b/resource/csdk/connectivity/build/linux/SConscript @@ -5,7 +5,7 @@ ## Import('env') -print "Reading linux configuration script" +print("Reading linux configuration script") # Set release/debug flags if env.get('RELEASE'): diff --git a/resource/csdk/connectivity/build/tizen/SConscript b/resource/csdk/connectivity/build/tizen/SConscript index 57a4e90..14b830e 100644 --- a/resource/csdk/connectivity/build/tizen/SConscript +++ b/resource/csdk/connectivity/build/tizen/SConscript @@ -14,11 +14,11 @@ secured = env.get('SECURED') logging = env.get('LOGGING') with_tcp = env.get('WITH_TCP') -print "Given Transport is %s" % transport -print "Given OS is %s" % target_os +print("Given Transport is %s" % transport) +print("Given OS is %s" % target_os) if target_os == 'tizen': command = "sh resource/csdk/connectivity/build/tizen/gbsbuild.sh %s %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging, with_tcp) - print "Created Command is %s" % command + print("Created Command is %s" % command) gbs_script = env.Command('gbs_build', None, command) AlwaysBuild ('gbs_script') \ No newline at end of file diff --git a/resource/csdk/connectivity/build/tizen/scons/SConscript b/resource/csdk/connectivity/build/tizen/scons/SConscript index 1042e31..fb63c7e 100644 --- a/resource/csdk/connectivity/build/tizen/scons/SConscript +++ b/resource/csdk/connectivity/build/tizen/scons/SConscript @@ -12,7 +12,7 @@ with_tcp = env.get('WITH_TCP') disable_tcp_server = env.get('DISABLE_TCP_SERVER') disable_ble_server = env.get('DISABLE_BLE_SERVER') -print "Given Transport is %s" % transport +print("Given Transport is %s" % transport) if env.get('RELEASE'): env.AppendUnique(CFLAGS = ['-std=c99', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE']) @@ -28,39 +28,39 @@ if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True': if 'ALL' in transport: env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER', 'NO_ETHERNET_ADAPTER','EDR_ADAPTER','LE_ADAPTER']) - print "CA Transport is ALL" + print("CA Transport is ALL") else: if 'BT' in transport: env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER']) - print "CA Transport is BT" + print("CA Transport is BT") else: env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER']) if 'BLE' in transport: env.AppendUnique(CPPDEFINES = ['LE_ADAPTER']) - print "CA Transport is BLE" + print("CA Transport is BLE") else: env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER']) if 'WIFI' in transport: env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER']) - print "CA Transport is WIFI" + print("CA Transport is WIFI") else: env.AppendUnique(CPPDEFINES = ['NO_WIFI_ADAPTER']) if with_tcp == True: env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER']) - print "CA Transport is TCP" + print("CA Transport is TCP") else: env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER']) if disable_tcp_server == True: env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER']) - print "TCP server is disabled" + print("TCP server is disabled") if disable_ble_server == True: env.AppendUnique(CPPDEFINES = ['DISABLE_BLE_SERVER']) - print "BLE server is disabled" + print("BLE server is disabled") env.SConscript(['../con/lib/libcoap-4.1.1/SConscript']) env.SConscript(['../con/SConscript']) diff --git a/resource/csdk/connectivity/common/SConscript b/resource/csdk/connectivity/common/SConscript index 3cdeef1..2b3a552 100644 --- a/resource/csdk/connectivity/common/SConscript +++ b/resource/csdk/connectivity/common/SConscript @@ -4,7 +4,7 @@ Import('env') -print "Reading common folder script" +print("Reading common folder script") ca_os = env.get('TARGET_OS') src_dir = env.get('SRC_DIR') diff --git a/resource/csdk/connectivity/src/SConscript b/resource/csdk/connectivity/src/SConscript index 12e39e9..ad24c47 100644 --- a/resource/csdk/connectivity/src/SConscript +++ b/resource/csdk/connectivity/src/SConscript @@ -21,7 +21,7 @@ ca_path = os.curdir # Source files and Target(s) ###################################################################### -print"Reading ca script %s"%ca_transport +print("Reading ca script %s"%ca_transport) env.PrependUnique(CPPPATH = [ os.path.join(root_dir, 'api') ]) @@ -110,7 +110,7 @@ if env.get('WITH_PROXY'): if ca_os == 'arduino': env.AppendUnique(CPPDEFINES = ['SINGLE_THREAD']) env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO']) - print "setting WITH_ARDUINO" + print("setting WITH_ARDUINO") ca_common_src = [ 'caconnectivitymanager.c', 'cainterfacecontroller.c', @@ -192,8 +192,8 @@ if ca_os in ['linux', 'tizen', 'android', 'arduino', 'ios']: if (('BLE' in ca_transport) or ('BT' in ca_transport) or ('ALL' in ca_transport)): env.AppendUnique(CPPDEFINES = ['WITH_TCP']) -print "Include path is %s" % env.get('CPPPATH') -print "Files path is %s" % env.get('CA_SRC') +print("Include path is %s" % env.get('CPPPATH')) +print("Files path is %s" % env.get('CA_SRC')) lib_env = env.Clone() lib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) diff --git a/resource/csdk/connectivity/src/bt_edr_adapter/SConscript b/resource/csdk/connectivity/src/bt_edr_adapter/SConscript index e441903..89c606e 100644 --- a/resource/csdk/connectivity/src/bt_edr_adapter/SConscript +++ b/resource/csdk/connectivity/src/bt_edr_adapter/SConscript @@ -5,7 +5,7 @@ Import('env') import os.path -print "Reading BT EDR adapter script" +print("Reading BT EDR adapter script") target_os = env.get('TARGET_OS') diff --git a/resource/csdk/connectivity/src/bt_le_adapter/SConscript b/resource/csdk/connectivity/src/bt_le_adapter/SConscript index ddbfa21..c6473b2 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/SConscript +++ b/resource/csdk/connectivity/src/bt_le_adapter/SConscript @@ -7,7 +7,7 @@ import os.path target_os = env.get('TARGET_OS') -print "Reading BLE adapter script for", target_os +print("Reading BLE adapter script for", target_os) src_dir = os.path.join(os.curdir, 'bt_le_adapter') diff --git a/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript b/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript index e4f2fb1..af37a23 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript +++ b/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript @@ -102,7 +102,7 @@ src_files = [ 'characteristic.c', glue_files = [] -for file, prefix in dbus_introspection_xml.items(): +for file, prefix in list(dbus_introspection_xml.items()): source_xml = file + '.xml' glue = file + '-glue' glue_source = glue + '.c' diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript b/resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript index 7560a78..7b1977c 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript @@ -17,20 +17,20 @@ env.ParseConfig("pkg-config --cflags --libs capi-network-bluetooth") if 'MCD' in division: env.AppendUnique(CPPDEFINES = ['BLE_MCD']) - print "BLE for MCD" + print("BLE for MCD") if tizen55 == 'True': env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_30']) env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_40']) env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_55']) - print "Build using Tizen 5.5 BLE API" + print("Build using Tizen 5.5 BLE API") elif tizen40 == 'True': env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_30']) env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_40']) - print "Build using Tizen 4.0 BLE API" + print("Build using Tizen 4.0 BLE API") elif tizen30 == 'True': env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_30']) - print "Build using Tizen 3.0 BLE API" + print("Build using Tizen 3.0 BLE API") if 'MCD' in division: src_files = [ 'caleclient.c', diff --git a/resource/csdk/connectivity/src/ip_adapter/SConscript b/resource/csdk/connectivity/src/ip_adapter/SConscript index 0864b31..dfa79e3 100644 --- a/resource/csdk/connectivity/src/ip_adapter/SConscript +++ b/resource/csdk/connectivity/src/ip_adapter/SConscript @@ -5,7 +5,7 @@ Import('env') import os.path -print "Reading IP adapter script" +print("Reading IP adapter script") target_os = env.get('TARGET_OS') inc_files = env.get('CPPPATH') diff --git a/resource/csdk/connectivity/src/nfc_adapter/SConscript b/resource/csdk/connectivity/src/nfc_adapter/SConscript index a4b240f..2bd11e2 100644 --- a/resource/csdk/connectivity/src/nfc_adapter/SConscript +++ b/resource/csdk/connectivity/src/nfc_adapter/SConscript @@ -5,7 +5,7 @@ Import('env') import os.path -print "Reading IP adapter script" +print("Reading IP adapter script") target_os = env.get('TARGET_OS') inc_files = env.get('CPPPATH') diff --git a/resource/csdk/connectivity/src/ra_adapter/SConscript b/resource/csdk/connectivity/src/ra_adapter/SConscript index 3cce282..7cae628 100644 --- a/resource/csdk/connectivity/src/ra_adapter/SConscript +++ b/resource/csdk/connectivity/src/ra_adapter/SConscript @@ -21,7 +21,7 @@ Import('env') import os -print "Reading RA adapter script" +print("Reading RA adapter script") target_os = env.get('TARGET_OS') inc_files = env.get('CPPPATH') diff --git a/resource/csdk/connectivity/src/tcp_adapter/SConscript b/resource/csdk/connectivity/src/tcp_adapter/SConscript index cc3f8d3..af89eb8 100755 --- a/resource/csdk/connectivity/src/tcp_adapter/SConscript +++ b/resource/csdk/connectivity/src/tcp_adapter/SConscript @@ -5,7 +5,7 @@ Import('env') import os.path -print "Reading TCP adapter script" +print("Reading TCP adapter script") target_os = env.get('TARGET_OS') inc_files = env.get('CPPPATH') diff --git a/resource/csdk/connectivity/src/tcp_adapter/arduino/SConscript b/resource/csdk/connectivity/src/tcp_adapter/arduino/SConscript index 54fcad7..03721b8 100644 --- a/resource/csdk/connectivity/src/tcp_adapter/arduino/SConscript +++ b/resource/csdk/connectivity/src/tcp_adapter/arduino/SConscript @@ -11,7 +11,7 @@ if env.get('SHIELD') == 'ETH': src_files = [ 'catcpserver_eth.cpp' , 'catcpadapterutils_eth.cpp'] else: - print "\nError: TCP is not supported for WIFI shield" + print("\nError: TCP is not supported for WIFI shield") Exit(1) Return('src_files') diff --git a/resource/csdk/connectivity/util/SConscript b/resource/csdk/connectivity/util/SConscript index d7a121c..138f4de 100644 --- a/resource/csdk/connectivity/util/SConscript +++ b/resource/csdk/connectivity/util/SConscript @@ -5,7 +5,7 @@ Import('env') import os.path -print "Reading util folder script" +print("Reading util folder script") ca_os = env.get('TARGET_OS') ca_transport = env.get('TARGET_TRANSPORT') diff --git a/resource/csdk/logger/SConscript b/resource/csdk/logger/SConscript index 372562e..cae7865 100644 --- a/resource/csdk/logger/SConscript +++ b/resource/csdk/logger/SConscript @@ -40,19 +40,19 @@ else: if log_level == 'DEBUG': env.AppendUnique(CPPDEFINES = ['SET_LOG_DEBUG']) - print "SET_LOG_DEBUG" + print("SET_LOG_DEBUG") if log_level == 'INFO': env.AppendUnique(CPPDEFINES = ['SET_LOG_INFO']) - print "SET_LOG_INFO" + print("SET_LOG_INFO") if log_level == 'ERROR': env.AppendUnique(CPPDEFINES = ['SET_LOG_ERROR']) - print "SET_LOG_ERROR" + print("SET_LOG_ERROR") if log_level == 'WARNING': env.AppendUnique(CPPDEFINES = ['SET_LOG_WARNING']) - print "SET_LOG_WARNING" + print("SET_LOG_WARNING") if log_level == 'FATAL': env.AppendUnique(CPPDEFINES = ['SET_LOG_FATAL']) - print "SET_LOG_FATAL" + print("SET_LOG_FATAL") loggerlib = local_env.StaticLibrary('logger', logger_src) local_env.InstallTarget(loggerlib, 'logger') diff --git a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript index 829ce52..94f4609 100644 --- a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript +++ b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript @@ -53,4 +53,4 @@ if(arduino_simplecs_env['UPLOAD'] == True): if _platform == "linux" or _platform == "linux2": arduino_simplecs_env.Upload(env.get('BUILD_DIR') + '/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SimpleClientServer.hex') else: - print 'Please use appropriate install method for your developing machine. Linux is the only supported platform right now.' + print('Please use appropriate install method for your developing machine. Linux is the only supported platform right now.') diff --git a/resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript b/resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript index a3f9fa7..9a3f5ba 100644 --- a/resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript +++ b/resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript @@ -5,7 +5,7 @@ import os import platform -print "Inside the Config SConscript" +print("Inside the Config SConscript") # Map of host os and allowed target os (host: allowed target os) host_target_map = { 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'], @@ -27,8 +27,8 @@ os_arch_map = { host = platform.system().lower() -if not host_target_map.has_key(host): - print "\nError: Current system (%s) isn't supported\n" % host +if host not in host_target_map: + print("\nError: Current system (%s) isn't supported\n" % host) Exit(1) ###################################################################### @@ -37,7 +37,7 @@ if not host_target_map.has_key(host): target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os if target_os not in host_target_map[host]: - print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]) + print("\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])) Exit(1) default_arch = platform.machine() @@ -109,7 +109,7 @@ if target_os in targets_support_cc: env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root]) if prefix or tc_path: - print tc_set_msg + print(tc_set_msg) # Ensure scons be able to change its working directory env.SConscriptChdir(1) @@ -124,12 +124,12 @@ env.SConscriptChdir(1) def __set_dir(env, dir): if not os.path.exists(dir + '/SConstruct'): - print ''' + print(''' *************************************** Error ********************************* * The directory(%s) seems isn't a source code directory, no SConstruct file is * found. * ******************************************************************************* -''' % dir +''' % dir) Exit(1) if env.get('RELEASE'): @@ -222,7 +222,7 @@ if target_os == "yocto": env[tool] = os.path.join(path, os.environ[tool]) break except: - print "ERROR in Yocto cross-toolchain environment" + print("ERROR in Yocto cross-toolchain environment") Exit(1) ''' Now reset TARGET_OS to linux so that all linux specific build configurations diff --git a/resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript b/resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript index 8fd0e1b..2434d55 100644 --- a/resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript +++ b/resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript @@ -30,7 +30,7 @@ root_dir = env.get('ROOT_DIR') build_dir = env.get('BUILD_DIR') sample_dir = build_dir -print "MQ flag is %s" % with_mq +print("MQ flag is %s" % with_mq) env.AppendUnique(CPPFLAGS = ['-std=c++0x', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE', '-DTB_LOG','`pkg-config', '--cflags', '--libs','dlog', 'com.oic.ri', 'capi-network-connection', 'gobject-2.0','glib-2.0`']) @@ -54,25 +54,25 @@ if secured == '1': if 'ALL' in transport: env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER','BT_ADAPTER_TEST','BLE_ADAPTER_TEST']) - print "CA Transport is ALL" + print("CA Transport is ALL") if env.get('WITH_TCP'): env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP']) else: if 'BT' in transport: env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER','BT_ADAPTER_TEST']) - print "CA Transport is BT" + print("CA Transport is BT") else: env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER']) if 'BLE' in transport: env.AppendUnique(CPPDEFINES = ['LE_ADAPTER','BLE_ADAPTER_TEST']) - print "CA Transport is BLE" + print("CA Transport is BLE") else: env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER']) if 'IP' in transport: env.AppendUnique(CPPDEFINES = ['IP_ADAPTER']) - print "CA Transport is IP" + print("CA Transport is IP") else: env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER']) @@ -83,15 +83,15 @@ else: if 'SUB' in with_mq: env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") #ri_sample_src = [sample_dir + '/occlient.cpp'] diff --git a/resource/csdk/stack/samples/tizen/build/SConscript b/resource/csdk/stack/samples/tizen/build/SConscript index 225d617..46d7d29 100644 --- a/resource/csdk/stack/samples/tizen/build/SConscript +++ b/resource/csdk/stack/samples/tizen/build/SConscript @@ -43,17 +43,17 @@ env.AppendUnique(CPPDEFINES = ['__TIZEN__']) if env.get('WITH_PROXY'): env.AppendUnique(CPPDEFINES = ['WITH_CHPROXY']) -print "Given Transport is %s" % transport -print "Given OS is %s" % target_os -print "Given MQ is %s" % with_mq +print("Given Transport is %s" % transport) +print("Given OS is %s" % target_os) +print("Given MQ is %s" % with_mq) gbs_command_prefix = "" if (('BLE' in transport) or ('ALL' in transport)): - print "Tizen BLE requires tizen 3.0 profile" + print("Tizen BLE requires tizen 3.0 profile") gbs_command_prefix += "gbsprofile=tizen_4_0_unified_armv7l " if target_os == 'tizen': command = gbs_command_prefix + "./resource/csdk/stack/samples/tizen/build/gbsbuild.sh %s %s %s %s %s %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging, routing, with_tcp, with_proxy, with_mq, disable_ble_server) - print "Created Command is %s" % command + print("Created Command is %s" % command) gbs_script = env.Command('gbs_build', None, command) AlwaysBuild ('gbs_script') diff --git a/resource/csdk/stack/samples/tizen/build/scons/SConscript b/resource/csdk/stack/samples/tizen/build/scons/SConscript index 1390ace..61d8fc3 100644 --- a/resource/csdk/stack/samples/tizen/build/scons/SConscript +++ b/resource/csdk/stack/samples/tizen/build/scons/SConscript @@ -11,7 +11,7 @@ transport = env.get('TARGET_TRANSPORT') with_mq = env.get('WITH_MQ') disable_ble_server = env.get('DISABLE_BLE_SERVER') -print "Given Transport is %s" % transport +print("Given Transport is %s" % transport) if env.get('RELEASE'): env.AppendUnique(CFLAGS = ['-std=c99', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE']) @@ -27,29 +27,29 @@ if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True': env.AppendUnique(CPPDEFINES = ['OIC_SUPPORT_TIZEN_TRACE']) if 'ALL' in transport: env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER', 'NO_ETHERNET_ADAPTER','EDR_ADAPTER','LE_ADAPTER']) - print "CA Transport is ALL" + print("CA Transport is ALL") if env.get('DISABLE_BLE_SERVER'): env.AppendUnique(CPPDEFINES = ['DISABLE_BLE_SERVER']) - print "BLE Server Disabled" + print("BLE Server Disabled") else: if 'BT' in transport: env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER']) - print "CA Transport is BT" + print("CA Transport is BT") else: env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER']) if 'BLE' in transport: env.AppendUnique(CPPDEFINES = ['LE_ADAPTER']) - print "CA Transport is BLE" + print("CA Transport is BLE") if env.get('DISABLE_BLE_SERVER'): env.AppendUnique(CPPDEFINES = ['DISABLE_BLE_SERVER']) - print "BLE Server Disabled" + print("BLE Server Disabled") else: env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER']) if 'IP' in transport: env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER']) - print "CA Transport is WIFI" + print("CA Transport is WIFI") else: env.AppendUnique(CPPDEFINES = ['NO_WIFI_ADAPTER']) @@ -63,14 +63,14 @@ else: if 'SUB' in with_mq: env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") env.SConscript(['../resource/SConscript']) diff --git a/resource/examples/SConscript b/resource/examples/SConscript index b2ce91f..45de341 100644 --- a/resource/examples/SConscript +++ b/resource/examples/SConscript @@ -117,7 +117,7 @@ if target_os not in ['windows', 'msys_nt']: if examples_env.get('DISABLE_PRESENCE') == False: example_names += ['presenceserver', 'presenceclient'] -examples = map(make_single_file_cpp_program, example_names) +examples = list(map(make_single_file_cpp_program, example_names)) ###################################################################### # Other examples diff --git a/resource/provisioning/SConscript b/resource/provisioning/SConscript index e3bb396..8f00e24 100644 --- a/resource/provisioning/SConscript +++ b/resource/provisioning/SConscript @@ -65,7 +65,7 @@ if target_os == 'android': if target_os in ['linux', 'tizen']: ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')]) - ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread']) + ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread']) if target_os in ['darwin', 'ios']: ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')]) @@ -85,7 +85,7 @@ if ocprovision_env.get('WITH_TCP') == True: ocprovision_src = ocprovision_src + [ 'src/OCCloudProvisioning.cpp' ] - ocprovision_env.UserInstallTargetHeader('../include/OCCloudProvisioning.hpp', 'resource', 'OCCloudProvisioning.hpp') + ocprovision_env.UserInstallTargetHeader('../include/OCCloudProvisioning.hpp', 'resource', 'OCCloudProvisioning.hpp') if target_os not in ['darwin', 'ios']: ocprovision = ocprovision_env.SharedLibrary('ocprovision', ocprovision_src) diff --git a/resource/provisioning/examples/SConscript b/resource/provisioning/examples/SConscript index 515f049..ef0555c 100644 --- a/resource/provisioning/examples/SConscript +++ b/resource/provisioning/examples/SConscript @@ -61,9 +61,9 @@ examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap']) if with_ra_ibb: examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH']) - print "RALIBS = %s" % examples_env['RALIBS'] - print "RALIBPATH = %s" % examples_env['RALIBPATH'] - print "RARPATH = %s" % examples_env['RARPATH'] + print("RALIBS = %s" % examples_env['RALIBS']) + print("RALIBPATH = %s" % examples_env['RALIBPATH']) + print("RARPATH = %s" % examples_env['RARPATH']) examples_env.AppendUnique(LIBS = 'wksxmppxep') else : if with_ra: diff --git a/resource/provisioning/unittests/SConscript b/resource/provisioning/unittests/SConscript index 3b381ba..3b38768 100644 --- a/resource/provisioning/unittests/SConscript +++ b/resource/provisioning/unittests/SConscript @@ -68,9 +68,9 @@ provisiontests_env.PrependUnique(LIBS = [ if with_ra_ibb: provisiontests_env.AppendUnique(LIBS = provisiontests_env['RALIBS'], LIBPATH = provisiontests_env['RALIBPATH'], RPATH = provisiontests_env['RARPATH']) - print "RALIBS = %s" % provisiontests_env['RALIBS'] - print "RALIBPATH = %s" % provisiontests_env['RALIBPATH'] - print "RARPATH = %s" % provisiontests_env['RARPATH'] + print("RALIBS = %s" % provisiontests_env['RALIBS']) + print("RALIBPATH = %s" % provisiontests_env['RALIBPATH']) + print("RARPATH = %s" % provisiontests_env['RARPATH']) else : if with_ra: provisiontests_env.AppendUnique(LIBS = ['ra_xmpp']) diff --git a/resource/third_party_libs.scons b/resource/third_party_libs.scons index e042a22..06d7c78 100644 --- a/resource/third_party_libs.scons +++ b/resource/third_party_libs.scons @@ -39,12 +39,12 @@ src_dir = env.get('SRC_DIR') if target_os in ['linux']: if not env.GetOption('help'): if not target_arch == platform.machine(): - print ''' + print(''' *********************************** Warning *********************************** * You are trying cross build, please make sure (%s) version libraries are * * installed! * ******************************************************************************* -''' % target_arch +''' % target_arch) conf = Configure(lib_env) conf.Finish() @@ -59,11 +59,11 @@ if target_os == 'android': if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']: if not env.GetOption('help') and not env.GetOption('clean'): - print ''' + print(''' *********************************** Warning *********************************** * current only x86, armeabi, armeabi-v7a libraries are provided! * ******************************************************************************* -''' +''') else: # Too much boost warning, suppress the warning lib_env.AppendUnique(CCFLAGS = ['-w']) diff --git a/service/easy-setup/mediator/richsdk/SConscript b/service/easy-setup/mediator/richsdk/SConscript index 585b1ff..9ead2e3 100755 --- a/service/easy-setup/mediator/richsdk/SConscript +++ b/service/easy-setup/mediator/richsdk/SConscript @@ -43,8 +43,8 @@ if env.get('LOGGING'): ##### The following lines must be uncommented, if target Enrollee is not Arduino target_enrollee = env.get('ES_TARGET_ENROLLEE') if target_enrollee == 'arduino': - print "REMOTE_ARDUINO_ENROLEE flag is defined." - print "The Mediator application will be working only with Arduino Enrollee." + print("REMOTE_ARDUINO_ENROLEE flag is defined.") + print("The Mediator application will be working only with Arduino Enrollee.") env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE']) # Add third party libraries @@ -123,7 +123,7 @@ if not env.get('RELEASE') and target_os not in ['ios']: # Source files and Targets ###################################################################### -print"easysetup_path %s" % easysetup_path +print("easysetup_path %s" % easysetup_path) es_src = None @@ -150,7 +150,7 @@ filenames = [ 'ESException.h', 'ESRichCommon.h', 'EasySetup.hpp', 'RemoteEnrolle for filename in filenames: easy_setup_env.UserInstallTargetHeader('inc/' + filename, "service/easy-setup", filename) -print "Files path is %s" % env.get('es_src') +print("Files path is %s" % env.get('es_src')) ###################################################################### # Generate RichSDK Mediator AAR diff --git a/service/easy-setup/mediator/richsdk/android/SConscript b/service/easy-setup/mediator/richsdk/android/SConscript index 551f4a4..ec8b506 100755 --- a/service/easy-setup/mediator/richsdk/android/SConscript +++ b/service/easy-setup/mediator/richsdk/android/SConscript @@ -34,7 +34,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -59,7 +59,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') #SConscript("../../../../../../android/android_api/SConscript") diff --git a/service/easy-setup/sampleapp/enrollee/arduino/SConscript b/service/easy-setup/sampleapp/enrollee/arduino/SConscript index 57b2d04..694ecc1 100755 --- a/service/easy-setup/sampleapp/enrollee/arduino/SConscript +++ b/service/easy-setup/sampleapp/enrollee/arduino/SConscript @@ -58,4 +58,4 @@ if(enrollee_env['UPLOAD'] == True): if _platform == "linux" or _platform == "linux2": enrollee_env.Upload(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/arduino/enrollee.hex') else: - print 'Please use appropriate install method for your developing machine. Linux is the only supported platform right now.' + print('Please use appropriate install method for your developing machine. Linux is the only supported platform right now.') diff --git a/service/easy-setup/sampleapp/enrollee/linux-samsung/SConscript b/service/easy-setup/sampleapp/enrollee/linux-samsung/SConscript index a1074ae..5ef0865 100755 --- a/service/easy-setup/sampleapp/enrollee/linux-samsung/SConscript +++ b/service/easy-setup/sampleapp/enrollee/linux-samsung/SConscript @@ -23,8 +23,8 @@ Import('env') -print Dir('#').abspath -print Dir('.').abspath +print(Dir('#').abspath) +print(Dir('.').abspath) enrollee_env = env.Clone() transport = enrollee_env.get('TARGET_TRANSPORT') diff --git a/service/easy-setup/sampleapp/enrollee/linux/SConscript b/service/easy-setup/sampleapp/enrollee/linux/SConscript index b680634..d926221 100644 --- a/service/easy-setup/sampleapp/enrollee/linux/SConscript +++ b/service/easy-setup/sampleapp/enrollee/linux/SConscript @@ -23,8 +23,8 @@ Import('env') -print Dir('#').abspath -print Dir('.').abspath +print(Dir('#').abspath) +print(Dir('.').abspath) enrollee_env = env.Clone() transport = enrollee_env.get('TARGET_TRANSPORT') diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript index 75e55b8..4f4796d 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript @@ -25,7 +25,7 @@ import os import platform -print "Inside the Config SConscript" +print("Inside the Config SConscript") # Map of host os and allowed target os (host: allowed target os) host_target_map = { 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'], @@ -47,8 +47,8 @@ os_arch_map = { host = platform.system().lower() -if not host_target_map.has_key(host): - print "\nError: Current system (%s) isn't supported\n" % host +if host not in host_target_map: + print("\nError: Current system (%s) isn't supported\n" % host) Exit(1) ###################################################################### @@ -57,7 +57,7 @@ if not host_target_map.has_key(host): target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os if target_os not in host_target_map[host]: - print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]) + print("\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])) Exit(1) default_arch = platform.machine() @@ -131,7 +131,7 @@ if target_os in targets_support_cc: env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root]) if prefix or tc_path: - print tc_set_msg + print(tc_set_msg) # Ensure scons be able to change its working directory env.SConscriptChdir(1) @@ -146,12 +146,12 @@ env.SConscriptChdir(1) def __set_dir(env, dir): if not os.path.exists(dir + '/SConstruct'): - print ''' + print(''' *************************************** Error ********************************* * The directory(%s) seems isn't a source code directory, no SConstruct file is * found. * ******************************************************************************* -''' % dir +''' % dir) Exit(1) if env.get('RELEASE'): diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript index d73e383..8482fef 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript @@ -30,8 +30,8 @@ es_target_enrollee_map = { host = platform.system().lower() -if not host_target_map.has_key(host): - print "\nError: Current system (%s) isn't supported\n" % host +if host not in host_target_map: + print("\nError: Current system (%s) isn't supported\n" % host) Exit(1) ###################################################################### @@ -40,7 +40,7 @@ if not host_target_map.has_key(host): target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os if target_os not in host_target_map[host]: - print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]) + print("\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])) Exit(1) default_arch = platform.machine() @@ -60,7 +60,7 @@ device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE") es_target_enrollee = ARGUMENTS.get('ES_TARGET_ENROLLEE') if es_target_enrollee not in es_target_enrollee_map: - print "\nError: Unknown ES_TARGET_ENROLLEE: %s (Allow values: %s)\n" % (es_target_enrollee, es_target_enrollee_map) + print("\nError: Unknown ES_TARGET_ENROLLEE: %s (Allow values: %s)\n" % (es_target_enrollee, es_target_enrollee_map)) Exit(1) @@ -143,7 +143,7 @@ if target_os in targets_support_cc: env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root]) if prefix or tc_path: - print tc_set_msg + print(tc_set_msg) # Ensure scons be able to change its working directory env.SConscriptChdir(1) @@ -158,12 +158,12 @@ env.SConscriptChdir(1) def __set_dir(env, dir): if not os.path.exists(dir + '/SConstruct'): - print ''' + print(''' *************************************** Error ********************************* * The directory(%s) seems isn't a source code directory, no SConstruct file is * found. * ******************************************************************************* -''' % dir +''' % dir) Exit(1) if env.get('RELEASE'): diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript index 149f05f..d05fe7e 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript @@ -16,14 +16,14 @@ es_target_enrollee = env.get('ES_TARGET_ENROLLEE') with_tcp = env.get('WITH_TCP') with_cloud = env.get('WITH_CLOUD') -print "Given Transport is %s" % transport -print "Given OS is %s" % target_os -print "Given es_target_enrollee is %s" % es_target_enrollee -print "Given tcp option is %s" % with_tcp -print "Given cloud option is %s" %with_cloud +print("Given Transport is %s" % transport) +print("Given OS is %s" % target_os) +print("Given es_target_enrollee is %s" % es_target_enrollee) +print("Given tcp option is %s" % with_tcp) +print("Given cloud option is %s" %with_cloud) if target_os == 'tizen': command = "sh service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh %s %s %s %s %s %s %s %s" % (transport, secured, routing, release_mode, logging, es_target_enrollee, with_tcp, with_cloud) - print "Created Command is %s" % command + print("Created Command is %s" % command) gbs_script = env.Command('gbs_build', None, command) AlwaysBuild ('gbs_script') \ No newline at end of file diff --git a/service/easy-setup/sampleapp/mediator/android-samsung/SConscript b/service/easy-setup/sampleapp/mediator/android-samsung/SConscript index 8009816..ae85dc0 100644 --- a/service/easy-setup/sampleapp/mediator/android-samsung/SConscript +++ b/service/easy-setup/sampleapp/mediator/android-samsung/SConscript @@ -34,7 +34,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -59,7 +59,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') #SConscript("../../../../../../android/android_api/SConscript") diff --git a/service/easy-setup/sampleapp/mediator/android/SConscript b/service/easy-setup/sampleapp/mediator/android/SConscript index 021902c..046c8f7 100644 --- a/service/easy-setup/sampleapp/mediator/android/SConscript +++ b/service/easy-setup/sampleapp/mediator/android/SConscript @@ -34,7 +34,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -59,7 +59,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') #SConscript("../../../../../../android/android_api/SConscript") diff --git a/service/notification/SConscript b/service/notification/SConscript index cd7f017..c3fd786 100755 --- a/service/notification/SConscript +++ b/service/notification/SConscript @@ -93,15 +93,15 @@ if env.get('SECURED') == '1': with_mq = env.get('WITH_MQ') if 'SUB' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") ###################################################################### diff --git a/service/notification/android/SConscript b/service/notification/android/SConscript index 09f14ff..5def5aa 100755 --- a/service/notification/android/SConscript +++ b/service/notification/android/SConscript @@ -14,7 +14,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -39,7 +39,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') diff --git a/service/notification/cpp-wrapper/consumer/SConscript b/service/notification/cpp-wrapper/consumer/SConscript index f72933e..ae4a1f8 100755 --- a/service/notification/cpp-wrapper/consumer/SConscript +++ b/service/notification/cpp-wrapper/consumer/SConscript @@ -80,15 +80,15 @@ if env.get('WITH_CLOUD') == True: with_mq = env.get('WITH_MQ') if 'SUB' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") ###################################################################### # Source files and Targets for Consumer ###################################################################### diff --git a/service/notification/cpp-wrapper/examples/linux/SConscript b/service/notification/cpp-wrapper/examples/linux/SConscript index 21d6d8e..8099c35 100755 --- a/service/notification/cpp-wrapper/examples/linux/SConscript +++ b/service/notification/cpp-wrapper/examples/linux/SConscript @@ -73,15 +73,15 @@ if env.get('WITH_CLOUD') == True: with_mq = env.get('WITH_MQ') if 'SUB' in with_mq: notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") if env.get('WITH_TCP') == True: notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_TCP']) diff --git a/service/notification/cpp-wrapper/provider/SConscript b/service/notification/cpp-wrapper/provider/SConscript index 742cceb..ef28cfc 100755 --- a/service/notification/cpp-wrapper/provider/SConscript +++ b/service/notification/cpp-wrapper/provider/SConscript @@ -81,15 +81,15 @@ if env.get('WITH_CLOUD') == True: with_mq = env.get('WITH_MQ') if 'SUB' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") ###################################################################### # Source files and Targets for Provider ###################################################################### diff --git a/service/notification/examples/android/NotiConsumerExample/SConscript b/service/notification/examples/android/NotiConsumerExample/SConscript index 4d7890c..e0e4e14 100644 --- a/service/notification/examples/android/NotiConsumerExample/SConscript +++ b/service/notification/examples/android/NotiConsumerExample/SConscript @@ -34,7 +34,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -59,7 +59,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') def ensure_libs(target, source, env): diff --git a/service/notification/examples/android/NotiProviderExample/SConscript b/service/notification/examples/android/NotiProviderExample/SConscript index fa506be..a9b3639 100644 --- a/service/notification/examples/android/NotiProviderExample/SConscript +++ b/service/notification/examples/android/NotiProviderExample/SConscript @@ -34,7 +34,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -59,7 +59,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') def ensure_libs(target, source, env): diff --git a/service/notification/examples/linux/SConscript b/service/notification/examples/linux/SConscript index 4bc3eea..b505028 100644 --- a/service/notification/examples/linux/SConscript +++ b/service/notification/examples/linux/SConscript @@ -69,15 +69,15 @@ if env.get('SECURED') == '1': with_mq = env.get('WITH_MQ') if 'SUB' in with_mq: notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ']) - print "MQ SUB support" + print("MQ SUB support") if 'PUB' in with_mq: notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ']) - print "MQ PUB support" + print("MQ PUB support") if 'BROKER' in with_mq: notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ']) - print "MQ Broker support" + print("MQ Broker support") #################################################################### # Source files and Targets diff --git a/service/resource-container/SConscript b/service/resource-container/SConscript index a5d80ff..1251252 100644 --- a/service/resource-container/SConscript +++ b/service/resource-container/SConscript @@ -29,9 +29,7 @@ containerJavaSupport = ARGUMENTS.get('containerJavaSupport',0) def filtered_glob(env, pattern, omit=[], ondisk=True, source=False, strings=False): - return filter( - lambda f: os.path.basename(f.path) not in omit, - env.Glob(pattern)) + return [f for f in env.Glob(pattern) if os.path.basename(f.path) not in omit] env.AddMethod(filtered_glob, "FilteredGlob"); @@ -47,11 +45,11 @@ target_os = env.get('TARGET_OS') if int(containerJavaSupport): try: - print 'Java Home: ', os.environ['JAVA_HOME'] - print 'Java Lib: ', os.environ['JAVA_LIB'] + print('Java Home: ', os.environ['JAVA_HOME']) + print('Java Lib: ', os.environ['JAVA_LIB']) resource_container_env.Append(CPPDEFINES={'JAVA_SUPPORT':1}) except KeyError: - print ''' + print(''' *********************************** Error ************************************* * Building resource container without Java support. JAVA_HOME or JAVA_LIB are not set properly * Please configure JAVA_HOME to point to your Java 7 JDK and @@ -59,7 +57,7 @@ if int(containerJavaSupport): * Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 * export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server ******************************************************************************* - ''' + ''') resource_container_env.Append(CPPDEFINES={'JAVA_SUPPORT':0}) @@ -80,7 +78,7 @@ if int(containerJavaSupport): os.environ['JAVA_HOME']+'/include/linux' ]) except KeyError: - print '' + print('') if target_os not in ['windows']: @@ -98,7 +96,7 @@ if target_os == 'android': try: resource_container_env.AppendUnique(LIBPATH = [os.environ['JAVA_LIB']]) except KeyError: - print '' + print('') resource_container_env.PrependUnique(LIBS = ['coap']) resource_container_env.AppendUnique(LIBS = ['connectivity_abstraction']) @@ -119,10 +117,10 @@ if resource_container_env.get('SECURED') == '1': if int(containerJavaSupport): try: - print 'Java Lib: ', os.environ['JAVA_LIB'] + print('Java Lib: ', os.environ['JAVA_LIB']) resource_container_env.AppendUnique(LIBS = ['jvm']) except KeyError: - print '' + print('') ###################################################################### # Source files and Targets @@ -193,7 +191,7 @@ if target_os in ['linux', 'tizen', 'android']: conf2 = Configure(lib_env) if not conf2.CheckLib('curl'): - print '''X + print('''X *********************************** Error ************************************* * Cannot build hue sample. Please install libcurl. * Example (Ubuntu): @@ -202,7 +200,7 @@ if not conf2.CheckLib('curl'): * Hint: check with pkg-config --libs libcurl and clear scons cache. * Skipping hue sample build. ******************************************************************************* - ''' + ''') else: hue_resource_bundle_env = resource_container_env.Clone() hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) diff --git a/service/resource-container/android/SConscript b/service/resource-container/android/SConscript index ee9f351..fd1851d 100644 --- a/service/resource-container/android/SConscript +++ b/service/resource-container/android/SConscript @@ -14,7 +14,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -39,7 +39,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') def ensure_libs(target, source, env): diff --git a/service/resource-container/unittests/SConscript b/service/resource-container/unittests/SConscript index 60d4680..6b19ce4 100644 --- a/service/resource-container/unittests/SConscript +++ b/service/resource-container/unittests/SConscript @@ -35,9 +35,7 @@ containerJavaSupport = ARGUMENTS.get('containerJavaSupport',0) def filtered_glob(env, pattern, omit=[], ondisk=True, source=False, strings=False): - return filter( - lambda f: os.path.basename(f.path) not in omit, - lib_env.Glob(pattern)) + return [f for f in lib_env.Glob(pattern) if os.path.basename(f.path) not in omit] lib_env.AddMethod(filtered_glob, "FilteredGlob"); @@ -57,11 +55,11 @@ container_gtest_env = lib_env.Clone() if int(containerJavaSupport): try: - print 'Java Home: ', os.environ['JAVA_HOME'] - print 'Java Lib: ', os.environ['JAVA_LIB'] + print('Java Home: ', os.environ['JAVA_HOME']) + print('Java Lib: ', os.environ['JAVA_LIB']) container_gtest_env.Append(CPPDEFINES={'JAVA_SUPPORT_TEST':1}) except KeyError: - print ''' + print(''' *********************************** Error ************************************* * Building resource container without Java support. JAVA_HOME or JAVA_LIB are not set properly * Please configure JAVA_HOME to point to your Java 7 JDK and @@ -69,7 +67,7 @@ if int(containerJavaSupport): * Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 * export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server/ ******************************************************************************* - ''' + ''') container_gtest_env.Append(CPPDEFINES={'JAVA_SUPPORT_TEST':0}) @@ -99,7 +97,7 @@ if int(containerJavaSupport): os.environ['JAVA_HOME']+'/include/linux' ]) except KeyError: - print '' + print('') if target_os not in ['windows']: container_gtest_env.AppendUnique(LIBS = ['dl']) @@ -119,7 +117,7 @@ if int(containerJavaSupport): try: container_gtest_env.AppendUnique(LIBPATH = [os.environ['JAVA_LIB']]) except KeyError: - print '' + print('') container_gtest_env.PrependUnique(LIBS = ['rcs_container', 'rcs_client', 'rcs_server', 'rcs_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', @@ -127,10 +125,10 @@ container_gtest_env.PrependUnique(LIBS = ['rcs_container', 'rcs_client', 'rcs_se if int(containerJavaSupport): try: - print 'Java Lib: ', os.environ['JAVA_LIB'] + print('Java Lib: ', os.environ['JAVA_LIB']) container_gtest_env.AppendUnique(LIBS = ['jvm']) except KeyError: - print '' + print('') if container_gtest_env.get('SECURED') == '1': container_gtest_env.AppendUnique(CPPDEFINES = ['SECURED']) diff --git a/service/resource-encapsulation/android/SConscript b/service/resource-encapsulation/android/SConscript index 689eec9..bb68358 100644 --- a/service/resource-encapsulation/android/SConscript +++ b/service/resource-encapsulation/android/SConscript @@ -14,7 +14,7 @@ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME') os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK') if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'): - print ''' + print(''' ***************************************** Info ******************************** * Either 'Android API 21' is not installed or 'Android SDK Build Tools * * 20.0.0' is not installed. The Android SDK Manager will now open. Please * @@ -39,7 +39,7 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi ******************************************************************************* ...Opening Android SDK Manager now. Once you are finished, the build will continue. -''' +''') os.system(android_home + '/tools/android') diff --git a/service/simulator/SConscript b/service/simulator/SConscript index 8a03a54..b85096b 100755 --- a/service/simulator/SConscript +++ b/service/simulator/SConscript @@ -54,12 +54,12 @@ simulator_env.AppendUnique(CPPPATH = [ try: os.environ['JAVA_HOME'] except KeyError: - print ''' + print(''' *************************************** Error ********************************* * JAVA_HOME environment variable not set * Simulator has dependency on java, Please set environment variable JAVA_HOME ******************************************************************************* - ''' + ''') sys.exit(1) java_headers = [os.path.join(os.environ['JAVA_HOME'], 'include')] diff --git a/service/third_party_libs.scons b/service/third_party_libs.scons index f5d709f..2e347c9 100644 --- a/service/third_party_libs.scons +++ b/service/third_party_libs.scons @@ -40,21 +40,21 @@ resource_path = src_dir + '/resource' if target_os in ['linux']: if not env.GetOption('help'): if not target_arch == platform.machine(): - print ''' + print(''' *********************************** Warning *********************************** * You are trying cross build, please make sure (%s) version libraries are * installed! * ******************************************************************************* -''' % target_arch +''' % target_arch) conf = Configure(lib_env) if target_os not in ['tizen'] and not conf.CheckLib('boost_thread', language='C++'): - print 'Did not find boost_thread, exiting!' + print('Did not find boost_thread, exiting!') Exit(1) if target_os not in ['tizen'] and not conf.CheckLib('boost_system', language='C++'): - print 'Did not find boost_system, exiting!' + print('Did not find boost_system, exiting!') Exit(1) lib_env = conf.Finish() @@ -80,11 +80,11 @@ if target_os == 'android': if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']: if not env.GetOption('help') and not env.GetOption('clean'): - print ''' + print(''' *********************************** Warning *********************************** * current only x86, armeabi, armeabi-v7a libraries are provided! * ******************************************************************************* -''' +''') else: # Too much boost warning, suppress the warning lib_env.AppendUnique(CCFLAGS = ['-w']) diff --git a/tools/scons/BoostBootstrap.py b/tools/scons/BoostBootstrap.py index 54cac6b..a28674b 100644 --- a/tools/scons/BoostBootstrap.py +++ b/tools/scons/BoostBootstrap.py @@ -32,7 +32,7 @@ import SCons.Builder, SCons.Node, SCons.Errors # @param source source name # @param env environment object def __message( s, target, source, env ) : - print 'bootstrapping using [%s] ...' % (source[0]) + print('bootstrapping using [%s] ...' % (source[0])) # Create the builder action which executes the bootstrap script @@ -64,7 +64,7 @@ def __action( target, source, env ) : devnull = open(os.devnull, 'wb') handle = subprocess.Popen( cmd, shell=True, cwd=cwd, stdout=devnull ) - if handle.wait() <> 0 : + if handle.wait() != 0 : raise SCons.Errors.BuildError( 'Bootstrapping script [%s] on the source [%s]' % (cmd, source[0]) ) # Define the emitter of the builder diff --git a/tools/scons/BoostBuild.py b/tools/scons/BoostBuild.py index b0d53e0..749d418 100644 --- a/tools/scons/BoostBuild.py +++ b/tools/scons/BoostBuild.py @@ -35,7 +35,7 @@ import SCons.Builder, SCons.Node, SCons.Errors # @param source source name # @param env environment object def __message( s, target, source, env ) : - print "building boost from [%s] for ..." % (source[0]) + print("building boost from [%s] for ..." % (source[0])) # Create the builder action which constructs a user-config.jam based @@ -132,7 +132,7 @@ def __action( target, source, env ) : devnull = open(os.devnull, "wb") handle = subprocess.Popen( cmd, env=penv, cwd=cwd ) #, stdout=devnull ) - if handle.wait() <> 0 : + if handle.wait() != 0 : raise SCons.Errors.BuildError( "Building boost [%s] on the source [%s]" % (cmd, source[0]) ) # Define the emitter of the builder diff --git a/tools/scons/Configure.py b/tools/scons/Configure.py index 94db96b..f41cdab 100644 --- a/tools/scons/Configure.py +++ b/tools/scons/Configure.py @@ -32,7 +32,7 @@ import SCons.Builder, SCons.Node, SCons.Errors # @param source source name # @param env environment object def __message( s, target, source, env ) : - print "Configuring using [%s] ..." % (source[0]) + print("Configuring using [%s] ..." % (source[0])) # Create the action # @@ -63,7 +63,7 @@ def __action( target, source, env ) : devnull = open(os.devnull, "wb") handle = subprocess.Popen( cmd, shell=True, cwd=cwd, stdout=devnull ) - if handle.wait() <> 0 : + if handle.wait() != 0 : raise SCons.Errors.BuildError( "Configuring script [%s] on the source [%s]" % (cmd, source[0]) ) # Define the builder's emitter diff --git a/tools/scons/URLDownload.py b/tools/scons/URLDownload.py index f824140..56b026d 100644 --- a/tools/scons/URLDownload.py +++ b/tools/scons/URLDownload.py @@ -66,7 +66,7 @@ # default setting replaces the target name with the URL filename) -import urllib2, urlparse +import urllib.request, urllib.error, urllib.parse, urllib.parse import SCons.Builder, SCons.Node, SCons.Errors @@ -84,8 +84,8 @@ class URLNode(SCons.Node.Python.Value) : pass try : - response = urllib2.urlopen( str(self.value) ).info() - except Exception, e : + response = urllib.request.urlopen( str(self.value) ).info() + except Exception as e : raise SCons.Errors.StopError( "%s [%s]" % (e, self.value) ) contents = "" @@ -106,7 +106,7 @@ class URLNode(SCons.Node.Python.Value) : # @param source source name # @param env environment object def __message( s, target, source, env ) : - print "downloading [%s] to [%s] ..." % (source[0], target[0]) + print("downloading [%s] to [%s] ..." % (source[0], target[0])) # the download function, which reads the data from the URL @@ -116,12 +116,12 @@ def __message( s, target, source, env ) : # @@param env environment object def __action( target, source, env ) : try : - stream = urllib2.urlopen( str(source[0]) ) + stream = urllib.request.urlopen( str(source[0]) ) file = open( str(target[0]), "wb" ) file.write(stream.read()) file.close() stream.close() - except Exception, e : + except Exception as e : raise SCons.Errors.StopError( "%s [%s]" % (e, source[0]) ) @@ -138,8 +138,8 @@ def __emitter( target, source, env ) : return target, source try : - url = urlparse.urlparse( urllib2.urlopen( str(source[0]) ).geturl() ) - except Exception, e : + url = urllib.parse.urlparse( urllib.request.urlopen( str(source[0]) ).geturl() ) + except Exception as e : raise SCons.Errors.StopError( "%s [%s]" % (e, source[0]) ) return url.path.split("/")[-1], source diff --git a/tools/scons/UnpackAll.py b/tools/scons/UnpackAll.py index 1b0557a..0941e43 100644 --- a/tools/scons/UnpackAll.py +++ b/tools/scons/UnpackAll.py @@ -156,7 +156,7 @@ def __fileextractor_win_7zip( env, count, no, i ) : def __getExtractor( source, env ) : # we check each unpacker and get the correc list command first, run the command and # replace the target filelist with the list values, we sorte the extractors by their priority - for unpackername, extractor in sorted(env["UNPACK"]["EXTRACTOR"].iteritems(), key = lambda (k,v) : (v["PRIORITY"],k)): + for unpackername, extractor in sorted(iter(env["UNPACK"]["EXTRACTOR"].items()), key = lambda k_v : (k_v[1]["PRIORITY"],k_v[0])): # if the run command not set, we continue the extractor search, otherwise we check the extractor parameters if not SCons.Util.is_String(extractor["RUN"]) : @@ -193,7 +193,7 @@ def __getExtractor( source, env ) : # @param source source name # @param env environment object def __message( s, target, source, env ) : - print "extract [%s] ..." % (source[0]) + print("extract [%s] ..." % (source[0])) # action function for extracting of the data @@ -225,7 +225,7 @@ def __action( target, source, env ) : devnull = open(os.devnull, "wb") handle = subprocess.Popen( cmd, shell=True, stdout=devnull, cwd=cwd) - if handle.wait() <> 0 : + if handle.wait() != 0 : raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source[0]) ) fhandle = open(target_path, 'a') @@ -336,7 +336,7 @@ def generate( env ) : } # read tools for Windows system - if env["PLATFORM"] <> "darwin" and "win" in env["PLATFORM"] : + if env["PLATFORM"] != "darwin" and "win" in env["PLATFORM"] : if env.WhereIs("7z"): toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "7z" -- 2.7.4