Commit e5418f06 authored by Ibrahim Esmat's avatar Ibrahim Esmat

Cherry Pick change to enable building with SCons3

Cherry Pick Mats change from master to enable building with SCons 3.0
in 1.3-rel branch. This change and the change in review
https://gerrit.iotivity.org/gerrit/#/c/22809 will be needed to merge
together.

With these 2 changes merged to 1.3-rel, you can successfully build
IoTivity with SCons 3.0. Which will also allow you to build the
UWP versions of the libraries needed for UWP Apps.

Change in master:
Prepare for scons3: change prints and others

In preparation for scons3, recently released, modify remaining print
statements by surrounding them with parens so they look like function
calls. That takes care of the scons3 syntax requirement.

The remaining instances of the sequence "print FOO; Exit(1)" were
changed to "msg = FOO; Exit(msg)" - this helps with the change by
not even using the print statement, and by giving the message to
the output function, it is sent to the error stream rather than
the output stream.

Calls to dictionary keys() and values() are now wrapped in list(),
on Python 3 these return special objects, not the expected list.
That's harmless to Python 2 usage.

The old exception format "except FooErr, err" is no longer supported;
since the Python 3 format "except FooErr as err" has been available
since Python 2.6, there is no problem switching these.

Some instances of using the commands module in extlibs changes to use
subprocess module. Change is transparent.

A couple of instances of filter(lambda ...)) were changes to
a python list comprehension, this is considered preferred for
Python 3 (change was suggested by a conversion tool)

Note on print() change:

  When running with Python2, the print statement is still used. That
  has a bit of an impact: print(a) is just prints the argument, but
  print(a, b, c) is interpreted as printing a tuple (a, b, c), so we
  could see:

  >>> print "This", "is", "a", "test"
  This is a test
  >>> print("This", "is", "a", "test")
  ('This', 'is', 'a', 'test')

  The second is not pretty.  You can make Python2 code use the function
  instead of the statement:

  >>> from __future__ import print_function
  >>> print("This", "is", "a", "test")
  This is a test

  but that's a pain, so the small number of existing prints which
  used a comma as argument separators were updated to use addition,
  so now we're concatenating a string to produce one arg instead
  of supplying multiple "arguments" that would be misinterpreted
  as a tuple in print().  It's fine to add the import statement
  if it's needed.

Change-Id: Idac00e1389b79ee65da4a2eb6ef3246551b66843
Signed-off-by: default avatarMats Wichmann <mats@linux.com>
Signed-off-by: default avatarIbrahim Esmat <iesmat@microsoft.com>
parent b1a345b2
......@@ -32,7 +32,7 @@ bridging_path = os.path.join(src_dir, 'bridging')
mpmcommon_env = env.Clone()
print "Reading MPM Common Plugin script"
print("Reading MPM Common Plugin script")
def maskFlags(flags):
......
......@@ -31,7 +31,7 @@ bridging_path = os.path.join(src_dir, 'bridging')
manager_env = env.Clone()
print "Reading MPM script"
print("Reading MPM script")
######################################################################
# Build flags
......
......@@ -32,7 +32,7 @@ bridging_path = os.path.join(src_dir, 'bridging')
hue_env = env.Clone()
print "Reading Hue Plugin script"
print("Reading Hue Plugin script")
def maskFlags(flags):
......
......@@ -32,7 +32,7 @@ bridging_path = os.path.join(src_dir, 'bridging')
lifx_env = env.Clone()
print "Reading LifX Plugin script"
print("Reading LifX Plugin script")
def maskFlags(flags):
flags = [flags.replace('-Wl,--no-undefined', '') for flags in flags]
......
......@@ -32,7 +32,7 @@ bridging_path = os.path.join(src_dir, 'bridging')
lyric_env = env.Clone()
print "Reading Lyric Plugin script"
print("Reading Lyric Plugin script")
def maskFlags(flags):
......
......@@ -32,7 +32,7 @@ bridging_path = os.path.join(src_dir, 'bridging')
nest_env = env.Clone()
print "Reading Nest Plugin script"
print("Reading Nest Plugin script")
def maskFlags(flags):
......
......@@ -104,7 +104,7 @@ targets_disallow_multitransport = ['arduino']
# generate a list of unique targets: convert to set() for uniqueness,
# then convert back to a list
targetlist = list(set(x for l in host_target_map.values() for x in l))
targetlist = list(set(x for l in list(host_target_map.values()) for x in l))
######################################################################
# Common build options
......@@ -312,25 +312,25 @@ if env.get('WITH_ENV'):
env['ENV'] = os.environ
if 'CC' in os.environ:
env['CC'] = Split(os.environ['CC'])
print "using CC from environment: %s" % env['CC']
print("using CC from environment: %s" % env['CC'])
if 'CXX' in os.environ:
env['CXX'] = Split(os.environ['CXX'])
print "using CXX from environment: %s" % env['CXX']
print("using CXX from environment: %s" % env['CXX'])
if 'CFLAGS' in os.environ:
env['CFLAGS'] = Split(os.environ['CFLAGS'])
print "using CFLAGS from environment: %s" % env['CFLAGS']
print("using CFLAGS from environment: %s" % env['CFLAGS'])
if 'CXXFLAGS' in os.environ:
env['CXXFLAGS'] = Split(os.environ['CXXFLAGS'])
print "using CXXFLAGS from environment: %s" % env['CXXFLAGS']
print("using CXXFLAGS from environment: %s" % env['CXXFLAGS'])
if 'CCFLAGS' in os.environ:
env['CCFLAGS'] = Split(os.environ['CCFLAGS'])
print "using CCFLAGS from environment: %s" % env['CCFLAGS']
print("using CCFLAGS from environment: %s" % env['CCFLAGS'])
if 'CPPFLAGS' in os.environ:
env['CPPFLAGS'] = Split(os.environ['CPPFLAGS'])
print "using CPPFLAGS from environment: %s" % env['CPPFLAGS']
print("using CPPFLAGS from environment: %s" % env['CPPFLAGS'])
if 'LDFLAGS' in os.environ:
env['LINKFLAGS'] = Split(os.environ['LDFLAGS'])
print "using LDFLAGS/LINKFLAGS from environment: %s" % env['LINKFLAGS']
print("using LDFLAGS/LINKFLAGS from environment: %s" % env['LINKFLAGS'])
# set quieter build messages unless verbose mode was requested
if not env.get('VERBOSE'):
......@@ -368,7 +368,7 @@ if target_os in targets_support_cc:
env.AppendUnique(LINKFLAGS=['--sysroot=' + sys_root])
if prefix or tc_path:
print tc_set_msg
print(tc_set_msg)
# Import env variables only if reproductibility is ensured
if target_os in ['yocto']:
......@@ -377,7 +377,7 @@ else:
env['CONFIG_ENVIRONMENT_IMPORT'] = False
if env['CONFIG_ENVIRONMENT_IMPORT']:
print "warning: importing some environment variables for OS: %s" % target_os
print("warning: importing some environment variables for OS: %s" % target_os)
for ev in [
'PATH',
'PKG_CONFIG',
......
......@@ -29,7 +29,7 @@ if not env.get('ANDROID_HOME'):
msg += "\nANDROID_HOME=" + env.get('ANDROID_HOME')
# show the Android environment we will use:
print msg
print(msg)
src_dir = env.get('SRC_DIR')
......@@ -97,12 +97,12 @@ else:
if tc_ver:
cmd.append('NDK_TOOLCHAIN_VERSION=' + tc_ver)
else:
print '''
print('''
*************************************** Warning *******************************
* To support C++11, the NDK toolchain must support gcc >= 4.7
* Please make sure your android NDK is at least r8e
*******************************************************************************
'''
''')
cmd.append('-n')
......
......@@ -40,7 +40,7 @@ def __get_boards(dict):
def __get_cpu(dict, board):
cpus = []
keys = dict.keys()
keys = list(dict.keys())
for key in keys:
idx = key.find(board + '.menu.cpu.')
start = len(board + '.menu.cpu.')
......@@ -213,13 +213,13 @@ def __upload(env, binary):
port = '/dev/ttyACM0'
upload_cmd = arduino_home + '/hardware/tools/avr/bin/avrdude -C' + arduino_home +'/hardware/tools/avr/etc/avrdude.conf -p' \
+ mcu + ' -c' + protocol + ' -P' + port + ' -b' + speed + ' -D -Uflash:w:' + binary + ':i'
print "Upload command: %s" % upload_cmd
print("Upload command: %s" % upload_cmd)
install_cmd = env.Command('install_cmd', None, upload_cmd)
env.Default('install_cmd')
elif target_arch == 'arm':
port = 'ttyACM0'
upload_cmd = 'stty -F /dev/' + port + ' speed 1200 cs8 -cstopb -parenb \n' + arduino_home + '/hardware/tools/bossac -i --port=' + port + ' -U false -e -w -b ' + binary + ' -R'
print "Upload command: %s" % upload_cmd
print("Upload command: %s" % upload_cmd)
install_cmd = env.Command('install_cmd', None, upload_cmd)
env.Default('install_cmd')
......@@ -262,7 +262,7 @@ target_arch = env.get('TARGET_ARCH')
# installed. If not, get them and install them.
SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'arduino', 'SConscript'))
arduino_home = env.get('ARDUINO_HOME')
print 'ARDUINO_HOME = ' + env.get('ARDUINO_HOME')
print('ARDUINO_HOME = ' + env.get('ARDUINO_HOME'))
# Overwrite suffixes and prefixes
if env['HOST_OS'] == 'win32':
......@@ -296,13 +296,13 @@ if os.path.exists(os.path.join(arduino_home, 'lib', 'version.txt')):
vf = open(os.path.join(arduino_home, 'lib', 'version.txt'), 'r')
version = vf.readline().replace('.', '').strip()
else:
print '''
msg = '''
************************************* Error ***********************************
* Can't find version file (lib/version.txt), please check if (%s)
* is arduino root directory. *
*******************************************************************************
''' % arduino_home
Exit(1)
Exit(msg)
if version[0:2] == '10':
is_1_0_x = True
......@@ -318,13 +318,13 @@ if version[0:2] == '10':
env.Replace(LINK='avr-gcc')
env.Replace(RANLIB='avr-ranlib')
if target_arch != 'avr':
print '''
msg = '''
************************************* Error ***********************************
* Arduino 1.0.x IDE only support 'avr', to support other arch at least 1.5.x *
* is required.
*******************************************************************************
'''
Exit(1)
''')
Exit(msg)
else:
is_1_0_x = False
if target_arch == 'avr':
......@@ -342,11 +342,11 @@ else:
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)
......
......@@ -66,12 +66,12 @@ def __prepare_lib(ienv, libname, lib=None, path=None, script=None):
# Run configure command (usually done before building 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))
......@@ -81,15 +81,15 @@ def __download(ienv, target, url):
return target
try:
print "Download %s from %s" % (target, url)
print "Downloading ..."
print("Download %s from %s" % (target, url))
print("Downloading ...")
stream = urllib2.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))
......
......@@ -7,7 +7,7 @@ import SCons.Util
Import('env')
print "Reading linux configuration script"
print("Reading linux configuration script")
env['CCFLAGS'] = SCons.Util.CLVar(os.environ.get('CFLAGS', ""))
env.AppendUnique(CPPDEFINES=['WITH_POSIX', '__linux__'])
......
......@@ -20,7 +20,7 @@ def OpenRegKey(env, key, sub_key, reg_view_64bit=False):
sub_key,
0, # Reserved
reg_access_mask)
except WindowsError, err:
except WindowsError as err:
if err.errno != os.errno.ENOENT:
# Couldn't open Registry Key
Exit('Error: Could not Open %s Registry Key. Err=%s' % (sub_key, err.errno))
......@@ -37,7 +37,7 @@ def ReadRegistryStringValue(env, key, sub_key, value_name, reg_view_64bit=False)
(value, type) = winreg.QueryValueEx(hkey, value_name)
if type != winreg.REG_SZ:
Exit('Error: Registry Value \'%s\' is not a String' % value_name)
except WindowsError, err:
except WindowsError as err:
if err.errno != os.errno.ENOENT:
Exit('Error: Could not QueryValueEx for Registry Value \'%s\'. Err=%s' \
% (value_name, err.errno))
......
......@@ -15,7 +15,7 @@ gradle_url = 'https://services.gradle.org/distributions/' + gradle_zip_file
if not os.path.exists(gradle_dir):
if not os.path.exists(gradle_zip_file):
print "Retrieving Android Gradle bundle"
print("Retrieving Android Gradle bundle")
gradle_zip = env.Download(gradle_zip_file, gradle_url)
gradle_unpacked = env.UnpackAll(gradle_dir, gradle_zip)
......
......@@ -30,12 +30,12 @@ else:
ndk_path = os.path.join(Dir('.').abspath, ndk_dir)
if not os.path.exists(ndk_path):
if not os.path.exists(ndk_bundle):
print "Retrieving Android NDK bundle"
print("Retrieving Android NDK bundle")
env.Download(ndk_bundle, ndk_url)
print "Unpacking Android NDK bundle"
print("Unpacking Android NDK bundle")
if host_os.startswith('linux'):
# scons on Jenkins/android builder does not take 'a+x' mode, use octal
Execute(Chmod(ndk_bundle, 0755))
Execute(Chmod(ndk_bundle, 0o755))
if Execute("./" + ndk_bundle):
Exit("Unpack %s failed" % ndk_bundle)
elif host_os == 'darwin':
......
......@@ -41,13 +41,13 @@ if not env.get('ANDROID_HOME'):
if not os.path.exists(androidlib_dir):
if not os.path.exists(androidlib_bundle):
print "Retrieving Android SDK bundle"
print("Retrieving Android SDK bundle")
androidlib_zip = env.Download(androidlib_bundle, androidlib_url)
else:
androidlib_zip = androidlib_bundle
print 'Unzipping Android lib...'
print('Unzipping Android lib...')
env.UnpackAll(androidlib_dir, androidlib_zip)
print 'Unzipping Android lib complete'
print('Unzipping Android lib complete')
# export the location of the SDK
env.Replace(ANDROID_HOME=androidlib_dir)
......@@ -20,8 +20,8 @@ SConscript(src_dir + '/build_common/tools/UnpackAll.py')
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 is not set, you can set enviornment variable
* ARDUINO_HOME or add it in command line as follows (Only set if your
......@@ -29,13 +29,13 @@ if target_os == 'arduino':
* wish to manually set ARDUINO_HOME):
* # scons ARDUINO_HOME=<path to arduino root directory> ...
*******************************************************************************
'''
''')
arduinolib_dir = src_dir + '/extlibs/arduino/arduino-1.5.8'
if not os.path.exists(arduinolib_dir):
if _platform.startswith("linux"):
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'
......@@ -56,9 +56,9 @@ if target_os == 'arduino':
arduinolib_zip = arduinolib_zip_file
# Unzip the lib
print 'Unzipping arduino lib...'
print('Unzipping arduino lib...')
env.UnpackAll(arduinolib_dir, arduinolib_zip)
print 'Unzipping arduino lib complete'
print('Unzipping arduino lib complete')
# Remove downloaded file
os.remove(arduinolib_zip_file)
......@@ -81,12 +81,12 @@ if target_os == 'arduino':
timelib_zip = timelib_zip_file
# Unzip the lib
print 'Unzipping Arduino Time lib...'
print('Unzipping Arduino Time lib...')
env.UnpackAll(timelib_dir + '/Time', timelib_zip)
# Apply patches to ARDUINO_HOME directory.
os.chdir(arduinolib_dir)
print 'Patching Arduino libraries...'
print('Patching Arduino libraries...')
os.system("find ./libraries/Time/Time/DateStrings.cpp -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch --directory=" + arduinolib_dir)
......@@ -94,11 +94,11 @@ if target_os == 'arduino':
# Remove downloaded file
os.remove(timelib_zip_file)
else:
print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
print 'You may likely retrieve this package as follows:'
print ' sudo apt-get install dos2unix'
print ' or'
print ' sudo yum install dos2unix'
print('Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.')
print('You may likely retrieve this package as follows:')
print(' sudo apt-get install dos2unix')
print(' or')
print(' sudo yum install dos2unix')
exit(1)
redbearlib_dir = arduinolib_dir + '/libraries/RBL_nRF8001'
......@@ -113,7 +113,7 @@ if target_os == 'arduino':
redbearlib_zip = redbearlib_zip_file
# Unzip the lib
print 'Unzipping Red Bear lib...'
print('Unzipping Red Bear lib...')
os.chdir(arduinolib_dir + '/libraries')
env.UnpackAll(redbearlib_dir, redbearlib_zip)
......@@ -122,7 +122,7 @@ if target_os == 'arduino':
shutil.rmtree('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747')
# Apply Red Bear patches
print 'Patching Red Bear library...'
print('Patching Red Bear library...')
os.chdir(arduinolib_dir + '/libraries/RBL_nRF8001/')
os.system("find . -type f -exec dos2unix {} \;")
......@@ -131,11 +131,11 @@ if target_os == 'arduino':
# Remove downloaded file
os.remove(redbearlib_zip_file)
else:
print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
print 'You may likely retrieve this package as follows:'
print ' sudo apt-get install dos2unix'
print ' or'
print ' sudo yum install dos2unix'
print('Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.')
print('You may likely retrieve this package as follows:')
print(' sudo apt-get install dos2unix')
print(' or')
print(' sudo yum install dos2unix')
exit(1)
nordiclib_dir = arduinolib_dir + '/libraries/BLE'
......@@ -150,7 +150,7 @@ if target_os == 'arduino':
nordiclib_zip = nordiclib_zip_file
# Unzip the lib
print 'Unzipping Nordic lib...'
print('Unzipping Nordic lib...')
os.chdir(arduinolib_dir + '/libraries')
env.UnpackAll(nordiclib_dir, nordiclib_zip)
......@@ -159,7 +159,7 @@ if target_os == 'arduino':
shutil.rmtree('ble-sdk-arduino-0.9.5.beta')
# Apply Nordic lib patches
print 'Patching Nordic library...'
print('Patching Nordic library...')
os.chdir(arduinolib_dir + '/libraries/BLE/')
os.system("find . -type f -exec dos2unix {} \;")
......@@ -168,13 +168,13 @@ if target_os == 'arduino':
# Remove downloaded file
os.remove(nordiclib_zip_file)
else:
print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
print 'You may likely retrieve this package as follows:'
print ' sudo apt-get install dos2unix'
print ' or'
print ' sudo yum install dos2unix'
print('Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.')
print('You may likely retrieve this package as follows:')
print(' sudo apt-get install dos2unix')
print(' or')
print(' sudo yum install dos2unix')
exit(1)
# Set the ARDUINO_HOME
env.Replace(ARDUINO_HOME=arduinolib_dir)
print 'ARDUINO_HOME = ' + env.get('ARDUINO_HOME')
print('ARDUINO_HOME = ' + env.get('ARDUINO_HOME'))
......@@ -32,7 +32,7 @@ boost_bootstrap = os.path.join(boost_dir, 'bootstrap.bat')
if 'linux' == target_os:
# Check for Boost libraries in /usr/boost
print 'TODO: Perform platform check for linux'
print('TODO: Perform platform check for linux')
msg = "Target platform (%s) is currently not supported for boost builds" % target_os
raise SCons.Errors.EnvironmentError(msg)
......@@ -45,11 +45,11 @@ elif target_os in ['windows']:
if os.path.exists(boost_zip_file):
boost_zip = boost_zip_file
else:
print '*** Downloading Boost zip file (> 100MB). Please wait... ***'
print('*** Downloading Boost zip file (> 100MB). Please wait... ***')
boost_zip = boost_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)
boost_env.UnpackAll(boost_dir, boost_zip)
# Rename from boost_1_60_0 -> boost
......
......@@ -36,26 +36,26 @@ if gtest_env.GetOption('help'):
# Clean up gtest if 'clean' is specified, and it looks like has been built.
# Implicity skips the targets which don't "configure" (e.g. windows)
if gtest_env.GetOption('clean'):
print 'Cleaning google unit test'
print('Cleaning google unit test')
if os.path.exists(gtest_configured_sentinel):
clean = "cd %s && make clean" % gtest_dir
Execute(clean)
Return("gtest_env")
print '*** Checking for installation of google unit test %s ***' % GTEST_VERSION
print('*** Checking for installation of google unit test %s ***' % GTEST_VERSION)
if not os.path.exists(gtest_unpacked_sentinel):
# If the gtest zip file is not already present, download it
if not os.path.exists(gtest_zip_path):
gtest_zip = gtest_env.Download(gtest_zip_path, gtest_url)
else:
gtest_zip = gtest_zip_path
print 'Unzipping to : ' + gtest_dir
print('Unzipping to : ' + gtest_dir)
gtest_env.UnpackAll(gtest_dir, gtest_zip)
if target_os in ['linux']:
if not os.path.exists(gtest_configured_sentinel):
# Run configure on gtest
print 'Configuring google unit test'
print('Configuring google unit test')
reconfigure_ran = gtest_env.Configure(gtest_dir, 'autoreconf -i')
if env.get('CROSS_COMPILE'):
configure_ran = env.Configure(
......@@ -67,7 +67,7 @@ if target_os in ['linux']:
gtest_env.Depends(configure_ran, reconfigure_ran)
# Run make on gtest
print 'Making google unit test'
print('Making google unit test')
make_ran = gtest_env.Configure(gtest_dir, 'make')
elif target_os in ['darwin', 'msys_nt'] and os.path.exists(gtest_dir):
......@@ -77,14 +77,14 @@ elif target_os in ['darwin', 'msys_nt'] and os.path.exists(gtest_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')
......
......@@ -32,7 +32,7 @@ target_os = env.get('TARGET_OS')
src_dir = env.get('SRC_DIR')
if target_os in ['linux', 'windows']:
print '*** Checking for installation of hippomocks ***'
print('*** Checking for installation of hippomocks ***')
hippomocks_version = '5.0'
hippomocks_revision = 'v' + hippomocks_version
hippomocks_src_dir = src_dir + '/extlibs/hippomocks/hippomocks-' + hippomocks_version
......@@ -44,7 +44,7 @@ if target_os in ['linux', 'windows']:
hippomocks_zip = env.Download(hippomocks_zip_file, hippomocks_url)
else:
hippomocks_zip = hippomocks_zip_file
print 'hippomocks: Unzipping %s to %s' % (hippomocks_zip_file,
hippomocks_dest_dir)
print('hippomocks: Unzipping %s to %s' % (hippomocks_zip_file,
hippomocks_dest_dir))
env.UnpackAll(hippomocks_src_dir, hippomocks_zip)
os.rename(hippomocks_src_dir, hippomocks_dest_dir)
......@@ -57,7 +57,7 @@ libcoap_update_command = 'git fetch --tags && git checkout -f ' + libcoap_versio
libcoap_change_dir_command = 'cd ' + libcoap_dir
if with_upstream_libcoap == '1':
print '*** Checking for installation of libCoAP ***'
print('*** Checking for installation of libCoAP ***')
if not os.path.exists(libcoap_dir):
msg = '''
*********************************** Error: ************************************
......@@ -70,17 +70,17 @@ if with_upstream_libcoap == '1':
os.chdir(libcoap_dir)
out = subprocess.check_output('git log --format=%d -n 1', shell=True)
if libcoap_version not in out:
print '''
print('''
******************************* Info: *****************************************
* Your libCoAP repo is not up to date with the latest version we require (%s).
*******************************************************************************
''' % (libcoap_version)
''' % (libcoap_version))
if libcoap_env.get('AUTOMATIC_UPDATE'):
print '''
print('''
******************************* Info: *****************************************
* Automatically updating libcoap to version %s.
*******************************************************************************
''' % (libcoap_version)
''' % (libcoap_version))
subprocess.check_output(libcoap_update_command, shell=True)
else:
msg = '''
......@@ -93,12 +93,12 @@ if with_upstream_libcoap == '1':
Exit(msg)
else:
print '''
print('''
******************************* Info: *****************************************
* Using FORKED copy of libCoap located in: