Fix build error with scons-4.4.0 version which is based on python3 37/287937/2 accepted/tizen/unified/20230214.171546
authorbiao716.wang <biao716.wang@samsung.com>
Wed, 8 Feb 2023 03:40:36 +0000 (12:40 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Thu, 9 Feb 2023 01:56:11 +0000 (10:56 +0900)
Change-Id: I00b46873cc9131477e999fa07bdd7c54ca833708
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
101 files changed:
android/android_api/SConscript
auto_build.py
build_common/SConscript
build_common/android/SConscript
build_common/arduino/SConscript
build_common/darwin/SConscript
build_common/external_libs.scons
build_common/iotivityconfig/__init__.py
build_common/iotivityconfig/compiler/default_configuration.py
build_common/iotivityconfig/compiler/factory.py
build_common/iotivityconfig/compiler/gcc_configuration.py
build_common/linux/SConscript
build_common/tizen/SConscript
build_common/tizenrt/SConscript
build_common/tools/UnpackAll.py
build_common/windows/SConscript
extlibs/android/gradle/SConscript
extlibs/android/sdk/SConscript
extlibs/arduino/SConscript
extlibs/boost/SConscript
extlibs/gtest/SConscript
extlibs/hippomocks.scons
extlibs/libcoap/SConscript
extlibs/libstrophe/SConscript
extlibs/mbedtls/SConscript
extlibs/mbedtls/mbedtls/scripts/abi_check.py
extlibs/mbedtls/mbedtls/tests/scripts/check-files.py
extlibs/mbedtls/mbedtls/tests/scripts/generate_test_code.py
extlibs/mbedtls/mbedtls/tests/scripts/mbedtls_test.py
extlibs/mbedtls/mbedtls/tests/scripts/test_generate_test_code.py
extlibs/raxmpp/SConscript
extlibs/sqlite3/SConscript
extlibs/tinycbor/SConscript
extlibs/wksxmppxep/SConscript
extlibs/yaml/SConscript
plugins/src/SConscript
plugins/zigbee_wrapper/SConscript
plugins/zigbee_wrapper/src/SConscript
plugins/zigbee_wrapper/telegesis_wrapper/SConscript
plugins/zigbee_wrapper/telegesis_wrapper/src/SConscript
resource/SConscript
resource/c_common/SConscript
resource/csdk/connectivity/SConscript
resource/csdk/connectivity/build/SConscript
resource/csdk/connectivity/build/android/SConscript
resource/csdk/connectivity/build/arduino/SConscript
resource/csdk/connectivity/build/linux/SConscript
resource/csdk/connectivity/build/tizen/SConscript
resource/csdk/connectivity/build/tizen/scons/SConscript
resource/csdk/connectivity/common/SConscript
resource/csdk/connectivity/src/SConscript
resource/csdk/connectivity/src/bt_edr_adapter/SConscript
resource/csdk/connectivity/src/bt_le_adapter/SConscript
resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript
resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript
resource/csdk/connectivity/src/ip_adapter/SConscript
resource/csdk/connectivity/src/nfc_adapter/SConscript
resource/csdk/connectivity/src/ra_adapter/SConscript
resource/csdk/connectivity/src/tcp_adapter/SConscript
resource/csdk/connectivity/src/tcp_adapter/arduino/SConscript
resource/csdk/connectivity/util/SConscript
resource/csdk/logger/SConscript
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript
resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript
resource/csdk/stack/samples/tizen/build/SConscript
resource/csdk/stack/samples/tizen/build/scons/SConscript
resource/examples/SConscript
resource/provisioning/SConscript
resource/provisioning/examples/SConscript
resource/provisioning/unittests/SConscript
resource/third_party_libs.scons
service/easy-setup/mediator/richsdk/SConscript
service/easy-setup/mediator/richsdk/android/SConscript
service/easy-setup/sampleapp/enrollee/arduino/SConscript
service/easy-setup/sampleapp/enrollee/linux-samsung/SConscript
service/easy-setup/sampleapp/enrollee/linux/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript
service/easy-setup/sampleapp/mediator/android-samsung/SConscript
service/easy-setup/sampleapp/mediator/android/SConscript
service/notification/SConscript
service/notification/android/SConscript
service/notification/cpp-wrapper/consumer/SConscript
service/notification/cpp-wrapper/examples/linux/SConscript
service/notification/cpp-wrapper/provider/SConscript
service/notification/examples/android/NotiConsumerExample/SConscript
service/notification/examples/android/NotiProviderExample/SConscript
service/notification/examples/linux/SConscript
service/resource-container/SConscript
service/resource-container/android/SConscript
service/resource-container/unittests/SConscript
service/resource-encapsulation/android/SConscript
service/simulator/SConscript
service/third_party_libs.scons
tools/scons/BoostBootstrap.py
tools/scons/BoostBuild.py
tools/scons/Configure.py
tools/scons/URLDownload.py
tools/scons/UnpackAll.py

index 7e79144..dd5b3a3 100644 (file)
@@ -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):
index d40bf2f..2fa72a7 100644 (file)
@@ -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 *************")
index 4bed93b..ea739b2 100755 (executable)
@@ -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
index 2de28b1..46f08d7 100644 (file)
@@ -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=<path to 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=<path to 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= <path to Android SDK>                             *
 *******************************************************************************
-'''
+''')
 
 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')
 
index 5dffa92..dea95b9 100644 (file)
@@ -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)
index 06fdac6..ca35673 100644 (file)
@@ -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=[]
index 85550d0..b9c6947 100644 (file)
@@ -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 <src_dir>/deps/<target_os>/include
index 3a2ef6a..5a276ca 100644 (file)
@@ -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
index ed90f40..76f000d 100644 (file)
@@ -14,7 +14,7 @@
 # limitations under the License.
 # ------------------------------------------------------------------------
 
-from configuration import Configuration
+from .configuration import Configuration
 
 # Default (very simple) compiler configuration
 class DefaultConfiguration(Configuration):
index 7b0bee7..975a081 100644 (file)
@@ -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
index fbc8f38..436caeb 100644 (file)
@@ -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 """
index 137fad0..dbd881c 100644 (file)
@@ -5,7 +5,7 @@
 ##
 Import('env')
 
-print "Reading linux configuration script"
+print("Reading linux configuration script")
 
 # Set release/debug flags
 if env.get('RELEASE'):
index 69bf224..824ab15 100644 (file)
@@ -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'):
index 6325807..f3a8db6 100644 (file)
@@ -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= <path to tizenrt os directory>                  *
 *******************************************************************************
-'''
+''')
 
 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'))
index 85e1689..9788992 100644 (file)
@@ -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
index 48eee71..1718d67 100644 (file)
@@ -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);
 
index 9cece4b..de33da2 100644 (file)
@@ -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:                    *
 *******************************************************************************
-'''
+''')
 
index 7b7b1ba..4792253 100644 (file)
@@ -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'))
 
 
index 879fe2c..368fe07 100644 (file)
@@ -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=<path to arduino root directory> ...              *
         *******************************************************************************
-        '''
+        ''')
                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'))
index cae1be1..729fbfc 100644 (file)
@@ -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']:
index df306f4..30102ea 100644 (file)
@@ -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 ])
index 5832177..412c6f2 100644 (file)
@@ -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)
 
 
index 6441a5a..dbcc889 100644 (file)
@@ -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
index 9d20cb2..c8e0b65 100644 (file)
@@ -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])
 
index 53f618d..82be141 100644 (file)
@@ -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'])
 
index 502c7ae..b2b1eb2 100755 (executable)
@@ -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",
index 00fd0ed..d315840 100755 (executable)
@@ -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:
index 1fff099..f5e81a0 100755 (executable)
@@ -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
index ac2912d..0036bc2 100755 (executable)
@@ -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'(?<!\\)' + split_char, inp_str))
+        out = list(map(split_colon_fn, re.split(r'(?<!\\)' + split_char, inp_str)))
         out = [x for x in out if x]
         return out
 
index 6d7113e..73b9650 100755 (executable)
@@ -25,7 +25,7 @@ Unit tests for generate_test_code.py
 # pylint: disable=wrong-import-order
 try:
     # Python 2
-    from StringIO import StringIO
+    from io import StringIO
 except ImportError:
     # Python 3
     from io import StringIO
@@ -310,7 +310,7 @@ class StringIOWrapper(StringIO, object):
         self.line_no = line_no
         self.name = file_name
 
-    def next(self):
+    def __next__(self):
         """
         Iterator method. This method overrides base class's
         next method and extends the next method to count the line
@@ -321,7 +321,7 @@ class StringIOWrapper(StringIO, object):
         parent = super(StringIOWrapper, self)
         if getattr(parent, 'next', None):
             # Python 2
-            line = parent.next()
+            line = next(parent)
         else:
             # Python 3
             line = parent.__next__()
index 6db32f5..72caa2b 100644 (file)
@@ -23,7 +23,7 @@
 #
 ######################################################################
 import os
-import commands
+import subprocess
 
 Import('env')
 
@@ -35,26 +35,26 @@ with_ra_ibb = env.get('WITH_RA_IBB')
 if with_ra and not with_ra_ibb :
        # check 'raxmppl' library, if it doesn't exits, ask user to download it
        if not os.path.exists('raxmpp'):
-               print '''
+               print('''
        *********************************** Error: ***********************************************
        * Please download ra_xmpp as following :
        *     $ git clone https://gerrit.iotivity.org/gerrit/iotivity-xmpp extlibs/raxmpp/raxmpp
        ******************************************************************************************
-       '''
+       ''')
                Exit(1)
 
-       print 'building with ra_xmpp'
+       print('building with ra_xmpp')
        if env.get('RELEASE'):
-               print src_dir
+               print(src_dir)
                build_dir = os.path.join(src_dir, 'extlibs/raxmpp/raxmpp/out', target_os, target_arch, 'release/')
        else:
                build_dir = os.path.join(src_dir, 'extlibs/raxmpp/raxmpp/out/', target_os, target_arch, 'debug/')
        os.chdir('raxmpp')
        sconsflags = ' RELEASE=true' if  env['RELEASE'] else ' RELEASE=false'
-       foo=commands.getoutput('scons external' + sconsflags )
-       print foo
-       foo=commands.getoutput('scons' + sconsflags )
-       print foo
+       foo=subprocess.getoutput('scons external' + sconsflags )
+       print(foo)
+       foo=subprocess.getoutput('scons' + sconsflags )
+       print(foo)
 
        env.AppendUnique(CPPPATH = src_dir+'/extlibs/raxmpp/raxmpp/ra_xmpp/',
                                LIBPATH=build_dir,
index e718fa5..516c25b 100755 (executable)
@@ -28,7 +28,7 @@ sqlite_c_tmp = os.path.join(sqlite_tmp_dir, 'sqlite3.c')
 sqlite_h_tmp = os.path.join(sqlite_tmp_dir, 'sqlite3.h')
 
 if target_os in targets_need_sqlite:
-    print '*** Checking for presence of %s ***' % sqlite_package
+    print('*** Checking for presence of %s ***' % sqlite_package)
     os.listdir(sqlite_dir)
     if not os.path.exists(sqlite_c) or not os.path.exists(sqlite_h):
         if not os.path.exists(sqlite_zip_file):
index 092a46b..2d8e041 100644 (file)
@@ -30,12 +30,12 @@ cborDir = os.path.join(src_dir, 'extlibs','tinycbor','tinycbor')
 cborRevision = 'v0.4'
 
 if not os.path.exists(cborDir):
-    print '''
+    print(('''
 *********************************** Error: ****************************************
 * Please download cbor using the following command:                               *
 *   $ git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor -b %s *
 ***********************************************************************************
-''' % cborRevision
+''' % cborRevision))
     Exit(1)
 
 start_dir = os.getcwd()
@@ -48,15 +48,15 @@ os.chdir(cborDir)
 if target_os != 'tizen' and os.path.exists('.git/HEAD'):
     out = subprocess.check_output('git tag -l ' + cborRevision, shell = True)
     if cborRevision not in out:
-        print out
-        print '''
+        print(out)
+        print('''
 *********************************** Error: ****************************************
 * Your TinyCBOR repo is not up to date with the latest version we require. Please *
 * update with the following commands:                                             *
 *     $ cd extlibs/tinycbor/tinycbor                                              *
 *     $ git fetch                                                                 *
 ***********************************************************************************
- '''
+ ''')
         Exit(1)
 
 
@@ -65,7 +65,7 @@ if os.path.exists('.git/HEAD'):
     cmd = 'git reset --hard ' + cborRevision
     os.system(cmd)
 else:
-    print 'Assume TinyCBOR is on tag ', cborRevision
+    print(('Assume TinyCBOR is on tag ', cborRevision))
 
 os.chdir(start_dir)
 
index f8e9b2c..b33143a 100644 (file)
@@ -3,7 +3,7 @@
 #
 ######################################################################
 import os
-import commands
+import subprocess
 
 Import('env')
 
@@ -30,37 +30,37 @@ if with_ra_ibb:
                        'cd ' + SRC_NAME + ' && git checkout 8e9f42d02a0f416001065d1cddc1ab07974cef14'
         ])
 
-               print 'Downloading', SRC_NAME ,'library ...'
+               print('Downloading', SRC_NAME ,'library ...')
                if raxmpp_env.Execute(c):
-                       print '''
+                       print('''
        *********************************** Error: ***********************************************
        * Please download ra_xmpp as following:
        *     $ git clone https://github.com/WorksSystems/wksxmpp_chat.git extlibs/wksxmppxep/wksxmpp_chat
        *     $ cd extlibs/wksxmppxep/wksxmpp_chat
        *     $ git checkout 8e9f42d02a0f416001065d1cddc1ab07974cef14
        ******************************************************************************************
-       '''
+       ''')
                        Exit(1)
                else:
-                       print 'Download', SRC_NAME, 'library complete'
+                       print('Download', SRC_NAME, 'library complete')
 
        if not env.GetOption('clean'):
-               print 'Building with ' + SRC_NAME
+               print('Building with ' + SRC_NAME)
                os.chdir(SRC_NAME)
                if not os.path.exists('libwksxmppxep.so') :
                        LIBSTROPHE_BASE=base_dir + '/extlibs/libstrophe/libstrophe'
-                       foo=commands.getoutput('make LIBSTROPHE_BASE=' + LIBSTROPHE_BASE + ' libraries')
-                       print foo
+                       foo=subprocess.getoutput('make LIBSTROPHE_BASE=' + LIBSTROPHE_BASE + ' libraries')
+                       print(foo)
                if not os.path.exists('libwksxmppxep.so') :
-                       print 'Building with ' + SRC_NAME + ' failed.'
+                       print('Building with ' + SRC_NAME + ' failed.')
                        Exit(2)
                else:
-                       foo = commands.getoutput('cp libwksxmppxep.so ' + env.get('BUILD_DIR'))
-                       print foo
-                       foo = commands.getoutput('cp libwksxmppxep.a ' + env.get('BUILD_DIR'))
-                       print foo
+                       foo = subprocess.getoutput('cp libwksxmppxep.so ' + env.get('BUILD_DIR'))
+                       print(foo)
+                       foo = subprocess.getoutput('cp libwksxmppxep.a ' + env.get('BUILD_DIR'))
+                       print(foo)
        
-               print 'Building with ' + SRC_NAME + ' Completely.'
+               print('Building with ' + SRC_NAME + ' Completely.')
 
        env.PrependUnique(CPPPATH = [INC_PATH], RALIBS = WJSXMPPXEP_LIBS, RALIBPATH = [LIB_PATH], RARPATH = [LIB_PATH])
        env.AppendUnique(LIBS = WJSXMPPXEP_LIBS, LIBPATH = [LIB_PATH])
index 4cd8948..710ec53 100755 (executable)
@@ -1,54 +1,54 @@
-#******************************************************************\r
-#\r
-# Copyright 2014 Samsung Electronics All Rights Reserved.\r
-#\r
-#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-#      http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#\r
-#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-import os\r
-Import('env')\r
-\r
-yaml_env = env.Clone()\r
-src_dir = env.get('SRC_DIR')\r
-\r
-yamlDir = os.path.join(src_dir, 'extlibs','yaml','yaml')\r
-\r
-if not os.path.exists(yamlDir):\r
-    print '''\r
-*********************************** Error: ****************************************\r
-* Please download yaml using the following command:                               *\r
-*     $ git clone https://github.com/jbeder/yaml-cpp.git extlibs/yaml/yaml *\r
-***********************************************************************************\r
-'''\r
-    Exit(1)\r
-\r
-######################################################################\r
-# Build flags\r
-######################################################################\r
-yaml_env.AppendUnique(CPPPATH = ['yaml/src' , 'yaml/include'])\r
-yaml_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])\r
-yaml_env.AppendUnique(CPPDEFINES = ['LINUX'])\r
-yaml_env.AppendUnique(LIBS = ['pthread'])\r
-\r
-yaml_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])\r
-\r
-######################################################################\r
-# Source files and Targets\r
-######################################################################\r
-yaml_src = [env.Glob('yaml/src/*.cpp'), env.Glob('yaml/src/contrib/*.cpp')]\r
-yamlsdk = yaml_env.StaticLibrary('YamlParser', yaml_src)\r
-\r
-yaml_env.InstallTarget(yamlsdk, 'libYaml')\r
+#******************************************************************
+#
+# Copyright 2014 Samsung Electronics All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+import os
+Import('env')
+
+yaml_env = env.Clone()
+src_dir = env.get('SRC_DIR')
+
+yamlDir = os.path.join(src_dir, 'extlibs','yaml','yaml')
+
+if not os.path.exists(yamlDir):
+    print('''
+*********************************** Error: ****************************************
+* Please download yaml using the following command:                               *
+*     $ git clone https://github.com/jbeder/yaml-cpp.git extlibs/yaml/yaml *
+***********************************************************************************
+''')
+    Exit(1)
+
+######################################################################
+# Build flags
+######################################################################
+yaml_env.AppendUnique(CPPPATH = ['yaml/src' , 'yaml/include'])
+yaml_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+yaml_env.AppendUnique(CPPDEFINES = ['LINUX'])
+yaml_env.AppendUnique(LIBS = ['pthread'])
+
+yaml_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+
+######################################################################
+# Source files and Targets
+######################################################################
+yaml_src = [env.Glob('yaml/src/*.cpp'), env.Glob('yaml/src/contrib/*.cpp')]
+yamlsdk = yaml_env.StaticLibrary('YamlParser', yaml_src)
+
+yaml_env.InstallTarget(yamlsdk, 'libYaml')
index 1cca407..f6c139c 100644 (file)
@@ -29,7 +29,7 @@ target_os = env.get('TARGET_OS')
 src_dir = env.get('SRC_DIR')
 pi_path = os.path.join(src_dir, 'plugins')
 
-print"Reading PI script"
+print("Reading PI script")
 
 ######################################################################
 # Build flags
@@ -81,8 +81,8 @@ pi_src = [
 
 env.AppendUnique(PI_SRC = pi_src)
 
-print "Include path is %s" % env.get('CPPPATH')
-print "Files path is %s" % env.get('PI_SRC')
+print("Include path is %s" % env.get('CPPPATH'))
+print("Files path is %s" % env.get('PI_SRC'))
 if target_os in ['android', 'tizen']:
        calib = env.SharedLibrary('plugin_interface', env.get('PI_SRC'))
 else:
index 6631faf..1523ad9 100644 (file)
@@ -25,7 +25,7 @@ import os.path
 
 Import('env')
 
-print "Reading top Zigbee Wrapper."
+print("Reading top Zigbee Wrapper.")
 
 env.SConscript(os.path.join('telegesis_wrapper', 'SConscript'))
 
index 0c49c79..73cb101 100644 (file)
@@ -30,7 +30,7 @@ target_os = env.get('TARGET_OS')
 src_dir = env.get('SRC_DIR')
 zw_path = os.path.join(src_dir, 'plugins')
 
-print"Reading Zigbee Wrapper (ZW) script"
+print("Reading Zigbee Wrapper (ZW) script")
 
 ######################################################################
 # Build flags
index 8b9a04d..07b19a0 100644 (file)
@@ -25,7 +25,7 @@ import os.path
 
 Import('env')
 
-print "Reading top Telegesis Wrapper."
+print("Reading top Telegesis Wrapper.")
 
 env.SConscript(os.path.join('src', 'SConscript'))
 
index 077d21f..1fd85d2 100644 (file)
@@ -33,7 +33,7 @@ tw_path = os.path.join(src_dir, 'plugins')
 # Source files and Target(s)
 ######################################################################
 
-print"Reading Telegesis Wrapper (TW) script"
+print("Reading Telegesis Wrapper (TW) script")
 
 env.AppendUnique(CPPPATH = [ os.path.join(tw_path, 'include'),
                              os.path.join(tw_path, 'include', 'internal'),
index 80b72ae..e13666e 100644 (file)
@@ -76,7 +76,7 @@ if target_os in ['linux', 'windows']:
        SConscript('csdk/stack/test/linux/SConscript')
        SConscript('csdk/stack/samples/linux/SimpleClientServer/SConscript')
 
-        if env.get('SECURED') == '1':
+       if env.get('SECURED') == '1':
                # Build secure samples
                SConscript('csdk/stack/samples/linux/secure/SConscript')
 
index 2228cfe..b64e836 100755 (executable)
@@ -127,7 +127,7 @@ config_h_file.close()
 
 # Sanity check to ensure that the above block created the file.
 if not os.path.exists(config_h_file_path):
-       print "Error: iotivity_config.h file not created!"
+       print("Error: iotivity_config.h file not created!")
 
 # iotivity_config.h should be copied to the build dir
 env.UserInstallTargetHeader(config_h_file_path, 'c_common', 'iotivity_config.h')
index d5ebfe2..eade6db 100644 (file)
@@ -14,17 +14,17 @@ disable_ble_server = env.get('DISABLE_BLE_SERVER')
 with_mq = env.get('WITH_MQ')
 ble_custom_adv = env.get('BLE_CUSTOM_ADV')
 
-print "Given Transport is %s" % transport
-print "Given OS is %s" % target_os
-print "BUILD_SAMPLE is %s" % build_sample
-print "MQ flag is %s" % with_mq
+print("Given Transport is %s" % transport)
+print("Given OS is %s" % target_os)
+print("BUILD_SAMPLE is %s" % build_sample)
+print("MQ flag is %s" % with_mq)
 
 targets_disallow_multitransport = ['arduino']
 
 if target_os in targets_disallow_multitransport:
     if ('ALL' in transport) or (len(transport) != 1):
-        print "*** Error invalid option values: TARGET_TRANSPORT"
-        print "%s disallowed until testing can validate use of multiple transports on %s %d" % (transport, target_os, len(transport))
+        print("*** Error invalid option values: TARGET_TRANSPORT")
+        print("%s disallowed until testing can validate use of multiple transports on %s %d" % (transport, target_os, len(transport)))
         Exit(1)
 
 if 'ALL' in transport:
@@ -49,45 +49,45 @@ if 'ALL' in transport:
                env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
        else:
                env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
-       print "CA Transport is ALL"
+       print("CA Transport is ALL")
 else:
        if 'BT' in transport:
                if target_os in ['linux']:
-                       print "CA Transport BT is not supported in Linux"
+                       print("CA Transport BT is not supported in Linux")
                        Exit(1)
                else:
                        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 ble_custom_adv in ['True']:
                        env.AppendUnique(CPPDEFINES = ['BLE_CUSTOM_ADVERTISE'])
-                       print "BLE Custom advertisement supported"
+                       print("BLE Custom advertisement supported")
                else:
-                       print "BLE Custom advertisement not supported"
+                       print("BLE Custom advertisement not supported")
                if disable_ble_server == True:
                        if target_os in ['tizen']:
                                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 = ['IP_ADAPTER'])
-               print "CA Transport is IP"
+               print("CA Transport is IP")
        else:
                env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
 
        if with_tcp == True:
                if target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'tizenrt']:
                        env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
-                       print "CA Transport is TCP"
+                       print("CA Transport is TCP")
                else:
-                       print "CA Transport TCP is not supported "
+                       print("CA Transport TCP is not supported ")
                        Exit(1)
        else:
                env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
@@ -99,23 +99,23 @@ else:
        if 'NFC' in transport:
                if target_os in['android']:
                        env.AppendUnique(CPPDEFINES = ['NFC_ADAPTER'])
-                       print "CA Transport is NFC"
+                       print("CA Transport is NFC")
                else:
-                       print "CA Transport NFC is not supported "
+                       print("CA Transport NFC is not supported ")
                        Exit(1)
        else:
                env.AppendUnique(CPPDEFINES = ['NO_NFC_ADAPTER'])
 
 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('./src/SConscript')
index 946dd49..2cc35d9 100644 (file)
@@ -26,8 +26,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)
 
 ######################################################################
@@ -36,7 +36,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()
@@ -130,7 +130,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)
@@ -145,12 +145,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'):
@@ -252,7 +252,7 @@ if target_os == "yocto":
                         break
         env['CROSS_COMPILE'] = target_prefix[:len(target_prefix) - 1]
     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
index 654e6f3..90551ce 100644 (file)
@@ -14,13 +14,13 @@ Help(help_vars.GenerateHelpText(env))
 
 android_ndk = env.get('ANDROID_NDK')
 if not android_ndk:
-       print '''
+       print('''
 *************************************** Error *********************************
 *    Android NDK path isn't set, you can set enviornment variable ANDROID_NDK *
 * or add it in command line as:                                               *
 *      # scons ANDROID_NDK=<path to android NDK> ...                          *
 *******************************************************************************
-'''
+''')
        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')
 
index d97d596..df062e0 100644 (file)
@@ -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=<path to arduino root directory> ...              *
 *******************************************************************************
-'''
+''')
        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)
index 448d606..be4c1d0 100644 (file)
@@ -5,7 +5,7 @@
 ##
 Import('env')
 
-print "Reading linux configuration script"
+print("Reading linux configuration script")
 
 # Set release/debug flags
 if env.get('RELEASE'):
index 57a4e90..14b830e 100644 (file)
@@ -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
index 1042e31..fb63c7e 100644 (file)
@@ -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'])
index 3cdeef1..2b3a552 100644 (file)
@@ -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')
index 12e39e9..ad24c47 100644 (file)
@@ -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')])
index e441903..89c606e 100644 (file)
@@ -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')
 
index ddbfa21..c6473b2 100644 (file)
@@ -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')
 
index e4f2fb1..af37a23 100644 (file)
@@ -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'
index 7560a78..7b1977c 100644 (file)
@@ -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',
index 0864b31..dfa79e3 100644 (file)
@@ -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')
index a4b240f..2bd11e2 100644 (file)
@@ -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')
index 3cce282..7cae628 100644 (file)
@@ -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')
index cc3f8d3..af89eb8 100755 (executable)
@@ -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')
index 54fcad7..03721b8 100644 (file)
@@ -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')
index d7a121c..138f4de 100644 (file)
@@ -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')
index 372562e..cae7865 100644 (file)
@@ -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')
index 829ce52..94f4609 100644 (file)
@@ -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.')
index a3f9fa7..9a3f5ba 100644 (file)
@@ -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
index 8fd0e1b..2434d55 100644 (file)
@@ -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']
 
index 225d617..46d7d29 100644 (file)
@@ -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')
index 1390ace..61d8fc3 100644 (file)
@@ -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'])
index b2ce91f..45de341 100644 (file)
@@ -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
index e3bb396..8f00e24 100644 (file)
@@ -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)
index 515f049..ef0555c 100644 (file)
@@ -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:
index 3b381ba..3b38768 100644 (file)
@@ -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'])
index e042a22..06d7c78 100644 (file)
@@ -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'])
index 585b1ff..9ead2e3 100755 (executable)
@@ -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
index 551f4a4..ec8b506 100755 (executable)
@@ -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")
index 57b2d04..694ecc1 100755 (executable)
@@ -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.')
index a1074ae..5ef0865 100755 (executable)
@@ -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')
index b680634..d926221 100644 (file)
@@ -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')
index 75e55b8..4f4796d 100644 (file)
@@ -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'):
index d73e383..8482fef 100644 (file)
@@ -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'):
index 149f05f..d05fe7e 100644 (file)
@@ -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
index 8009816..ae85dc0 100644 (file)
@@ -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")
index 021902c..046c8f7 100644 (file)
@@ -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")
index cd7f017..c3fd786 100755 (executable)
@@ -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")
 
 
 ######################################################################
index 09f14ff..5def5aa 100755 (executable)
@@ -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')
 
 
index f72933e..ae4a1f8 100755 (executable)
@@ -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
 ######################################################################
index 21d6d8e..8099c35 100755 (executable)
@@ -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'])
index 742cceb..ef28cfc 100755 (executable)
@@ -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
 ######################################################################
index 4d7890c..e0e4e14 100644 (file)
@@ -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):
index fa506be..a9b3639 100644 (file)
@@ -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):
index 4bc3eea..b505028 100644 (file)
@@ -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
index a5d80ff..1251252 100644 (file)
@@ -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'])
index ee9f351..fd1851d 100644 (file)
@@ -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):
index 60d4680..6b19ce4 100644 (file)
@@ -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'])
index 689eec9..bb68358 100644 (file)
@@ -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')
 
 
index 8a03a54..b85096b 100755 (executable)
@@ -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')]
index f5d709f..2e347c9 100644 (file)
@@ -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'])
index 54cac6b..a28674b 100644 (file)
@@ -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
index b0d53e0..749d418 100644 (file)
@@ -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
index 94db96b..f41cdab 100644 (file)
@@ -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
index f824140..56b026d 100644 (file)
@@ -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
index 1b0557a..0941e43 100644 (file)
@@ -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"