Thread: [pygccxml-commit] SF.net SVN: pygccxml: [833] installers
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-01-02 20:54:01
|
Revision: 833 http://svn.sourceforge.net/pygccxml/?rev=833&view=rev Author: roman_yakovenko Date: 2007-01-02 12:54:01 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Added Paths: ----------- installers/install_gccxml.py Removed Paths: ------------- installers/setup.py Copied: installers/install_gccxml.py (from rev 831, installers/setup.py) =================================================================== --- installers/install_gccxml.py (rev 0) +++ installers/install_gccxml.py 2007-01-02 20:54:01 UTC (rev 833) @@ -0,0 +1,115 @@ +#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.' ) + Deleted: installers/setup.py =================================================================== --- installers/setup.py 2007-01-02 20:22:44 UTC (rev 832) +++ installers/setup.py 2007-01-02 20:54:01 UTC (rev 833) @@ -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. |
From: <rom...@us...> - 2007-01-02 21:34:10
|
Revision: 837 http://svn.sourceforge.net/pygccxml/?rev=837&view=rev Author: roman_yakovenko Date: 2007-01-02 13:34:10 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Added Paths: ----------- installers/install_gccxml.py Removed Paths: ------------- installers/install_gccxml.1.py Deleted: installers/install_gccxml.1.py =================================================================== --- installers/install_gccxml.1.py 2007-01-02 21:33:29 UTC (rev 836) +++ installers/install_gccxml.1.py 2007-01-02 21:34:10 UTC (rev 837) @@ -1,99 +0,0 @@ -#step 1 - extract cmake -import os -import re -import sys -import utils -import config -import shutil -import tempfile - -def build_gccxml(working_dir): - utils.logger.info( 'create environment for building GCC_XML' ) - 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 ): - 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( working_dir - , os.path.splitext( config.archives.cmake )[0] - , 'bin' - , 'cmake' ) - - utils.execute( cmake - , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir - , '-DCMAKE_BUILD_TYPE=release' - , '-G "%s"' % config.cmake.generator - , gccxml_src_dir ) - - utils.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: - 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__": - if 2 == len(sys.argv): - config.gccxml_install_dir = sys.argv[1] - else: - 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) - - utils.logger.info( 'creating temporal directory ...') - working_dir = tempfile.mkdtemp( dir=tempfile.gettempdir() ) - utils.logger.info( 'creating temporal directory - done( "%s" )' % working_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.' ) - Copied: installers/install_gccxml.py (from rev 835, installers/install_gccxml.1.py) =================================================================== --- installers/install_gccxml.py (rev 0) +++ installers/install_gccxml.py 2007-01-02 21:34:10 UTC (rev 837) @@ -0,0 +1,99 @@ +#step 1 - extract cmake +import os +import re +import sys +import utils +import config +import shutil +import tempfile + +def build_gccxml(working_dir): + utils.logger.info( 'create environment for building GCC_XML' ) + 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 ): + 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( working_dir + , os.path.splitext( config.archives.cmake )[0] + , 'bin' + , 'cmake' ) + + utils.execute( cmake + , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir + , '-DCMAKE_BUILD_TYPE=release' + , '-G "%s"' % config.cmake.generator + , gccxml_src_dir ) + + utils.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: + 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__": + if 2 == len(sys.argv): + config.gccxml_install_dir = sys.argv[1] + else: + 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) + + utils.logger.info( 'creating temporal directory ...') + working_dir = tempfile.mkdtemp( dir=tempfile.gettempdir() ) + utils.logger.info( 'creating temporal directory - done( "%s" )' % working_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.' ) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-03 18:14:40
|
Revision: 839 http://svn.sourceforge.net/pygccxml/?rev=839&view=rev Author: roman_yakovenko Date: 2007-01-03 10:14:34 -0800 (Wed, 03 Jan 2007) Log Message: ----------- fixing some strange behaviour with SVN Added Paths: ----------- installers/utils.1.py Removed Paths: ------------- installers/utils.py Added: installers/utils.1.py =================================================================== --- installers/utils.1.py (rev 0) +++ installers/utils.1.py 2007-01-03 18:14:34 UTC (rev 839) @@ -0,0 +1,62 @@ +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: + root = Tkinter.Tk() + root.withdraw() + created = True + dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) + if created: + 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 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 + + Deleted: installers/utils.py =================================================================== --- installers/utils.py 2007-01-02 21:34:25 UTC (rev 838) +++ installers/utils.py 2007-01-03 18:14:34 UTC (rev 839) @@ -1,27 +0,0 @@ -import os -import sys -import logging -import Tkinter -import tkFileDialog - -def ask_directory(title, root=None): - created = False - if not root: - root = Tkinter.Tk() - root.withdraw() - created = True - dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) - 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() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-03 18:15:10
|
Revision: 840 http://svn.sourceforge.net/pygccxml/?rev=840&view=rev Author: roman_yakovenko Date: 2007-01-03 10:15:11 -0800 (Wed, 03 Jan 2007) Log Message: ----------- fixing some strange behaviour with SVN Added Paths: ----------- installers/utils.py Removed Paths: ------------- installers/utils.1.py Deleted: installers/utils.1.py =================================================================== --- installers/utils.1.py 2007-01-03 18:14:34 UTC (rev 839) +++ installers/utils.1.py 2007-01-03 18:15:11 UTC (rev 840) @@ -1,62 +0,0 @@ -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: - root = Tkinter.Tk() - root.withdraw() - created = True - dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) - if created: - 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 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 - - Copied: installers/utils.py (from rev 839, installers/utils.1.py) =================================================================== --- installers/utils.py (rev 0) +++ installers/utils.py 2007-01-03 18:15:11 UTC (rev 840) @@ -0,0 +1,62 @@ +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: + root = Tkinter.Tk() + root.withdraw() + created = True + dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) + if created: + 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 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. |
From: <rom...@us...> - 2007-04-29 07:58:35
|
Revision: 1024 http://svn.sourceforge.net/pygccxml/?rev=1024&view=rev Author: roman_yakovenko Date: 2007-04-29 00:58:36 -0700 (Sun, 29 Apr 2007) Log Message: ----------- Modified Paths: -------------- installers/install_gccxml.py installers/utils.py Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-04-29 06:37:59 UTC (rev 1023) +++ installers/install_gccxml.py 2007-04-29 07:58:36 UTC (rev 1024) @@ -24,9 +24,7 @@ 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 ) + utils.rmtree_safe( config.gccxml_install_dir ) else: utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) @@ -75,9 +73,7 @@ if not os.path.exists( ff_bin ): shutil.copyfile( ff_shared, ff_bin ) - utils.logger.info( 'removing GCC_XML build directory' ) - shutil.rmtree( build_dir, True ) - utils.logger.info( 'removing GCC_XML build directory - done' ) + utils.rmtree_safe( build_dir ) def install(): if 2 == len(sys.argv): @@ -104,15 +100,13 @@ 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.rmtree_safe( 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.' ) def create_dist_package(): - working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) + working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) try: gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) @@ -121,7 +115,8 @@ utils.logger.info( 'coping gccxml directory - done' ) #TODO: remove cvs files from the directory utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) - tar = tarfile.open( os.path.join( working_dir, config.archives.gccxml ), "w" ) + gccxml_tar_file = os.path.join( working_dir, config.archives.gccxml ) + tar = tarfile.open( gccxml_tar_file, "w" ) tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) tar.close() utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) @@ -146,8 +141,9 @@ shutil.move( cmake_dir, cmake_archive_dir ) utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) - tar = tarfile.open( os.path.join( working_dir, config.archives.cmake ), "w" ) - tar.add( cmake_archive_dir, config.archives.cmake ) + cmake_tar_file = os.path.join( working_dir, config.archives.cmake ) + tar = tarfile.open( cmake_tar_file, "w" ) + tar.add( cmake_archive_dir, os.path.splitext( config.archives.cmake )[0] ) tar.close() utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) @@ -171,8 +167,16 @@ utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) finally: pass - #shutil.rmtree( working_dir ) + #create final zip file + package_dir = os.path.join( os.path.split( working_dir )[0] + , 'gccxml_%s_installer' % sys.platform ) + utils.rmtree_safe( package_dir ) + shutil.copytree( working_dir, package_dir ) + utils.rmtree_safe( os.path.join( package_dir, '.svn' ) ) + os.remove( cmake_tar_file ) + os.remove( gccxml_tar_file ) + if __name__ == "__main__": - #install() - create_dist_package() + install() + #create_dist_package() Modified: installers/utils.py =================================================================== --- installers/utils.py 2007-04-29 06:37:59 UTC (rev 1023) +++ installers/utils.py 2007-04-29 07:58:36 UTC (rev 1024) @@ -1,5 +1,6 @@ import os import sys +import stat import shutil import tarfile import zipfile @@ -63,10 +64,14 @@ def rmtree_safe( dir_ ): + for root, dirs, files in os.walk(dir_): + map( lambda f: os.chmod( os.path.join( root, f ), stat.S_IWRITE ) + , files ) + if not os.path.exists( dir_ ): return logger.info( 'removing "%s" directory ' % dir_ ) - shutil.rmtree( dir_ ) + shutil.rmtree( dir_, True ) logger.info( 'removing "%s" directory - done' % dir_ ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-08-09 06:08:02
|
Revision: 1094 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1094&view=rev Author: roman_yakovenko Date: 2007-08-08 23:08:01 -0700 (Wed, 08 Aug 2007) Log Message: ----------- updating gccxml installer Modified Paths: -------------- installers/config.py installers/install_gccxml.py Modified: installers/config.py =================================================================== --- installers/config.py 2007-08-07 19:24:02 UTC (rev 1093) +++ installers/config.py 2007-08-09 06:08:01 UTC (rev 1094) @@ -17,8 +17,8 @@ unzip = None gccxml_cvs_dir = None - cmake_windows = 'cmake-2.4.6-win32-x86.zip' - cmake_linux = 'cmake-2.4.6-Linux-i386.tar.gz' + cmake_windows = 'cmake-2.4.7-win32-x86.zip' + cmake_linux = 'cmake-2.4.7-Linux-i386.tar.gz' if 'win32' == sys.platform: gccxml_cvs_dir = r'D:\dev\gccxml_cvs\gccxml' unzip = 'unzip -d $target_dir $archive' #command line to run in order to unzip the file Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-08-07 19:24:02 UTC (rev 1093) +++ installers/install_gccxml.py 2007-08-09 06:08:01 UTC (rev 1094) @@ -24,9 +24,12 @@ utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) if os.path.exists( config.gccxml_install_dir ): - utils.rmtree_safe( config.gccxml_install_dir ) + if os.listdir( config.gccxml_install_dir ) \ + and 'gccxml' not in os.path.split( config.gccxml_install_dir )[1].lower(): + utils.logger.info( "GCC_XML install directory '%s' already exists." % config.gccxml_install_dir) + config.gccxml_install_dir = os.path.join( config.gccxml_install_dir, 'gccxml' ) else: - utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) + utils.logger.info( "GCC_XML install directory '%s' doesn't exist" % config.gccxml_install_dir) os.chdir( build_dir ) cmake = os.path.join( working_dir @@ -90,7 +93,11 @@ gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) + utils.logger.info( 'coping gccxml directory ' ) + if os.path.realpath( config.setup_builder.gccxml_cvs_dir ) \ + != os.path.realpath( gccxml_cvs_dir_path ): + utils.rmtree_safe( gccxml_cvs_dir_path ) shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) utils.logger.info( 'coping gccxml directory - done' ) #TODO: remove cvs files from the directory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-29 06:38:03
|
Revision: 1023 http://svn.sourceforge.net/pygccxml/?rev=1023&view=rev Author: roman_yakovenko Date: 2007-04-28 23:37:59 -0700 (Sat, 28 Apr 2007) Log Message: ----------- few changes to create installer automatically Modified Paths: -------------- installers/config.py installers/install_gccxml.py installers/utils.py Modified: installers/config.py =================================================================== --- installers/config.py 2007-04-25 17:14:13 UTC (rev 1022) +++ installers/config.py 2007-04-29 06:37:59 UTC (rev 1023) @@ -1,3 +1,4 @@ +import os import sys import tempfile @@ -6,6 +7,18 @@ #temporal directory to extract archives and create executables working_dir = tempfile.gettempdir() +class setup_builder: + #final\destination directory for ditributable package + dist_dir = os.path.split( sys.argv[0] )[0] + unzip = None + + gccxml_cvs_dir = None + cmake_windows = 'cmake-2.4.6-win32-x86.zip' + cmake_linux = 'cmake-2.4.6-Linux-i386.tar.gz' + if 'win32' == sys.platform: + gccxml_cvs_dir = r'D:\dev\gccxml_cvs\gccxml' + unzip = 'unzip -d $target_dir $archive' #command line to run in order to unzip the file + class archives: cmake = 'cmake-%s.tar' % sys.platform gccxml = 'gccxml-cvs.tar' @@ -32,4 +45,3 @@ compiler="gcc" generator = 'Unix Makefiles' native_build = 'make' - Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-04-25 17:14:13 UTC (rev 1022) +++ installers/install_gccxml.py 2007-04-29 06:37:59 UTC (rev 1023) @@ -5,8 +5,12 @@ import utils import config import shutil +import urllib +import string +import tarfile import tempfile + def build_gccxml(working_dir): utils.logger.info( 'create environment for building GCC_XML' ) gccxml_src_dir = os.path.join( working_dir, os.path.splitext( config.archives.gccxml )[0] ) @@ -75,7 +79,7 @@ shutil.rmtree( build_dir, True ) utils.logger.info( 'removing GCC_XML build directory - done' ) -if __name__ == "__main__": +def install(): if 2 == len(sys.argv): config.gccxml_install_dir = sys.argv[1] else: @@ -107,3 +111,68 @@ 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.' ) +def create_dist_package(): + working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) + try: + gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] + gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) + utils.logger.info( 'coping gccxml directory ' ) + shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) + utils.logger.info( 'coping gccxml directory - done' ) + #TODO: remove cvs files from the directory + utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) + tar = tarfile.open( os.path.join( working_dir, config.archives.gccxml ), "w" ) + tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) + tar.close() + utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) + + if 'win32' == sys.platform: + cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_windows ) + + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_windows ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_windows + , cmake_zip_file ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_windows ) + + cmake_dir = os.path.splitext( cmake_zip_file )[0] + + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_windows ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_windows ) + + cmake_archive_dir = os.path.join( working_dir, os.path.splitext( config.archives.cmake )[0] ) + + shutil.move( cmake_dir, cmake_archive_dir ) + utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) + tar = tarfile.open( os.path.join( working_dir, config.archives.cmake ), "w" ) + tar.add( cmake_archive_dir, config.archives.cmake ) + tar.close() + utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) + + #clean after yourself + os.remove( cmake_zip_file ) + utils.rmtree_safe( cmake_dir ) + utils.rmtree_safe( cmake_archive_dir ) + utils.rmtree_safe( gccxml_cvs_dir_path ) + + else: #linux + cmake_linux = os.path.join( working_dir, config.setup_builder.cmake_linux ) + if not os.path.exists( cmake_linux ): + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_linux ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_linux + , cmake_linux ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_linux ) + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_linux ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_linux + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) + finally: + pass + #shutil.rmtree( working_dir ) + +if __name__ == "__main__": + #install() + create_dist_package() Modified: installers/utils.py =================================================================== --- installers/utils.py 2007-04-25 17:14:13 UTC (rev 1022) +++ installers/utils.py 2007-04-29 06:37:59 UTC (rev 1023) @@ -1,6 +1,8 @@ import os import sys +import shutil import tarfile +import zipfile import logging import Tkinter import tkFileDialog @@ -9,7 +11,7 @@ def __create_logger(): logger = logging.getLogger('install') handler = logging.StreamHandler(sys.stdout) - handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + handler.setFormatter( logging.Formatter( '%(message)s' ) ) logger.addHandler(handler) logger.setLevel(logging.INFO) return logger @@ -59,4 +61,12 @@ logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) return exit_status + +def rmtree_safe( dir_ ): + if not os.path.exists( dir_ ): + return + logger.info( 'removing "%s" directory ' % dir_ ) + shutil.rmtree( dir_ ) + logger.info( 'removing "%s" directory - done' % dir_ ) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-04-29 19:15:16
|
Revision: 1025 http://svn.sourceforge.net/pygccxml/?rev=1025&view=rev Author: roman_yakovenko Date: 2007-04-29 12:15:15 -0700 (Sun, 29 Apr 2007) Log Message: ----------- porting installer to linux Modified Paths: -------------- installers/config.py installers/install_gccxml.py Modified: installers/config.py =================================================================== --- installers/config.py 2007-04-29 07:58:36 UTC (rev 1024) +++ installers/config.py 2007-04-29 19:15:15 UTC (rev 1025) @@ -9,7 +9,11 @@ class setup_builder: #final\destination directory for ditributable package - dist_dir = os.path.split( sys.argv[0] )[0] + dist_dir = os.path.join( + os.path.split( + os.path.abspath( + os.path.dirname( sys.modules[__name__].__file__) ) )[0] + , 'gccxml_%s_installer' % sys.platform ) unzip = None gccxml_cvs_dir = None @@ -18,7 +22,11 @@ if 'win32' == sys.platform: gccxml_cvs_dir = r'D:\dev\gccxml_cvs\gccxml' unzip = 'unzip -d $target_dir $archive' #command line to run in order to unzip the file + else: #linux + gccxml_cvs_dir = r'/home/roman/gccxml-cvs' + unzip = 'tar -xvvzf $archive' #command line to run in order to unzip the file + class archives: cmake = 'cmake-%s.tar' % sys.platform gccxml = 'gccxml-cvs.tar' Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-04-29 07:58:36 UTC (rev 1024) +++ installers/install_gccxml.py 2007-04-29 19:15:15 UTC (rev 1025) @@ -107,67 +107,73 @@ def create_dist_package(): working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) - try: - gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] - gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) - utils.logger.info( 'coping gccxml directory ' ) - shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) - utils.logger.info( 'coping gccxml directory - done' ) - #TODO: remove cvs files from the directory - utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) - gccxml_tar_file = os.path.join( working_dir, config.archives.gccxml ) - tar = tarfile.open( gccxml_tar_file, "w" ) - tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) - tar.close() - utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) + + gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] + gccxml_cvs_dir_path = os.path.join( working_dir, gccxml_cvs_dir_name ) + utils.logger.info( 'coping gccxml directory ' ) + shutil.copytree( config.setup_builder.gccxml_cvs_dir, gccxml_cvs_dir_path ) + utils.logger.info( 'coping gccxml directory - done' ) + #TODO: remove cvs files from the directory + utils.logger.info( 'archiving gccxml "%s" directory ' % gccxml_cvs_dir_path ) + gccxml_tar_file = os.path.join( working_dir, config.archives.gccxml ) + tar = tarfile.open( gccxml_tar_file, "w" ) + tar.add( gccxml_cvs_dir_path, gccxml_cvs_dir_name ) + tar.close() + utils.logger.info( 'archiving gccxml "%s" directory - done' % gccxml_cvs_dir_path ) + + if 'win32' == sys.platform: + cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_windows ) + + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_windows ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_windows + , cmake_zip_file ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_windows ) + + cmake_dir = os.path.splitext( cmake_zip_file )[0] + + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_windows ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_windows ) + - if 'win32' == sys.platform: - cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_windows ) + else: #linux + cmake_zip_file = os.path.join( working_dir, config.setup_builder.cmake_linux ) - utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_windows ) - urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_windows - , cmake_zip_file ) - utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_windows ) + utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_linux ) + urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_linux + , cmake_zip_file ) + utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_linux ) - cmake_dir = os.path.splitext( cmake_zip_file )[0] - - utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_windows ) - unzip_cmd = string.Template( config.setup_builder.unzip ) - utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file - , target_dir='"%s"' % working_dir ) ) - utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_windows ) + cmake_dir = os.path.splitext( cmake_zip_file )[0] + if 'win32' != sys.platform: + cmake_dir = os.path.splitext( cmake_dir )[0] #remove xx.tar.gz + + utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_linux ) + unzip_cmd = string.Template( config.setup_builder.unzip ) + utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_zip_file + , target_dir='"%s"' % working_dir ) ) + utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) - cmake_archive_dir = os.path.join( working_dir, os.path.splitext( config.archives.cmake )[0] ) + cmake_archive_dir = os.path.join( working_dir, os.path.splitext( config.archives.cmake )[0] ) + if 'win32' != sys.platform: + cmake_archive_dir = os.path.splitext( cmake_archive_dir )[0] #remove xx.tar.gz - shutil.move( cmake_dir, cmake_archive_dir ) - utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) - cmake_tar_file = os.path.join( working_dir, config.archives.cmake ) - tar = tarfile.open( cmake_tar_file, "w" ) - tar.add( cmake_archive_dir, os.path.splitext( config.archives.cmake )[0] ) - tar.close() - utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) - - #clean after yourself - os.remove( cmake_zip_file ) - utils.rmtree_safe( cmake_dir ) - utils.rmtree_safe( cmake_archive_dir ) - utils.rmtree_safe( gccxml_cvs_dir_path ) - - else: #linux - cmake_linux = os.path.join( working_dir, config.setup_builder.cmake_linux ) - if not os.path.exists( cmake_linux ): - utils.logger.info( 'downloading "%s"' % config.setup_builder.cmake_linux ) - urllib.urlretrieve( 'http://www.cmake.org/files/v2.4/' + config.setup_builder.cmake_linux - , cmake_linux ) - utils.logger.info( 'downloading "%s" - done' % config.setup_builder.cmake_linux ) - utils.logger.info( 'unzipping "%s" file' % config.setup_builder.cmake_linux ) - unzip_cmd = string.Template( config.setup_builder.unzip ) - utils.execute( unzip_cmd.substitute( archive='"%s"' % cmake_linux - , target_dir='"%s"' % working_dir ) ) - utils.logger.info( 'unzipping "%s" file - done' % config.setup_builder.cmake_linux ) - finally: - pass - + shutil.move( cmake_dir, cmake_archive_dir ) + utils.logger.info( 'archiving cmake "%s" directory ' % cmake_archive_dir ) + cmake_tar_file = os.path.join( working_dir, config.archives.cmake ) + tar = tarfile.open( cmake_tar_file, "w" ) + tar.add( cmake_archive_dir, os.path.splitext( config.archives.cmake )[0] ) + tar.close() + utils.logger.info( 'archiving cmake "%s" directory - done' % cmake_archive_dir ) + + #clean after yourself + os.remove( cmake_zip_file ) + utils.rmtree_safe( cmake_dir ) + utils.rmtree_safe( cmake_archive_dir ) + utils.rmtree_safe( gccxml_cvs_dir_path ) + #create final zip file package_dir = os.path.join( os.path.split( working_dir )[0] , 'gccxml_%s_installer' % sys.platform ) @@ -178,5 +184,8 @@ os.remove( gccxml_tar_file ) if __name__ == "__main__": - install() - #create_dist_package() + if 2 == len( sys.argv ) and sys.argv[1] == '--build-setup': + create_dist_package() + else: + install() + # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-05-06 09:00:22
|
Revision: 1034 http://svn.sourceforge.net/pygccxml/?rev=1034&view=rev Author: roman_yakovenko Date: 2007-05-06 02:00:20 -0700 (Sun, 06 May 2007) Log Message: ----------- Modified Paths: -------------- installers/config.py installers/install_gccxml.py installers/utils.py Modified: installers/config.py =================================================================== --- installers/config.py 2007-05-05 19:19:11 UTC (rev 1033) +++ installers/config.py 2007-05-06 09:00:20 UTC (rev 1034) @@ -36,6 +36,7 @@ compiler = None generator = None native_build = None + configure_environment_script = None if 'win32' == sys.platform: from distutils import msvccompiler @@ -45,6 +46,9 @@ cc.initialize() generator = 'NMake Makefiles' native_build = '"%s" /A all' % cc.find_exe( 'nmake.exe' ) + configure_environment_script = cc.find_exe( 'vsvars32.bat' ) + if not configure_environment_script: + configure_environment_script = cc.find_exe( 'vcvars32.bat' ) cl_mapping = { 6.0 : "msvc6", 7.0 : "msvc7", 7.1 : "msvc71", 8.0 : "msvc8" } compiler = cl_mapping[ msvccompiler.get_build_version() ] else: @@ -53,3 +57,13 @@ compiler="gcc" generator = 'Unix Makefiles' native_build = 'make' + + @staticmethod + def prepare(): + if 'win32' == sys.platform: + from distutils import msvccompiler + from distutils import ccompiler + + cc = msvccompiler.MSVCCompiler() + cc.initialize() + cc.find_exe( 'vcvars32.bat' ) Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-05-05 19:19:11 UTC (rev 1033) +++ installers/install_gccxml.py 2007-05-06 09:00:20 UTC (rev 1034) @@ -29,53 +29,32 @@ utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) os.chdir( build_dir ) - cmake = os.path.join( working_dir , os.path.splitext( config.archives.cmake )[0] , 'bin' , 'cmake' ) - utils.execute( cmake - , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir - , '-DCMAKE_BUILD_TYPE=release' - , '-G "%s"' % config.cmake.generator - , gccxml_src_dir ) - + build_gccxml_cmd = utils.create_cmd( cmake + , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir + , '-DCMAKE_BUILD_TYPE=release' + #, '-G "%s"' % config.cmake.generator + , gccxml_src_dir ) + install_gccxml_cmd = utils.create_cmd( config.cmake.native_build, 'install' ) + utils.execute( build_gccxml_cmd ) utils.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: - utils.execute( config.cmake.native_build ) - utils.execute( config.cmake.native_build, 'install' ) - #for some reason not always next files are copied to the right place - bin_dir = os.path.join( config.gccxml_install_dir, 'bin' ) - share_dir = os.path.join( config.gccxml_install_dir, 'share', 'gccxml-0.7' ) - for f in ( 'gccxml_config', 'gccxml_find_flags' ): - ff_bin = os.path.join( bin_dir, f ) - ff_shared = os.path.join( share_dir, f ) - if not os.path.exists( ff_bin ): - shutil.copyfile( ff_shared, ff_bin ) + utils.execute( install_gccxml_cmd ) + + bin_dir = os.path.join( config.gccxml_install_dir, 'bin' ) + share_dir = os.path.join( config.gccxml_install_dir, 'share', 'gccxml-0.7' ) + for f in ( 'gccxml_config', 'gccxml_find_flags' ): + ff_bin = os.path.join( bin_dir, f ) + ff_shared = os.path.join( share_dir, f ) + if not os.path.exists( ff_bin ) and os.path.exists( ff_shared ): + shutil.copyfile( ff_shared, ff_bin ) - utils.rmtree_safe( build_dir ) + #utils.rmtree_safe( build_dir ) -def install(): +def install_gccxml(): if 2 == len(sys.argv): config.gccxml_install_dir = sys.argv[1] else: @@ -100,12 +79,13 @@ build_gccxml(working_dir) finally: - utils.rmtree_safe( working_dir ) + pass + #utils.rmtree_safe( 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.' ) -def create_dist_package(): +def create_setup(): working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0] @@ -183,9 +163,9 @@ os.remove( cmake_tar_file ) os.remove( gccxml_tar_file ) -if __name__ == "__main__": +if __name__ == "__main__": if 2 == len( sys.argv ) and sys.argv[1] == '--build-setup': - create_dist_package() + create_setup() else: - install() + install_gccxml() # Modified: installers/utils.py =================================================================== --- installers/utils.py 2007-05-05 19:19:11 UTC (rev 1033) +++ installers/utils.py 2007-05-06 09:00:20 UTC (rev 1034) @@ -39,13 +39,17 @@ else: tar.extract(tarinfo, destination_dir) -def execute( command, *args, **keywd): - global logger +def create_cmd( 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 ) + return cmd + +def execute( command, *args, **keywd): + global logger + cmd = create_cmd( command, *args, **keywd ) logger.info( 'executing command: %s' % cmd ) input, output = os.popen4( cmd ) input.close() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |