Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / service / easy-setup / sampleapp / enrollee / tizen-sdb / EnrolleeSample / build / SConscript
index e9333a7..8482fef 100644 (file)
@@ -24,22 +24,14 @@ os_arch_map = {
                 'yocto': ['i586', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
                }
 
-es_role_map = {
-               'enrollee', 'mediator'
-               }
-
 es_target_enrollee_map = {
                'arduino', 'tizen', 'linux'
                }
 
-es_softap_mode_map = {
-               'ENROLLEE_SOFTAP', 'MEDIATOR_SOFTAP'
-               }
-
 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)
 
 ######################################################################
@@ -48,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()
@@ -64,26 +56,13 @@ require_upload = ARGUMENTS.get('UPLOAD', True)
 # Get the device name
 device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE")
 
-# Get es_role
-es_role = ARGUMENTS.get('ES_ROLE')
-
-if es_role not in es_role_map:
-       print "\nError: Unknown ES_ROLE: %s (Allow values: %s)\n" % (es_role, es_role_map)
-       Exit(1)
-
 # Get es_target_enrollee
 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)
 
-# Get es_soft_mode
-es_soft_mode = ARGUMENTS.get('ES_SOFTAP_MODE')
-
-if es_soft_mode not in es_softap_mode_map:
-       print "\nError: Unknown ES_SOFTAP_MODE: %s (Allow values: %s)\n" % (es_soft_mode, es_softap_mode_map)
-       Exit(1)
 
 ######################################################################
 # Common build options (release, target os, target arch)
@@ -98,15 +77,13 @@ help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0
 help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
 help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
 help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
-
+help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
+help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
 help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
 
 #ES_TARGET_ENROLLEE is for specifying what is our target enrollee (Arduino or rest of platforms which support Multicast)
 help_vars.Add(EnumVariable('ES_TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
-#ES_ROLE is for specifying the role (Enrollee or Mediator) for which scons is being executed
-help_vars.Add(EnumVariable('ES_ROLE', 'Target build mode', 'mediator', allowed_values=('mediator', 'enrollee')))
-#ES_SOFT_MODE is for specifying MODE (Mode 1 : Enrollee with  Soft AP or Mode 2  : Mediator with Soft AP)
-help_vars.Add(EnumVariable('ES_SOFTAP_MODE', 'Target build mode', 'ENROLLEE_SOFTAP', allowed_values=('ENROLLEE_SOFTAP', 'MEDIATOR_SOFTAP')))
 
 AddOption('--prefix',
                   dest='prefix',
@@ -133,7 +110,7 @@ if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compil
                        tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
                        )
 else:
-       env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, ES_ROLE = es_role, ES_TARGET_ENROLLEE = es_target_enrollee, ES_SOFTAP_MODE = es_soft_mode, ESPREFIX = GetOption('prefix'))
+       env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, ES_TARGET_ENROLLEE = es_target_enrollee, ESPREFIX = GetOption('prefix'))
 
 Help(help_vars.GenerateHelpText(env))
 
@@ -166,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)
@@ -181,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'):