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 ])