Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / build_common / SConscript
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