Commits

Anonymous committed 4c6b635

cleanup and add build_source.conf samples

  • Participants
  • Parent commits 4e5b68e

Comments (0)

Files changed (8)

+syntax: glob
+
+./source/* # this repo is for build tool only
+./script/build_source.conf # user create local config by modify build_source.conf.<win/linux>-example
+
+./build/*
+./log/*
+./install/*
+## File: COPY.txt
+## For : Copyright information
+##
+## Copyright (c) 2012 All Right Reserved, Wisut Hantanong
+##
+## This file is part of buildplace.
+##
+## buildplace is free software: you can redistribute it and/or modify
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## at your option) any later version.
+##
+## buildplace is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with buildplace.  If not, see <http://www.gnu.org/licenses/>.
+#

File TODO

-TODO:
-    - per source env overide
-    - prebuild/postbuild support
+# add todo or wish list here
+TODO:
+    - prebuild/postbuild support
+    - `cmd` evaluation , e.g. `which python` = /usr/bin/python 
+
+# move what already done TODO: here
+DONE:
+    - per source env overide

File script/build_source.conf

-## Copyright (c) 2012 All Right Reserved, Wisut Hantanong
-##
-## This file is part of buildplace.
-##
-## buildplace is free software: you can redistribute it and/or modify
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## at your option) any later version.
-##
-## buildplace is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with buildplace.  If not, see <http://www.gnu.org/licenses/>.
-##
-
-## This is a kind of yaml file (loaded using PYaml which some YAML feature migth not support, see http://pyyaml.org/) 
-## comment start with # (to end of line)
-## Don't use <TAP> for identation
-## if config failed to loaded first thing to check is identation consistency of each level
-
-##
-## common parameters
-##
-## noted that installation location for each source can be set in config_args (e.g., CMAKE_INSTALL_PREFIX, --prefix)
-## All xxx_path support ${ENV} expansion 
-## Don't use unix user home shorthand tilde (~) please use $HOME instead (build script not handle expansion correctly)
-##
-common:
-  envs: # these envs for all source, if you want to specify env just for one source use config_args with coresponding format
-    - BUILDPLACE_ROOT=$HOME/buildplace
-#    - CC='ccache'
-#    - CXX='ccache'
-#    - CC='distcc gcc'
-#    - CXX='distcc g++'
-  source_dir: $BUILDPLACE_ROOT/source # read-only (except for bootstraping and source that not support out-of-source build)
-  build_dir: $BUILDPLACE_ROOT/build # build tree created by buildscript (if not exists)
-  log_dir: $BUILDPLACE_ROOT/log # build log saved here 
-
-##
-## source list
-##
-source:
-##
-## sorce list description
-## name: key for listing in listbox for selection (need to be unique)
-##   version: x.y.z vession string that name-x.y.z exists in source_dir
-##   config_cmd: cmake or configure
-##   config_args: arguments need for config_cmd (in raw format, i.e. -DXXX for cmake and --ABC for configure)
-##   build_cmd: make, ninja depends on how source is configure
-##   build_args: arguments need for build_cmd (e.g. all, install)
-##   envs: (optional) per source env for both config and build, for global env please use 'envs' in common section 
-##   prebuild_script: (optional) script will be run before build (may need on some source, e.g. create output dir)
-##   postbuild_script: (optional) script will be run after build (may need on some source, e.g. configurator not provide 'install' target)
-
-  surfscan:
-    version: 0.0.1
-    config_cmd: cmake
-    config_args:
-    - -DBOOST_ROOT=$BUILDPLACE_ROOT/install/boost-svn.trunk
-    - -DOPENCV_DIR=/usr/lib/cmake/opencv
-    - -DPCL__DIR=/usr/lib/cmake/pcl
-##    - -DCGAL_INSTALL_DIR=/home/wisut/surfscan-dev2/install/cgal-4.0
-#    - -DCGAL_DIR=/usr/lib/CGAL
-#    - -DCGAL_TAUCS_INSTALL_DIR=/home/wisut/surfscan-dev2/install/taucs-cgal-3.5
-#    - -DSURFSCAN_DEVROOT=$HOME/buildplace
-#    - -DCMAKE_INSTALL_PREFIX=$HOME/buildplace/install/surfscan-0.0.1
-##    - -DCMAKE_BUILD_TYPE=Release
-##    - -DCMAKE_RELEASE_POSTFIX=_release
-#    - -DCMAKE_BUILD_TYPE=Debug
-#    - -DCMAKE_DEBUG_POSTFIX=_debug
-    build_cmd: make
-    build_args: 
-#    - -j4
-    - all
-#
-  boost:
-    version: svn.trunk
-    envs:
-    - CPLUS_INCLUDE_PATH=/usr/include/python3.2mu
-    config_cmd: ./bootstrap.sh
-    config_args:
-#    - --with-libraries=python,system,filesystem,thread,date_time,iostreams
-    - --with-python=/usr/bin/python3
-    - --prefix=$BUILDPLACE_ROOT/install/boost-svn.trunk
-    build_cmd: ./b2
-    build_args: 
-    - --build-dir=$BUILDPLACE_ROOT/build/boost-svn.trunk
-    - install
-#
-  cmake:
-    version: git.trunk
-#    config_cmd: ./configure
-    config_cmd: cmake
-    config_args:
-#    - --version
-#    - --prefix=$BUILDPLACE_ROOT/install/cmake-git.trunk/
-#    - -DCMAKE_INSTALL_PREFIX=$BUILDPLACE_ROOT/install/cmake-git.trunk/
-    - -DBUILD_QtDialog=ON
-    - -DBUILD_DOCUMENTATION=ON
-    - -DCMAKE_BUILD_TYPE=Release
-    build_cmd: make
-    build_args: 
-#    - -j4
-    - all
-#    - install
-#    prebuild_script: ./prebuild.sh
-#    postbuild_script: ./postbuild.sh
-#
-  eigen:
-    version: hg.trunk
-    config_cmd: cmake
-    config_args:
-    - -DCMAKE_INSTALL_PREFIX=$BUILDPLACE_ROOT/install/eigen-hg.trunk
-    build_cmd: make
-    build_args: 
-#    - -j4
-    - install
-
-  pcl:
-    version: svn.trunk
-#    version: svn.1.5.1
-    config_cmd: cmake
-    config_args:
-#    - -DCMAKE_INSTALL_PREFIX=$BUILDPLACE_ROOT/install/pcl-svn.1.5.1
-    - -DCMAKE_INSTALL_PREFIX=$BUILDPLACE_ROOT/install/pcl-svn.trunk
-#    - -DBOOST_ROOT=$BUILDPLACE_ROOT/install/boost-svn.trunk
-    - -DEIGEN_INCLUDE_DIR=$BUILDPLACE_ROOT/install/eigen-hg.trunk/include/eigen3
-    build_cmd: make
-    build_args: 
-#    - -j4
-    - all
-
-
-##  cgal:
-##    conf_args:
-##    - WITH_examples=ON
-##    - CMAKE_INSTALL_PREFIX=/home/wisut/surfscan-dev2/install/cgal-4.0
-##    - EIGEN3_INCLUDE_DIR=/home/wisut/surfscan-dev2/install/eigen-3.1.0a2/include/eigen3
-##    - EIGEN3_INCLUDE_DIR=/home/wisut/surfscan-dev2/install/eigen-hg.trunk/include/eigen3
-##    - LAPACK_LIBRARIES=/usr/lib/atlas-base/liblapack_atlas.so
-##    - BLAS_cblas_LIBRARY=/usr/lib/atlas-base/libcblas.so
-##    - TAUCS_INCLUDE_DIR=/home/wisut/surfscan-dev2/install/taucs-3.5/include
-##    - TAUCS_LIBRARY=/home/wisut/surfscan-dev2/install/taucs-3.5/lib/libtaucs.a
-##    mode: cmake
-##    version: 4.0
-##
-##  eigen:
-##    conf_args:
-##    - CMAKE_INSTALL_PREFIX=/home/wisut/surfscan-dev2/install/eigen-3.1.0a2
-##    - CMAKE_INSTALL_PREFIX=/home/wisut/surfscan-dev2/install/eigen-hg.trunk
-##    mode: cmake
-##    version: 3.1.0a2
-##    version: hg.trunk
-##
-##  gmp:
-##    conf_args:
-##    - prefix=/home/wisut/surfscan-dev2/install/gmp-5.0.0
-##    mode: configure
-##    version: 5.0.0

File script/build_source.conf.sample-linux

+## Copyright (c) 2012 All Right Reserved, Wisut Hantanong
+##
+## This file is part of buildplace. see COPY.txt for license detail
+
+## This is a kind(subset) of yaml file (loaded using PYaml which some YAML feature migth not support, see http://pyyaml.org/) 
+## comment start with # (to end of line)
+## Don't use <TAP> for identation
+## if config failed to loaded first thing to check is identation consistency of each level
+
+##
+## common parameters
+##
+## noted that installation location for each source can be set in config_args (e.g., CMAKE_INSTALL_PREFIX, --prefix)
+## All xxx_path support ${ENV} expansion both in $LINUX and %WINDOWS form (expand using python os.path.expandvars())
+## One exception, don't use unix user home shorthand tilde (~) please use $HOME instead (build script not handle expansion correctly)
+##
+common:
+  envs: # these envs for all source, if you want to specify env just for one source use config_args with coresponding format
+    - BUILDPLACE_ROOT=$HOME/buildplace # specify a handy development root dir so we don't need to type absolute path
+  source_dir: $BUILDPLACE_ROOT/source # mostly read-only (except for bootstraping and source that not support out-of-source build)
+  build_dir: $BUILDPLACE_ROOT/build # build tree created by buildscript (if not exists)
+  log_dir: $BUILDPLACE_ROOT/log # build log saved here 
+
+##
+## source list
+##
+source:
+##
+## sorce list description
+## name: key for listing in listbox for selection (need to be unique)
+##   version: x.y.z vession string that name-x.y.z exists in source_dir
+##   config_cmd: cmake or configure
+##   config_args: arguments need for config_cmd (in raw format, i.e. -DXXX for cmake and --ABC for configure)
+##   build_cmd: make, ninja depends on how source is configure
+##   build_args: arguments need for build_cmd (e.g. all, install)
+##   envs: (optional) per source env for both config and build, for global env please use 'envs' in common section 
+##   prebuild_script: (optional) not yet support, script will be run before build (e.g. create/copy misc output dir)
+##   postbuild_script: (optional) not yet support, script will be run after build (e.g. if configurator not provide 'install' target)
+
+####################################################################################################
+## boost-svn.trunk
+####################################################################################################
+## below sample configuration will build boost-svn.trunk with python3
+## boost provide it own configurator ./bootstrap.sh(bat) and builder b2/bjam
+  boost:
+    version: svn.trunk
+    envs:
+    - CPLUS_INCLUDE_PATH=/usr/include/python3.2mu
+    config_cmd: ./bootstrap.sh
+    config_args:
+#    - --with-libraries=python,system,filesystem,thread,date_time,iostreams # comment this out if will all libraries (long time)
+    - --with-python=/usr/bin/python3
+    - --prefix=$BUILDPLACE_ROOT/install/boost-svn.trunk # set BOOST_ROOT to this location before call cmake findpackage(Boost)
+    build_cmd: ./b2
+    build_args: 
+    - --build-dir=$BUILDPLACE_ROOT/build/boost-svn.trunk
+    - install # boost will be installed to location defined by --prefix above
+
+####################################################################################################
+## cmake-git.trunk
+####################################################################################################
+## cmake can be configure using autoconfig and installed cmake (if any)
+## Linux, gcc
+  cmake:
+    version: git.trunk
+    config_cmd: cmake # or ./configure
+    config_args:
+    - -DBUILD_QtDialog=ON # build cmake-gui 
+    - -DBUILD_DOCUMENTATION=ON # build documentation
+    - -DCMAKE_BUILD_TYPE=Release # for gcc
+    build_cmd: make
+    build_args: 
+    - -j4
+    - install # may need to call build script with sudo if you want to install to default /usr/local/bin
+
+####################################################################################################
+## eigen-hg.trunk
+####################################################################################################
+  eigen:
+    version: hg.trunk
+    config_cmd: cmake
+    config_args:
+    - -DCMAKE_INSTALL_PREFIX=$BUILDPLACE_ROOT/install/eigen-hg.trunk
+    build_cmd: make
+    build_args: 
+    - -j4
+    - install
+

File script/build_source.conf.sample-windows

+## Copyright (c) 2012 All Right Reserved, Wisut Hantanong
+##
+## This file is part of buildplace. see COPY.txt for license detail
+
+## This is a kind(subset) of yaml file (loaded using PYaml which some YAML feature migth not support, see http://pyyaml.org/) 
+## comment start with # (to end of line)
+## Don't use <TAP> for identation
+## if config failed to loaded first thing to check is identation consistency of each level
+
+##
+## common parameters
+##
+## noted that installation location for each source can be set in config_args (e.g., CMAKE_INSTALL_PREFIX, --prefix)
+## All xxx_path support ${ENV} expansion both in $LINUX and %WINDOWS form (expand using python os.path.expandvars())
+## One exception, don't use unix user home shorthand tilde (~) please use $HOME instead (build script not handle expansion correctly)
+##
+common:
+  envs: # these envs for all source, if you want to specify env just for one source use config_args with coresponding format
+    - BUILDPLACE_ROOT=$HOME/buildplace # specify a handy development root dir so we don't need to type absolute path
+  source_dir: $BUILDPLACE_ROOT/source # mostly read-only (except for bootstraping and source that not support out-of-source build)
+  build_dir: $BUILDPLACE_ROOT/build # build tree created by buildscript (if not exists)
+  log_dir: $BUILDPLACE_ROOT/log # build log saved here 
+
+##
+## source list
+##
+source:
+##
+## sorce list description
+## name: key for listing in listbox for selection (need to be unique)
+##   version: x.y.z vession string that name-x.y.z exists in source_dir
+##   config_cmd: cmake or configure
+##   config_args: arguments need for config_cmd (in raw format, i.e. -DXXX for cmake and --ABC for configure)
+##   build_cmd: make, ninja depends on how source is configure
+##   build_args: arguments need for build_cmd (e.g. all, install)
+##   envs: (optional) per source env for both config and build, for global env please use 'envs' in common section 
+##   prebuild_script: (optional) not yet support, script will be run before build (e.g. create/copy misc output dir)
+##   postbuild_script: (optional) not yet support, script will be run after build (e.g. if configurator not provide 'install' target)
+
+####################################################################################################
+## boost-svn.trunk
+####################################################################################################
+## below sample configuration will build boost-svn.trunk with python3
+## boost provide it own configurator ./bootstrap.sh(bat) and builder b2/bjam
+  boost:
+    version: svn.trunk
+    envs:
+    - CPLUS_INCLUDE_PATH=/usr/include/python3.2mu
+    config_cmd: ./bootstrap.sh
+    config_args:
+#    - --with-libraries=python,system,filesystem,thread,date_time,iostreams # comment this out if will all libraries (long time)
+    - --with-python=/usr/bin/python3
+    - --prefix=$BUILDPLACE_ROOT/install/boost-svn.trunk # set BOOST_ROOT to this location before call cmake findpackage(Boost)
+    build_cmd: ./b2
+    build_args: 
+    - --build-dir=$BUILDPLACE_ROOT/build/boost-svn.trunk
+    - install # boost will be installed to location defined by --prefix above
+
+####################################################################################################
+## cmake-git.trunk
+####################################################################################################
+  cmake:
+    version: git.trunk
+    config_cmd: cmake
+    config_args:
+    - -DBUILD_QtDialog=ON # build cmake-gui 
+    - -DBUILD_DOCUMENTATION=ON # build documentation
+    - -DCMAKE_BUILD_TYPE=Release # for gcc
+    build_cmd: msbuild
+    build_args: 
+    - INSTALL.vcxproj
+
+
+####################################################################################################
+## eigen-hg.trunk
+####################################################################################################
+  eigen:
+    version: hg.trunk
+    config_cmd: cmake
+    config_args:
+    - -DCMAKE_INSTALL_PREFIX=$BUILDPLACE_ROOT/install/eigen-hg.trunk
+    build_cmd: msbuild
+    build_args: 
+    - INSTALL.vcxproj
+

File script/build_source.py

-#!/usr/bin/python3
+#!/usr/bin/python
 # Copyright (c) 2012 All Right Reserved, Wisut Hantanong
 #
 # This file is part of buildplace.
 # You should have received a copy of the GNU General Public License
 # along with buildplace.  If not, see <http://www.gnu.org/licenses/>.
 
-import sys, os, yaml, logging, tkinter, time, subprocess
+import sys, os, yaml, logging, Tkinter as tkinter, time, subprocess
 
 #FIXME:HARDCODE: get terminal dimension from system instead of hard-coding
 # btw terminal is use for debug purpose only
 # TODO:try to minimize value passing via UI by using CONFIGS when applicable, this will help in UI redesign process
 UIS = {} # for cross-function UI update
 APP = 0 # tk app reference
+TITLE='buildplace 0.0.1'
 
 # script entry point
 def main():
 	# DEBUG: clear console for easy debug message reading
-	os.system('clear')
+	if sys.platform == 'linux2': os.system('clear')
 
 	global CONFIGS # need this to tell python that we will write to global CONFIGS 
 	global UIS # need this too for modifying the global UIS
 
 	logger.debug('CONFIGS {}'.format(CONFIGS))
 
-	print('Looking for log_dir in config file')
+	print 'Looking for log_dir in config file'
 	log_dir = CONFIGS['common']['log_dir']
 
 	initlogger(log_dir)
 	for w in UIS['source_detail'].winfo_children():
 		w.destroy()
 
-	print('source')
+	print 'source' 
 	sources = {}
 	for src in CONFIGS['source'] if 'source' in CONFIGS else {}:
 		sources[src] = CONFIGS['source'][src] # get source sub-item
-		print('name {0} version {1}'.format(src, sources[src]['version']))
+		print '  name {0} version {1}'.format(src, sources[src]['version']) 
 
 	for src in sources:
 		UIS['sourcelistbox'].insert(tkinter.END, src)
 	#
 	# main window
 	APP = tkinter.Tk()
+	APP.title(TITLE)
+
+	# reload button and status label frame
+	status_frame = tkinter.Frame(APP, borderwidth=1)
+	status_frame.pack(fill=tkinter.X)
 
 	# main frame
 	main_frame = tkinter.Frame(APP, borderwidth=1)
 	main_frame.pack(fill=tkinter.BOTH, expand=1)
 
-	# main label
-	tkinter.Label(main_frame, text='buildplace 0.0.1').pack()
-
 	# config reload button
-	reload_config_btn = tkinter.Button(main_frame, text='reload config', command=reload_config)
-	reload_config_btn.pack(side=tkinter.TOP, padx=5, pady=5)
+	reload_config_btn = tkinter.Button(status_frame, text='reload config', command=reload_config)
+	reload_config_btn.pack(side=tkinter.LEFT, padx=5, pady=5)
 
 	# current status lable
 	UIS['status'] = tkinter.StringVar()
-	tkinter.Label(main_frame, textvariable=UIS['status']).pack()
+	tkinter.Label(status_frame, textvariable=UIS['status']).pack(side=tkinter.LEFT)
 
 	# left frame
 	UIS['frame_left'] = tkinter.Frame(main_frame, borderwidth=1)
 	lbx = event.widget # sender widget is listbox
 	index = int(lbx.curselection()[0]) # get current selection index (no multipleselction)
 	selection = lbx.get(index) # selection value
-	print('listbox selected index {}, value {}'.format(index, selection))
+#	print 'listbox selected index {}, value {}'.format(index, selection) 
 
 	logger.debug('CONFIGS: {0}'.format(CONFIGS))
 	for w in UIS['source_detail'].winfo_children(): # clear source_detail frame
 
 	UIS['status'].set('{0} {1}'.format(selection, cur_source['version']))
 
+	# show configure and build botton
+	button_frame = tkinter.Frame(UIS['source_detail'], borderwidth=1)
+	button_frame.pack(side=tkinter.TOP, fill=tkinter.X, expand=1)
+
+	config_btn = tkinter.Button(button_frame, text='configure', command=config_source)
+	config_btn.pack(side=tkinter.RIGHT, padx=2, pady=2)
+
+	make_btn = tkinter.Button(button_frame, text='build', command=build_source)
+	make_btn.pack(side=tkinter.RIGHT, padx=2, pady=2)
+
 	# show configuration arguments in source detail listbox 
 	tkinter.Label(UIS['source_detail'], text=cur_source['config_cmd'] if 'config_cmd' in cur_source else 'N/A').pack()
 
 	config_opts = tkinter.Listbox(UIS['source_detail'])
-	if 'config_args' in cur_source:
-		if cur_source['config_args']:
+	if 'config_args' in cur_source: # check for valid key
+		if cur_source['config_args']: # check for not empty
 			for opt in cur_source['config_args']:
+				for i in range(10): opt = os.path.expandvars(opt)
 				config_opts.insert(tkinter.END, opt)
 	config_opts.pack(fill=tkinter.BOTH, expand=1)
 	config_opts.config(state=tkinter.DISABLED) # not support editing yet
 	if 'build_args' in cur_source:
 		if cur_source['build_args']:
 			for opt in cur_source['build_args']:
+				for i in range(10): opt = os.path.expandvars(opt)
 				build_opts.insert(tkinter.END, opt)
 	build_opts.pack(fill=tkinter.BOTH, expand=1)
 	build_opts.config(state=tkinter.DISABLED) # not support editing yet
 
-	config_btn = tkinter.Button(UIS['source_detail'], text='configure', command=config_source)
-	config_btn.pack(side=tkinter.RIGHT, padx=5, pady=5)
-
-	make_btn = tkinter.Button(UIS['source_detail'], text='build', command=build_source)
-	make_btn.pack(side=tkinter.RIGHT, padx=5, pady=5)
-
 	logger.debug('update_source_detail: exit')
 	return
 
 	logger.debug('build_source: enter')
 
 	cur_source = UIS['cur_source'] # get current source to work with
-	print('building ... {}-{}'.format(cur_source['name'], cur_source['version']))
+	print 'building ... {}-{}'.format(cur_source['name'], cur_source['version']) 
 
 	source_name = cur_source['name'] + '-' + cur_source['version']
 	# build_dir only valid after configurator called
 	if 'build_dir' in cur_source:
 		build_dir = cur_source['build_dir']
 	else:
-		print('build_dir not valid')
+		print 'build_dir not valid' 
 		#UIS['status'] = 'N/A'
 		return
 
 		# expand env in config_args
 		if raw_build_args:
 			for arg in raw_build_args:
-				for i in range(10):
-					arg = os.path.expandvars(arg)
+				for i in range(10): arg = os.path.expandvars(arg)
 				build_args.append(arg)
-				#print('bld ', arg)
+				#print 'bld ', arg 
 
-	print('source_name ', source_name)
-	print('build_dir ', build_dir)
-	print('build_cmd ', build_cmd)
-	print('build_args ', build_args)
+#	print 'source_name ', source_name 
+#	print 'build_dir ', build_dir 
+#	print 'build_cmd ', build_cmd 
+#	print 'build_args ', build_args 
 
 	ret = -1
 	args = {}
 		build_env[key] = val # get system envs (include common env by loadconfig())
 
 	if ENV: 
-		print('common envs')
+		print 'common envs' 
 		for key, val in ENV.items(): 
-			print(key, val)
+			print '  ', key, val 
 
 	source_env = cur_source['envs'] if 'envs' in cur_source else []
 	if source_env:
-		print('source envs')
+		print 'source envs' 
 		for env in cur_source['envs']:
 			key, val = env.split('=')
 			for i in range(10): 
 				val = os.path.expandvars(val)
 			build_env[key] = val # add source env to config_env
-			print(key, ' ' , val)
-	else:
-		print('No source envs')
+			print '  ', key, val 
+#	else:
+#		print 'No source envs' 
 		
-	print('using builder "{}"'.format(build_cmd))
+	print 'using builder "{}"'.format(build_cmd) 
 	args['task_name'] = source_name
 	args['env'] = build_env
 	args['working_dir'] = build_dir
 	ret = do_exec(args)
 
 	if ret == 0:
-		print('INFO: build success ({0})'.format(ret))
-		UIS['status'].set('INFO: configure success ({0})'.format(ret))
-		pass
+		print 'INFO: build success ({0})'.format(ret) 
+		UIS['status'].set('INFO: build success ({0})'.format(ret))
+		print
 	else:
-		print('ERROR: configure failed ({0})'.format(ret));
-		UIS['status'].set('ERROR: configure failed ({0})'.format(ret))
-		pass
+		print 'ERROR: build failed ({0})'.format(ret) ;
+		UIS['status'].set('ERROR: build failed ({0})'.format(ret))
+		print
 
 	logger.debug('build_source: exit')
 	return
 	global UIS # we modify UIS['cur_source']
 
 	cur_source = UIS['cur_source'] # get current source to work with
-	print('configuring ... {}-{}'.format(cur_source['name'], cur_source['version']))
+	print 'configuring ... {}-{}'.format(cur_source['name'], cur_source['version']) 
 
 	source_name = cur_source['name'] + '-' + cur_source['version']
 	source_dir = os.path.join(CONFIGS['common']['source_dir'], source_name)
 				for i in range(10):
 					arg = os.path.expandvars(arg)
 				config_args.append(arg)
-				#print('cfg ', arg)
+				#print 'cfg ', arg 
 
 	config_env = {}
 	for key, val in os.environ.items():
 		config_env[key] = val # get system envs (include common env by loadconfig())
 
 	if ENV: 
-		print('common envs')
+		print 'common envs' 
 		for key, val in ENV.items(): 
-			print(key, val)
+			print '  ', key, val 
 
 	source_env = cur_source['envs'] if 'envs' in cur_source else []
 	if source_env:
-		print('source envs')
+		print 'source envs' 
 		for env in cur_source['envs']:
 			key, val = env.split('=')
 			for i in range(10): 
 				val = os.path.expandvars(val)
 			config_env[key] = val # add source env to config_env
-			print(key, ' ' , val)
-	else:
-		print('No source envs')
+			print '  ', key, val 
+#	else:
+#		print 'No source envs' 
 	
 	# configuring selection by type of configurator
 	ret = -1
 	args = {}
 	if config_cmd[0] == '.': # local configurator, e.g. ./configure, ./autogen.sh
-		print('using local configurator "{}"'.format(config_cmd))
+		print 'using local configurator "{}"'.format(config_cmd) 
 		cur_source['build_dir'] = source_dir # pass build_dir to builder
 
 		args['task_name'] = source_name
 		args['arguments'] = config_args
 		ret = do_exec(args)
 	else: # system wide, e.g. cmake
-		print('using system configurator "{}"'.format(config_cmd))
+		print 'using system configurator "{}"'.format(config_cmd) 
 		if not os.path.exists(build_dir):
 			os.makedirs(build_dir)
 		cur_source['build_dir'] = build_dir # pass build_dir to builder 
 
-		cmakecache = os.path.join(build_dir, 'CMakeCache.txt')
-		if os.path.exists(cmakecache):
-			print('removing CMakeCache.txt')
-			os.remove(cmakecache)
+#		# this shoud be done in prebuid script
+#		cmakecache = os.path.join(build_dir, 'CMakeCache.txt')
+#		if os.path.exists(cmakecache):
+#			print 'removing CMakeCache.txt' 
+#			os.remove(cmakecache)
 			
 
-		print('source_name ', source_name)
-		print('source_dir ', source_dir)
-		print('build_dir ', build_dir)
-		print('config_cmd ', config_cmd)
-		print('config_args ', config_args)
+#		print 'source_name ', source_name 
+#		print 'source_dir ', source_dir 
+#		print 'build_dir ', build_dir 
+#		print 'config_cmd ', config_cmd 
+#		print 'config_args ', config_args 
 
 		args['task_name'] = source_name
 		args['env'] = config_env
 		ret = do_exec(args)
 
 	if ret == 0:
-		print('INFO: configure success ({0})'.format(ret))
+		print 'INFO: configure success ({0})'.format(ret) 
 		UIS['status'].set('INFO: configure success ({0})'.format(ret))
-		pass
+		print
 	else:
-		print('ERROR: configure failed ({0})'.format(ret));
+		print 'ERROR: configure failed ({0})'.format(ret)  
 		UIS['status'].set('ERROR: configure failed ({0})'.format(ret))
-		pass
+		print
 
 	logger.debug('config_source: exit')
 	return
 
-#def do_make(args):
-#	logger.debug('linux_do_make enter')
-#
-#	source = args['source']
-#	source_dir = args['source_dir']
-#	build_dir = args['build_dir']
-#	install_dir = args['install_dir']
-#	opts= args['opts'] if 'opts' in args else []
-#	reset = args['reset'] if 'reset' in args else False
-#	logger.info('linux_do_make args {0}'.format(args))
-#
-#	make_opts=['install'] + opts
-#
-#	# check if Makefile exists? 
-#	#makefile=os.path.join(build_dir,"Makefile")
-#	makefile=os.path.join(build_dir,"build.ninja")
-#	if not os.path.exists(makefile):
-#		print("ERROR: Makefile or build.ninja missing from ", build_dir)
-#		UIS['status'].set('ERROR: notthin to build in {0}'.format(build_dir))
-#		return -1
-#
-#	# call cmake for build Makefile 
-#	make_args = {}
-#	make_args['name'] = source
-#	#make_args['cmd'] = 'make'
-#	make_args['cmd'] = 'ninja'
-#	make_args['wd'] = build_dir
-#	make_args['cmd_args'] = make_opts
-#
-#	ret = do_exec(make_args)
-#	if ret == 0:
-#		print('INFO: make success ({0})'.format(ret))
-#		UIS['status'].set('INFO: make success ({0})'.format(ret))
-#		pass
-#	else:
-#		print('ERROR: make failed ({0})'.format(ret));
-#		UIS['status'].set('ERROR: make failed ({0})'.format(ret))
-#		pass
-#
-#	logger.debug('do_make exit')
-#	return ret
-#
-#
-#def do_cmake(args):
-#	logger.debug('do_cmake enter')
-#
-#	source = args['source']
-#	source_dir = args['source_dir']
-#	build_dir = args['build_dir']
-#	install_dir = args['install_dir']
-#	opts= args['opts']
-#	reset = args['reset'] if 'reset' in args else False
-#	logger.info('do_cmake args {0}'.format(args))
-#
-#	cmake_opts=[ '-D{0}'.format(i) for i in opts]
-#
-#	# check for existing build path ,if not create one
-#	if not os.path.exists(build_dir):
-#		print("directory created ", build_dir)
-#		os.makedirs(build_dir)
-#	else: 
-#		print("directory exists ", build_dir)
-#
-#	# delete CMakeCache.txt if exists? 
-#	cache=os.path.join(build_dir,"CMakeCache.txt")
-#	if reset:
-#		print("Not using ", cache)
-#		if os.path.exists(cache):
-#			os.remove(cache)
-#	else:
-#		print("Using ", cache)
-#		pass
-#
-#	# call cmake for generate Makefile 
-#	cmake_args = {}
-#	cmake_args['name'] = source
-#	cmake_args['cmd'] = 'cmake'
-#	cmake_args['wd'] = build_dir
-#	# cmake_args['cmd_args'] = [source_dir] + ['-G','CodeBlocks - Unix Makefiles'] + cmake_opts
-#	cmake_args['cmd_args'] = [source_dir] + ['-GNinja'] + cmake_opts 
-#	#cmake_args['cmd_args'] = [source_dir] + ['-GUnix Makefiles'] + cmake_opts 
-#
-#	ret = do_exec(cmake_args)
-#	if ret == 0:
-#		print('INFO: cmake success ({0})'.format(ret))
-#		UIS['status'].set('INFO: cmake success ({0})'.format(ret))
-#		pass
-#	else:
-#		print('ERROR: cmake failed ({0})'.format(ret));
-#		UIS['status'].set('ERROR: cmake failed ({0})'.format(ret))
-#		pass
-#
-#	logger.debug('do_cmake exit')
-#	return ret
-
 def initlogger(log_dir):
-	print('initlogger: raw log_dir=', log_dir)
-
-	print('initlogger: full log_dir=', log_dir)
+	print 'initlogger: log_dir=', log_dir 
 	if not os.path.exists(log_dir):
 		os.makedirs(log_dir)
 
 	cmd_args = args['arguments'] # list of command argument eg. '['x', 'y', 'z']
 	wd = args['working_dir'] # working directory
 	if not os.path.exists(wd):
-		print('WARNING: working directory {} not exists. This migth cause configuring fail'.format(wd))
+		print 'WARNING: working directory {} not exists. This migth cause configuring fail'.format(wd) 
 	env = args['env']
 
 	log_dir = CONFIGS['common']['log_dir']
 	command = [cmd] + cmd_args
 
 	logger.info('command {0}'.format(command))
-	print('command ', command)
-	print('wd ', wd)
-	print('env ')
-	for key, val in env.items():
-		print('   {} - {}'.format(key, val))
-	print('command text', ' '.join(command))
+	print 'command ', command 
+#	print 'command_text', ' '.join(command) 
+	print 'wd ', wd 
+#	print 'env ' 
+#	for key, val in env.items():
+#		print '   {} - {}'.format(key, val) 
 	ret=subprocess.Popen(command, env=env, shell=False, cwd=wd, stdout=subprocess.PIPE, stderr=cerr)
 
 	pad=' ' * (TERM_WIDTH + 5)
 	while True:
 		cout_line=ret.stdout.readline()
 		if cout_line:
-			#print(pad, end='\r')
-			#print('==', cout_line.decode('utf-8')[0:TERM_WIDTH].replace('\n','\r'), end='\r')
+			#print pad, end='\r' 
+			#print '==', cout_line.decode('utf-8')[0:TERM_WIDTH].replace('\n','\r'), end='\r' 
 			UIS['status'].set(cout_line.decode('utf-8')[0:TERM_WIDTH])
 			UIS['frame_right'].update_idletasks()
 			cout.write(cout_line)
 		else:
 			break
-	print()
-
 	ret.wait()
 
 	cout.close()
 	if(filename == ''):
 		filename = os.path.dirname(os.path.abspath(__file__)) + '/build_source.conf'
 
-	print('using ', filename)
+	print 'using configfile ', filename 
 
 	try:
 		config_file = open(filename)
 				val = os.path.expandvars(val)
 			ENV[key] = val
 			os.environ[key] = val # also pass common env to system (for used in var expansion)
-			#print(key,'=', val)
+			#print key,'=', val 
 
 		# expand all vars in common section, let system handle vars in command argument 
 		# this allow ~/xxx (or ${env}/xxx in future) in config file
 			config['common']['build_dir']	= os.path.expandvars(config['common']['build_dir'])
 			config['common']['log_dir']	= os.path.expandvars(config['common']['log_dir'])
 	except:
-		print('ERROR: can\'t open configuration file \'{0}\''.format(os.path.join(os.getcwd(), filename)))
-		print('       Please check that file exists and YAML-valid')
-		print(sys.exc_info())
+		print 'ERROR: can\'t open configuration file \'{0}\''.format(os.path.join(os.getcwd(), filename)) 
+		print '       Please check that file exists and YAML-valid' 
+		print sys.exc_info() 
 	finally:
 		config_file.close()
-		#print(config)
+		#print config 
 
 	return config