[pygccxml-commit] SF.net SVN: pygccxml: [836] installers/install_gccxml.py
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-01-02 21:33:33
|
Revision: 836 http://svn.sourceforge.net/pygccxml/?rev=836&view=rev Author: roman_yakovenko Date: 2007-01-02 13:33:29 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Removed Paths: ------------- installers/install_gccxml.py Deleted: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-01-02 21:32:53 UTC (rev 835) +++ installers/install_gccxml.py 2007-01-02 21:33:29 UTC (rev 836) @@ -1,115 +0,0 @@ -#step 1 - extract cmake -import os -import re -import sys -import utils -import config -import shutil -import tarfile -import tkFileDialog - -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(): - 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] ) - build_dir = gccxml_src_dir + '-build' - - if not os.path.exists( build_dir ): - utils.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) - os.makedirs( build_dir ) - utils.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) - else: - utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) - - if os.path.exists( config.gccxml_install_dir ): - utils.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) - shutil.rmtree( config.gccxml_install_dir ) - utils.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) - else: - utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) - - os.chdir( build_dir ) - - cmake = os.path.join( - config.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 ) - - execute( config.cmake.native_build ) - if 'win32' == sys.platform: - #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() - utils.logger.info( 'copying GCC_XML files to the install directory' ) - 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.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() - - 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 ) - - 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.' ) - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |