Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / tizen / SimpleClientServer / SConscript
index e20a126..9a3f5ba 100644 (file)
@@ -5,11 +5,11 @@
 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'],
-               'windows': ['windows', 'winrt', 'android', 'arduino', 'tizen'],
+               'windows': ['windows', 'android', 'arduino', 'tizen'],
                'darwin': ['darwin', 'ios', 'android', 'arduino'],
                }
 
@@ -18,7 +18,6 @@ os_arch_map = {
                'linux': ['x86', 'x86_64', 'arm', 'arm64'],
                'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
                'windows': ['x86', 'amd64', 'arm'],
-               'winrt': ['arm'],
                'darwin': ['i386', 'x86_64'],
                'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
                'arduino': ['avr', 'arm'],
@@ -28,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)
 
 ######################################################################
@@ -38,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()
@@ -57,6 +56,11 @@ help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL'
 help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
 help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
 help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
+help_vars.Add(BoolVariable('WITH_PROXY', 'CoAP-HTTP Proxy', False)) # set to 'no', 'false' or 0 for debug
+help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
+help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
+help_vars.Add(BoolVariable('DISABLE_BLE_SERVER', 'Disable BLE server', True))
 
 ######################################################################
 # Platform(build target) specific options: SDK/NDK & toolchain
@@ -105,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)
@@ -120,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'):
@@ -178,6 +182,8 @@ if env.get('ROUTING') == 'GW':
 elif env.get('ROUTING') == 'EP':
        env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
 env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+if env.get('WITH_PROXY'):
+       env.AppendUnique(CPPDEFINES = ['WITH_CHPROXY'])
 
 Export('env')
 
@@ -216,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