Thread: [pygccxml-commit] SF.net SVN: pygccxml: [813] graphical_installer
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-12-25 15:47:15
|
Revision: 813 http://svn.sourceforge.net/pygccxml/?rev=813&view=rev Author: roman_yakovenko Date: 2006-12-25 07:47:10 -0800 (Mon, 25 Dec 2006) Log Message: ----------- initial commit Added Paths: ----------- graphical_installer/ graphical_installer/setup.py Property changes on: graphical_installer ___________________________________________________________________ Name: svn:ignore + *.tar Added: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py (rev 0) +++ graphical_installer/setup.py 2006-12-25 15:47:10 UTC (rev 813) @@ -0,0 +1,53 @@ +#step 1 - extract cmake +import os +import tarfile + +class config: + class archives: + cmake = 'cmake-2.4.5-win32-x86.tar' + gccxml = 'gccxml-cvs-25-dec-2006.tar' + all = [ gccxml, cmake ] + + destination_dir = r'd:\dev\setup' + gccxml_install_dir = r'd:\dev\gccxml' + +def execute( command, *args, **keywd): + cmd_line = [ command ] + for key, value in keywd.items(): + cmd_line.append( '--%s=%s' % ( key, value ) ) + cmd_line.extend( args ) + cmd = ' '.join( cmd_line ) + print os.linesep, 'cmd: ', cmd + input, output = os.popen4( cmd ) + input.close() + reports = [] + while True: + data = output.readline() + print data, + if not data: + break + exit_status = output.close() + if None is exit_status: + return 0 + return exit_status + +def build_gccxml(): + gccxml_src_dir = os.path.join( config.destination_dir + , os.path.splitext( config.archives.gccxml )[0] ) + build_dir = gccxml_src_dir + '-build' + + if not os.path.exists( build_dir ): + os.makedirs( build_dir ) + os.chdir( build_dir ) + cmake = os.path.join( + config.destination_dir + , os.path.splitext( config.archives.cmake )[0] + , 'bin' + , 'cmake' ) + execute( cmake, '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir, gccxml_src_dir ) + +if __name__ == "__main__": + #decompressing all archives + for arch in config.archives.all: + tarfile.TarFile( arch, "r" ).extractall( config.destination_dir ) + build_gccxml() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-27 11:37:52
|
Revision: 815 http://svn.sourceforge.net/pygccxml/?rev=815&view=rev Author: roman_yakovenko Date: 2006-12-27 03:37:52 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Modified Paths: -------------- graphical_installer/setup.py Added Paths: ----------- graphical_installer/environment.py Added: graphical_installer/environment.py =================================================================== --- graphical_installer/environment.py (rev 0) +++ graphical_installer/environment.py 2006-12-27 11:37:52 UTC (rev 815) @@ -0,0 +1,33 @@ +import os +import sys + +class config: + class archives: + cmake = 'cmake-2.4.5-win32-x86.tar' + gccxml = 'gccxml-cvs-25-dec-2006.tar' + all = [ gccxml, cmake ] + + destination_dir = r'd:\dev\setup' + gccxml_install_dir = r'd:\dev\gccxml' + + class cmake: + compiler = None + generator = None + native_build = None + + if 'win32' == sys.platform: + from distutils import msvccompiler + if 7.1 == msvccompiler.get_build_version(): + cc = msvccompiler.MSVCCompiler() + cc.initialize() + compiler="msvc71" + generator = 'NMake Makefiles' + native_build = '"%s" /A all' % cc.find_exe( 'nmake.exe' ) + else: #linux + compiler="msvc71" + generator = 'Unix Makefiles' + native_build = 'make' + + +#%comspec% /k + Modified: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py 2006-12-27 11:36:14 UTC (rev 814) +++ graphical_installer/setup.py 2006-12-27 11:37:52 UTC (rev 815) @@ -1,16 +1,10 @@ #step 1 - extract cmake import os +import sys import tarfile -class config: - class archives: - cmake = 'cmake-2.4.5-win32-x86.tar' - gccxml = 'gccxml-cvs-25-dec-2006.tar' - all = [ gccxml, cmake ] +from environment import config - destination_dir = r'd:\dev\setup' - gccxml_install_dir = r'd:\dev\gccxml' - def execute( command, *args, **keywd): cmd_line = [ command ] for key, value in keywd.items(): @@ -29,6 +23,9 @@ exit_status = output.close() if None is exit_status: return 0 + else: + print + print 'exit status: ', exit_status return exit_status def build_gccxml(): @@ -44,8 +41,23 @@ , os.path.splitext( config.archives.cmake )[0] , 'bin' , 'cmake' ) - execute( cmake, '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir, gccxml_src_dir ) + execute( cmake + , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir + , '-DCMAKE_BUILD_TYPE=release' + , '-G "%s"' % config.cmake.generator + , gccxml_src_dir ) + + os.chdir( os.path.join( build_dir, 'GCC_XML' ) ) + + execute( config.cmake.native_build ) + if 'win32' == sys.platform: + pass + else: + execute( config.cmake.native_build, '-DCMAKE_BUILD_TYPE=release', 'install' ) + + + if __name__ == "__main__": #decompressing all archives for arch in config.archives.all: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-27 14:39:59
|
Revision: 816 http://svn.sourceforge.net/pygccxml/?rev=816&view=rev Author: roman_yakovenko Date: 2006-12-27 06:39:59 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Modified Paths: -------------- graphical_installer/environment.py graphical_installer/setup.py Modified: graphical_installer/environment.py =================================================================== --- graphical_installer/environment.py 2006-12-27 11:37:52 UTC (rev 815) +++ graphical_installer/environment.py 2006-12-27 14:39:59 UTC (rev 816) @@ -23,11 +23,10 @@ compiler="msvc71" generator = 'NMake Makefiles' native_build = '"%s" /A all' % cc.find_exe( 'nmake.exe' ) + else: + raise NotImplementedError("The support for your environment was not implemented. Consider to contribute!" ) else: #linux compiler="msvc71" generator = 'Unix Makefiles' native_build = 'make' - -#%comspec% /k - Modified: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py 2006-12-27 11:37:52 UTC (rev 815) +++ graphical_installer/setup.py 2006-12-27 14:39:59 UTC (rev 816) @@ -1,6 +1,8 @@ #step 1 - extract cmake import os +import re import sys +import shutil import tarfile from environment import config @@ -35,6 +37,9 @@ if not os.path.exists( build_dir ): os.makedirs( build_dir ) + if os.path.exists( config.gccxml_install_dir ): + shutil.rmtree( config.gccxml_install_dir ) + os.chdir( build_dir ) cmake = os.path.join( config.destination_dir @@ -52,12 +57,26 @@ execute( config.cmake.native_build ) if 'win32' == sys.platform: - pass + #On windows GCC_XML does not support installation, so this setup will + #do it. + gccxml_config_file = os.path.join( build_dir, 'bin', 'gccxml_config' ) + gccxml_config = file( gccxml_config_file ).read() + gccxml_config = gccxml_config.replace( 'GCCXML_COMPILER="cl"' + , 'GCCXML_COMPILER="%s"' % config.cmake.compiler ) + + gccxml_root_re = re.compile( r'GCCXML_ROOT=\".*?\"' ) + found = gccxml_root_re.search( gccxml_config ) + gccxml_new_root = 'GCCXML_ROOT="%s"' % config.gccxml_install_dir + gccxml_new_root = gccxml_new_root.replace( '\\', '/' ) + gccxml_config = gccxml_config[:found.start()] + gccxml_new_root + gccxml_config[found.end():] + tmp = file( gccxml_config_file, 'w+' ) + tmp.write( gccxml_config ) + tmp.close() + + shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) else: execute( config.cmake.native_build, '-DCMAKE_BUILD_TYPE=release', 'install' ) - - if __name__ == "__main__": #decompressing all archives for arch in config.archives.all: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-27 20:31:08
|
Revision: 817 http://svn.sourceforge.net/pygccxml/?rev=817&view=rev Author: roman_yakovenko Date: 2006-12-27 12:31:01 -0800 (Wed, 27 Dec 2006) Log Message: ----------- porting to Linux Modified Paths: -------------- graphical_installer/environment.py graphical_installer/setup.py Added Paths: ----------- graphical_installer/widgets.py Modified: graphical_installer/environment.py =================================================================== --- graphical_installer/environment.py 2006-12-27 14:39:59 UTC (rev 816) +++ graphical_installer/environment.py 2006-12-27 20:31:01 UTC (rev 817) @@ -1,14 +1,27 @@ import os import sys +import logging +import tempfile +def create_logger(): + logger = logging.getLogger('install') + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger + class config: + + logger = create_logger() + class archives: - cmake = 'cmake-2.4.5-win32-x86.tar' - gccxml = 'gccxml-cvs-25-dec-2006.tar' + cmake = 'cmake-%s.tar' % sys.platform + gccxml = 'gccxml-cvs.tar' all = [ gccxml, cmake ] - destination_dir = r'd:\dev\setup' - gccxml_install_dir = r'd:\dev\gccxml' + gccxml_install_dir = None + working_dir = tempfile.gettempdir() class cmake: compiler = None @@ -26,7 +39,7 @@ else: raise NotImplementedError("The support for your environment was not implemented. Consider to contribute!" ) else: #linux - compiler="msvc71" + compiler="gcc" generator = 'Unix Makefiles' native_build = 'make' Modified: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py 2006-12-27 14:39:59 UTC (rev 816) +++ graphical_installer/setup.py 2006-12-27 20:31:01 UTC (rev 817) @@ -4,6 +4,7 @@ import sys import shutil import tarfile +import widgets from environment import config @@ -13,36 +14,44 @@ cmd_line.append( '--%s=%s' % ( key, value ) ) cmd_line.extend( args ) cmd = ' '.join( cmd_line ) - print os.linesep, 'cmd: ', cmd + config.logger.info( 'executing command: %s' % cmd ) input, output = os.popen4( cmd ) input.close() reports = [] while True: data = output.readline() - print data, + config.logger.info( data ) if not data: break exit_status = output.close() if None is exit_status: - return 0 + exit_status = 0 else: - print - print 'exit status: ', exit_status + config.logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) return exit_status -def build_gccxml(): - gccxml_src_dir = os.path.join( config.destination_dir +def build_gccxml(): + config.logger.info( 'create environment for building GCC_XML' ) + gccxml_src_dir = os.path.join( config.working_dir , os.path.splitext( config.archives.gccxml )[0] ) build_dir = gccxml_src_dir + '-build' if not os.path.exists( build_dir ): + config.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) os.makedirs( build_dir ) + config.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) + else: + config.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) + if os.path.exists( config.gccxml_install_dir ): + config.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) shutil.rmtree( config.gccxml_install_dir ) - + config.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) + else: + config.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) os.chdir( build_dir ) cmake = os.path.join( - config.destination_dir + config.working_dir , os.path.splitext( config.archives.cmake )[0] , 'bin' , 'cmake' ) @@ -53,8 +62,6 @@ , '-G "%s"' % config.cmake.generator , gccxml_src_dir ) - os.chdir( os.path.join( build_dir, 'GCC_XML' ) ) - execute( config.cmake.native_build ) if 'win32' == sys.platform: #On windows GCC_XML does not support installation, so this setup will @@ -72,13 +79,18 @@ tmp = file( gccxml_config_file, 'w+' ) tmp.write( gccxml_config ) tmp.close() - + config.logger.info( 'copying GCC_XML files to the install directory' ) shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) + config.logger.info( 'copying GCC_XML files to the install directory - done' ) else: - execute( config.cmake.native_build, '-DCMAKE_BUILD_TYPE=release', 'install' ) + execute( config.cmake.native_build, 'install' ) + #TODO remove build directory if __name__ == "__main__": + config.gccxml_install_dir = widgets.load_dir( "Select directory GCC_XML will be installed in" ) #decompressing all archives for arch in config.archives.all: - tarfile.TarFile( arch, "r" ).extractall( config.destination_dir ) + config.logger.info( 'extracting "%s"' % arch ) + tarfile.TarFile( arch, "r" ).extractall( config.working_dir ) + config.logger.info( 'extracting "%s" - done' % arch ) build_gccxml() Added: graphical_installer/widgets.py =================================================================== --- graphical_installer/widgets.py (rev 0) +++ graphical_installer/widgets.py 2006-12-27 20:31:01 UTC (rev 817) @@ -0,0 +1,26 @@ +import os +import Tkinter +import FileDialog + +class LoadDirDialog(FileDialog.FileDialog): + + title = "Select directory" + + def ok_command(self): + dir_ = self.get_selection() + if not os.path.isfile(dir_): + self.quit(dir_) + else: + self.master.bell() + +def load_dir(title, root=None): + created = False + if not root: + root = Tkinter.Tk() + root.withdraw() + created = True + LoadDirDialog.title = title + dir_ = LoadDirDialog(root).go() + if created: + root.destroy() + return dir_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-28 06:08:56
|
Revision: 819 http://svn.sourceforge.net/pygccxml/?rev=819&view=rev Author: roman_yakovenko Date: 2006-12-27 22:08:56 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Added Paths: ----------- graphical_installer/config.py graphical_installer/utils.py Removed Paths: ------------- graphical_installer/environment.py graphical_installer/widgets.py Added: graphical_installer/config.py =================================================================== --- graphical_installer/config.py (rev 0) +++ graphical_installer/config.py 2006-12-28 06:08:56 UTC (rev 819) @@ -0,0 +1,35 @@ +import sys +import tempfile + +#directory GCC-XML will be installed in +gccxml_install_dir = None +#temporal directory to extract archives and create executables +working_dir = tempfile.gettempdir() + +class archives: + cmake = 'cmake-%s.tar' % sys.platform + gccxml = 'gccxml-cvs.tar' + all = [ gccxml, cmake ] + +class cmake: + compiler = None + generator = None + native_build = None + + if 'win32' == sys.platform: + from distutils import msvccompiler + from distutils import ccompiler + if 'msvc' == ccompiler.get_default_compiler(): + cc = msvccompiler.MSVCCompiler() + cc.initialize() + generator = 'NMake Makefiles' + native_build = '"%s" /A all' % cc.find_exe( 'nmake.exe' ) + cl_mapping = { 6.0 : "msvc6", 7.0 : "msvc7", 7.1 : "msvc71", 8.0 : "msvc8" } + compiler = cl_mapping[ msvccompiler.get_build_version() ] + else: + raise NotImplementedError("The support for your environment was not implemented. Consider to contribute!" ) + else: #linux + compiler="gcc" + generator = 'Unix Makefiles' + native_build = 'make' + Deleted: graphical_installer/environment.py =================================================================== --- graphical_installer/environment.py 2006-12-28 06:07:36 UTC (rev 818) +++ graphical_installer/environment.py 2006-12-28 06:08:56 UTC (rev 819) @@ -1,45 +0,0 @@ -import os -import sys -import logging -import tempfile - -def create_logger(): - logger = logging.getLogger('install') - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - return logger - -class config: - - logger = create_logger() - - class archives: - cmake = 'cmake-%s.tar' % sys.platform - gccxml = 'gccxml-cvs.tar' - all = [ gccxml, cmake ] - - gccxml_install_dir = None - working_dir = tempfile.gettempdir() - - class cmake: - compiler = None - generator = None - native_build = None - - if 'win32' == sys.platform: - from distutils import msvccompiler - if 7.1 == msvccompiler.get_build_version(): - cc = msvccompiler.MSVCCompiler() - cc.initialize() - compiler="msvc71" - generator = 'NMake Makefiles' - native_build = '"%s" /A all' % cc.find_exe( 'nmake.exe' ) - else: - raise NotImplementedError("The support for your environment was not implemented. Consider to contribute!" ) - else: #linux - compiler="gcc" - generator = 'Unix Makefiles' - native_build = 'make' - Added: graphical_installer/utils.py =================================================================== --- graphical_installer/utils.py (rev 0) +++ graphical_installer/utils.py 2006-12-28 06:08:56 UTC (rev 819) @@ -0,0 +1,39 @@ +import os +import sys +import logging +import Tkinter +import FileDialog + +class LoadDirDialog(FileDialog.FileDialog): + + title = "Select directory" + + def ok_command(self): + dir_ = self.get_selection() + if not os.path.isfile(dir_): + self.quit(dir_) + else: + self.master.bell() + +def load_dir(title, root=None): + created = False + if not root: + root = Tkinter.Tk() + root.withdraw() + created = True + LoadDirDialog.title = title + dir_ = LoadDirDialog(root).go() + if created: + root.destroy() + return dir_ + + +def __create_logger(): + logger = logging.getLogger('install') + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger + +logger = __create_logger() Deleted: graphical_installer/widgets.py =================================================================== --- graphical_installer/widgets.py 2006-12-28 06:07:36 UTC (rev 818) +++ graphical_installer/widgets.py 2006-12-28 06:08:56 UTC (rev 819) @@ -1,26 +0,0 @@ -import os -import Tkinter -import FileDialog - -class LoadDirDialog(FileDialog.FileDialog): - - title = "Select directory" - - def ok_command(self): - dir_ = self.get_selection() - if not os.path.isfile(dir_): - self.quit(dir_) - else: - self.master.bell() - -def load_dir(title, root=None): - created = False - if not root: - root = Tkinter.Tk() - root.withdraw() - created = True - LoadDirDialog.title = title - dir_ = LoadDirDialog(root).go() - if created: - root.destroy() - return dir_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-28 19:40:22
|
Revision: 820 http://svn.sourceforge.net/pygccxml/?rev=820&view=rev Author: roman_yakovenko Date: 2006-12-28 11:40:19 -0800 (Thu, 28 Dec 2006) Log Message: ----------- Modified Paths: -------------- graphical_installer/setup.py graphical_installer/utils.py Modified: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py 2006-12-28 06:08:56 UTC (rev 819) +++ graphical_installer/setup.py 2006-12-28 19:40:19 UTC (rev 820) @@ -6,6 +6,7 @@ import config import shutil import tarfile +import tkFileDialog def execute( command, *args, **keywd): cmd_line = [ command ] @@ -90,7 +91,7 @@ utils.logger.info( 'removing GCC_XML build directory - done' ) if __name__ == "__main__": - config.gccxml_install_dir = utils.load_dir( "Select directory GCC_XML will be installed in" ) + config.gccxml_install_dir = utils.ask_directory( "Select directory GCC_XML will be installed in" ) if not config.gccxml_install_dir: utils.logger.info( 'If you want to install GCC_XML you have to provide a directory it will be installed in.' ) sys.exit(1) Modified: graphical_installer/utils.py =================================================================== --- graphical_installer/utils.py 2006-12-28 06:08:56 UTC (rev 819) +++ graphical_installer/utils.py 2006-12-28 19:40:19 UTC (rev 820) @@ -2,27 +2,15 @@ import sys import logging import Tkinter -import FileDialog +import tkFileDialog -class LoadDirDialog(FileDialog.FileDialog): - - title = "Select directory" - - def ok_command(self): - dir_ = self.get_selection() - if not os.path.isfile(dir_): - self.quit(dir_) - else: - self.master.bell() - -def load_dir(title, root=None): +def ask_directory(title, root=None): created = False if not root: root = Tkinter.Tk() root.withdraw() created = True - LoadDirDialog.title = title - dir_ = LoadDirDialog(root).go() + dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) if created: root.destroy() return dir_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 20:17:54
|
Revision: 830 http://svn.sourceforge.net/pygccxml/?rev=830&view=rev Author: roman_yakovenko Date: 2007-01-02 12:17:54 -0800 (Tue, 02 Jan 2007) Log Message: ----------- backporting to python 2.4 Modified Paths: -------------- graphical_installer/config.py graphical_installer/setup.py graphical_installer/utils.py Modified: graphical_installer/config.py =================================================================== --- graphical_installer/config.py 2007-01-02 08:18:14 UTC (rev 829) +++ graphical_installer/config.py 2007-01-02 20:17:54 UTC (rev 830) @@ -1,10 +1,7 @@ import sys -import tempfile #directory GCC-XML will be installed in gccxml_install_dir = None -#temporal directory to extract archives and create executables -working_dir = tempfile.gettempdir() class archives: cmake = 'cmake-%s.tar' % sys.platform Modified: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py 2007-01-02 08:18:14 UTC (rev 829) +++ graphical_installer/setup.py 2007-01-02 20:17:54 UTC (rev 830) @@ -5,35 +5,11 @@ import utils import config import shutil -import tarfile -import tkFileDialog +import tempfile -def execute( command, *args, **keywd): - cmd_line = [ command ] - for key, value in keywd.items(): - cmd_line.append( '--%s=%s' % ( key, value ) ) - cmd_line.extend( args ) - cmd = ' '.join( cmd_line ) - utils.logger.info( 'executing command: %s' % cmd ) - input, output = os.popen4( cmd ) - input.close() - reports = [] - while True: - data = output.readline() - utils.logger.info( data ) - if not data: - break - exit_status = output.close() - if None is exit_status: - exit_status = 0 - else: - utils.logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) - return exit_status - -def build_gccxml(): +def build_gccxml(working_dir): utils.logger.info( 'create environment for building GCC_XML' ) - gccxml_src_dir = os.path.join( config.working_dir - , os.path.splitext( config.archives.gccxml )[0] ) + gccxml_src_dir = os.path.join( working_dir, os.path.splitext( config.archives.gccxml )[0] ) build_dir = gccxml_src_dir + '-build' if not os.path.exists( build_dir ): @@ -52,19 +28,18 @@ os.chdir( build_dir ) - cmake = os.path.join( - config.working_dir - , os.path.splitext( config.archives.cmake )[0] - , 'bin' - , 'cmake' ) + cmake = os.path.join( working_dir + , os.path.splitext( config.archives.cmake )[0] + , 'bin' + , 'cmake' ) - execute( cmake - , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir - , '-DCMAKE_BUILD_TYPE=release' - , '-G "%s"' % config.cmake.generator - , gccxml_src_dir ) + utils.execute( cmake + , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir + , '-DCMAKE_BUILD_TYPE=release' + , '-G "%s"' % config.cmake.generator + , gccxml_src_dir ) - execute( config.cmake.native_build ) + utils.execute( config.cmake.native_build ) if 'win32' == sys.platform: #On windows GCC_XML does not support installation, so this setup will #do it. @@ -85,30 +60,36 @@ shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) utils.logger.info( 'copying GCC_XML files to the install directory - done' ) else: - execute( config.cmake.native_build, 'install' ) + utils.execute( config.cmake.native_build, 'install' ) utils.logger.info( 'removing GCC_XML build directory' ) shutil.rmtree( build_dir, True ) utils.logger.info( 'removing GCC_XML build directory - done' ) if __name__ == "__main__": + config.gccxml_install_dir = utils.ask_directory( "Select directory GCC_XML will be installed in" ) if not config.gccxml_install_dir: utils.logger.info( 'If you want to install GCC_XML you have to provide a directory it will be installed in.' ) sys.exit(1) else: utils.logger.info( 'GCC_XML will be installed in "%s" directory.' % config.gccxml_install_dir) - #decompressing all archives - for arch in config.archives.all: - utils.logger.info( 'extracting "%s"' % arch ) - tarfile.TarFile( arch, "r" ).extractall( config.working_dir ) - utils.logger.info( 'extracting "%s" - done' % arch ) - build_gccxml() + + utils.logger.info( 'creating temporal directory ...') + working_dir = tempfile.mkdtemp( dir=tempfile.gettempdir() ) + utils.logger.info( 'creating temporal directory - done( "%s" )' % working_dir) - for arch in config.archives.all: - x_dir = os.path.join( config.working_dir, os.path.splitext( arch )[0] ) - utils.logger.info( 'removing "%s" directory' % x_dir ) - shutil.rmtree( x_dir ) - utils.logger.info( 'removing "%s" directory - done' % x_dir ) + try: + #decompressing all archives + for arch in config.archives.all: + utils.logger.info( 'extracting "%s"' % arch ) + utils.tar_extract_all( arch, working_dir ) + utils.logger.info( 'extracting "%s" - done' % arch ) + build_gccxml(working_dir) + + finally: + utils.logger.info( 'removing temporal directory "%s"' % working_dir ) + shutil.rmtree( working_dir ) + utils.logger.info( 'removing temporal directory "%s" - done' % working_dir ) utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) Modified: graphical_installer/utils.py =================================================================== --- graphical_installer/utils.py 2007-01-02 08:18:14 UTC (rev 829) +++ graphical_installer/utils.py 2007-01-02 20:17:54 UTC (rev 830) @@ -1,9 +1,22 @@ import os import sys +import tarfile import logging import Tkinter import tkFileDialog + +def __create_logger(): + logger = logging.getLogger('install') + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger + +logger = __create_logger() + + def ask_directory(title, root=None): created = False if not root: @@ -15,13 +28,33 @@ root.destroy() return dir_ +def tar_extract_all( archive, destination_dir ): + tar = tarfile.TarFile( archive, "r" ) + for tarinfo in tar.getmembers(): + if tarinfo.isdir(): + os.makedirs(os.path.join(destination_dir, tarinfo.name), 0777) + else: + tar.extract(tarinfo, destination_dir) -def __create_logger(): - logger = logging.getLogger('install') - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - return logger - -logger = __create_logger() +def execute( command, *args, **keywd): + global logger + cmd_line = [ command ] + for key, value in keywd.items(): + cmd_line.append( '--%s=%s' % ( key, value ) ) + cmd_line.extend( args ) + cmd = ' '.join( cmd_line ) + logger.info( 'executing command: %s' % cmd ) + input, output = os.popen4( cmd ) + input.close() + reports = [] + while True: + data = output.readline() + logger.info( data ) + if not data: + break + exit_status = output.close() + if None is exit_status: + exit_status = 0 + else: + logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) + return exit_status This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |