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