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
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 *
*******************************************************************************
...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):
clean:
python %s -c
'''
- print (helpstr % (script, script))
+ print((helpstr % (script, script)))
sys.exit()
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:
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 *************")
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)
######################################################################
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':
# 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)
######################################################################
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:
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'):
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
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)
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
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')
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')
def __get_boards(dict):
boards = []
- keys = dict.keys()
+ keys = list(dict.keys())
for key in keys:
idx = key.find('.name')
if idx > 0:
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.')
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')
# 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':
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':
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
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)
##
import os
import platform
-import commands
+import subprocess
from distutils.version import StrictVersion
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=[]
#
##
import os, subprocess
-import urllib2, urlparse
+import urllib.request, urllib.error, urllib.parse, urllib.parse
import SCons.Errors
Import('env')
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'
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
# 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
# limitations under the License.
# ------------------------------------------------------------------------
-from configuration import Configuration
+from .configuration import Configuration
# Default (very simple) compiler configuration
class DefaultConfiguration(Configuration):
# 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
# limitations under the License.
# ------------------------------------------------------------------------
-from configuration import Configuration
+from .configuration import Configuration
# GCC compiler-specific configuration
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 """
##
Import('env')
-print "Reading linux configuration script"
+print("Reading linux configuration script")
# Set release/debug flags
if env.get('RELEASE'):
Import('env')
-print "Reading linux configuration script"
+print("Reading linux configuration script")
# Set release/debug flags
if env.get('RELEASE'):
Import('env')
-print "Reading tizenrt configuration script"
+print("Reading tizenrt configuration script")
host = platform.system().lower()
# 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')
# 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'])
env.AppendUnique(CPPPATH = [ dep_src_dir1, dep_src_dir2 ])
env.AppendUnique(LIBPATH = [ dep_lib_dir ])
-print env.get('CPPPATH')
+print(env.get('CPPPATH'))
# enables Scons warning for this builder
-class UnpackWarning(SCons.Warnings.Warning) :
+class UnpackWarning(SCons.Warnings.SConsWarning) :
pass
SCons.Warnings.enableWarningClass(UnpackWarning)
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"]) :
# @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
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]) )
# 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"] :
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
# 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,
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
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
}
# 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"
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
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);
target_os = env.get('TARGET_OS')
host_os = sys.platform
-print host_os
+print(host_os)
SConscript('../../../build_common/external_libs.scons')
######################################################################
# Build flags
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: *
*******************************************************************************
-'''
+''')
##
import os, subprocess, struct
-import urllib2, urlparse
+import urllib.request, urllib.error, urllib.parse, urllib.parse
import SCons.Errors
import shutil
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'
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)
# Set the ANDROID_HOME
env.Replace(ANDROID_HOME = androidlib_dir)
-print 'ANDROID_HOME = ' + env.get('ANDROID_HOME')
+print('ANDROID_HOME = ' + env.get('ANDROID_HOME'))
##
import os, subprocess, struct
-import urllib2, urlparse
+import urllib.request, urllib.error, urllib.parse, urllib.parse
import SCons.Errors
import shutil
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 *
* 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'
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)
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)
# 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'
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)
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 {} \;")
# 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'
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)
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 {} \;")
# 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'))
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']:
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
# 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:
*
* ''' + boost_bootstrap + '''
*
***********************************************************************************
-'''
+''')
Exit(1)
elif target_os in ['android']:
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)
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
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':
# 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])
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')
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 ])
# 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
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)
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):
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
#
######################################################################
import os
-import commands
+import subprocess
Import('env')
'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])
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)
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)
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'])
"""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
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)
)
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",
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:
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
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
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
# pylint: disable=wrong-import-order
try:
# Python 2
- from StringIO import StringIO
+ from io import StringIO
except ImportError:
# Python 3
from io import StringIO
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
parent = super(StringIOWrapper, self)
if getattr(parent, 'next', None):
# Python 2
- line = parent.next()
+ line = next(parent)
else:
# Python 3
line = parent.__next__()
#
######################################################################
import os
-import commands
+import subprocess
Import('env')
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,
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):
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()
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)
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)
#
######################################################################
import os
-import commands
+import subprocess
Import('env')
'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])
-#******************************************************************\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')
src_dir = env.get('SRC_DIR')
pi_path = os.path.join(src_dir, 'plugins')
-print"Reading PI script"
+print("Reading PI script")
######################################################################
# Build flags
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:
Import('env')
-print "Reading top Zigbee Wrapper."
+print("Reading top Zigbee Wrapper.")
env.SConscript(os.path.join('telegesis_wrapper', 'SConscript'))
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
Import('env')
-print "Reading top Telegesis Wrapper."
+print("Reading top Telegesis Wrapper.")
env.SConscript(os.path.join('src', 'SConscript'))
# 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'),
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')
# 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')
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:
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'])
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')
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)
######################################################################
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()
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)
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'):
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
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
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')
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')
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')
def __get_boards(dict):
boards = []
- keys = dict.keys()
+ keys = list(dict.keys())
for key in keys:
idx = key.find('.name')
if idx > 0:
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.')
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')
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
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':
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
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)
##
Import('env')
-print "Reading linux configuration script"
+print("Reading linux configuration script")
# Set release/debug flags
if env.get('RELEASE'):
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
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'])
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'])
Import('env')
-print "Reading common folder script"
+print("Reading common folder script")
ca_os = env.get('TARGET_OS')
src_dir = env.get('SRC_DIR')
# 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') ])
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',
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')])
Import('env')
import os.path
-print "Reading BT EDR adapter script"
+print("Reading BT EDR adapter script")
target_os = env.get('TARGET_OS')
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')
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'
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',
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')
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')
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')
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')
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')
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')
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')
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.')
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'],
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)
######################################################################
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()
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)
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'):
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
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`'])
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'])
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']
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')
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'])
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'])
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'])
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
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')])
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)
'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:
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'])
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()
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'])
##### 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
# Source files and Targets
######################################################################
-print"easysetup_path %s" % easysetup_path
+print("easysetup_path %s" % easysetup_path)
es_src = None
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
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 *
*******************************************************************************
...Opening Android SDK Manager now. Once you are finished, the build will continue.
-'''
+''')
os.system(android_home + '/tools/android')
#SConscript("../../../../../../android/android_api/SConscript")
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.')
Import('env')
-print Dir('#').abspath
-print Dir('.').abspath
+print(Dir('#').abspath)
+print(Dir('.').abspath)
enrollee_env = env.Clone()
transport = enrollee_env.get('TARGET_TRANSPORT')
Import('env')
-print Dir('#').abspath
-print Dir('.').abspath
+print(Dir('#').abspath)
+print(Dir('.').abspath)
enrollee_env = env.Clone()
transport = enrollee_env.get('TARGET_TRANSPORT')
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'],
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)
######################################################################
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()
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)
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'):
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)
######################################################################
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()
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)
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)
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'):
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
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 *
*******************************************************************************
...Opening Android SDK Manager now. Once you are finished, the build will continue.
-'''
+''')
os.system(android_home + '/tools/android')
#SConscript("../../../../../../android/android_api/SConscript")
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 *
*******************************************************************************
...Opening Android SDK Manager now. Once you are finished, the build will continue.
-'''
+''')
os.system(android_home + '/tools/android')
#SConscript("../../../../../../android/android_api/SConscript")
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")
######################################################################
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 *
*******************************************************************************
...Opening Android SDK Manager now. Once you are finished, the build will continue.
-'''
+''')
os.system(android_home + '/tools/android')
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
######################################################################
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'])
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
######################################################################
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 *
*******************************************************************************
...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):
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 *
*******************************************************************************
...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):
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
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");
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
* 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})
os.environ['JAVA_HOME']+'/include/linux'
])
except KeyError:
- print ''
+ print('')
if target_os not in ['windows']:
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'])
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
conf2 = Configure(lib_env)
if not conf2.CheckLib('curl'):
- print '''X
+ print('''X
*********************************** Error *************************************
* Cannot build hue sample. Please install libcurl.
* Example (Ubuntu):
* 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'])
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 *
*******************************************************************************
...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):
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");
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
* 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})
os.environ['JAVA_HOME']+'/include/linux'
])
except KeyError:
- print ''
+ print('')
if target_os not in ['windows']:
container_gtest_env.AppendUnique(LIBS = ['dl'])
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',
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'])
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 *
*******************************************************************************
...Opening Android SDK Manager now. Once you are finished, the build will continue.
-'''
+''')
os.system(android_home + '/tools/android')
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')]
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()
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'])
# @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
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
# @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
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
# @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
#
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
# 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
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 = ""
# @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
# @@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]) )
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
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"]) :
# @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
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')
}
# 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"