[pygccxml-commit] SF.net SVN: pygccxml: [1034] installers
Brought to you by:
mbaas,
roman_yakovenko
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. |