pygccxml-commit Mailing List for C++ Python language bindings (Page 42)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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 20:22:43
|
Revision: 832 http://svn.sourceforge.net/pygccxml/?rev=832&view=rev Author: roman_yakovenko Date: 2007-01-02 12:22:44 -0800 (Tue, 02 Jan 2007) Log Message: ----------- rename for better reflection of the directory purpose Removed Paths: ------------- graphical_installer/ 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:20:55
|
Revision: 831 http://svn.sourceforge.net/pygccxml/?rev=831&view=rev Author: roman_yakovenko Date: 2007-01-02 12:20:54 -0800 (Tue, 02 Jan 2007) Log Message: ----------- rename for better reflection of the directory purpose Added Paths: ----------- installers/ Copied: installers (from rev 829, graphical_installer) 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. |
From: <rom...@us...> - 2007-01-02 08:18:16
|
Revision: 829 http://svn.sourceforge.net/pygccxml/?rev=829&view=rev Author: roman_yakovenko Date: 2007-01-02 00:18:14 -0800 (Tue, 02 Jan 2007) Log Message: ----------- small improvement Modified Paths: -------------- website/site_creator/environment.py website/site_creator/utils.py website/templates/online/page_template.html Modified: website/site_creator/environment.py =================================================================== --- website/site_creator/environment.py 2007-01-02 08:17:13 UTC (rev 828) +++ website/site_creator/environment.py 2007-01-02 08:18:14 UTC (rev 829) @@ -21,10 +21,12 @@ production_dir = os.path.join( os.path.split( sources_root )[0], 'production' ) production_www_dir = os.path.join( production_dir, 'www') configuration_file = 'www_configuration' - templates_dir = os.path.join( development_dir, 'templates', 'offline' ) + #templates_dir = os.path.join( development_dir, 'templates', 'offline' ) templates_dir = os.path.join( development_dir, 'templates', 'online' ) site_css = 'language_binding.css' home_url = 'http://www.language-binding.net' +print settings.templates_dir + sys.path.append( os.path.join( settings.development_dir, 'tools', 'kid-svn-12-10-2006' ) ) sys.path.append( os.path.join( settings.development_dir, 'tools', 'pykleur-svn-11-11-2006' ) ) Modified: website/site_creator/utils.py =================================================================== --- website/site_creator/utils.py 2007-01-02 08:17:13 UTC (rev 828) +++ website/site_creator/utils.py 2007-01-02 08:18:14 UTC (rev 829) @@ -1,146 +1,146 @@ -import os -import sys -import shutil -import webbrowser -from sets import Set as set -from environment import settings - -class path: - def normalize( some_path ): - n = os.path.normpath( os.path.normcase( some_path ) ) - return n.replace( '\\', '/' ) - normalize = staticmethod( normalize ) - - def is_parent_and_child( root_dir, child_dir ): - root_dir = path.normalize( root_dir ) - child_dir = path.normalize( child_dir ) - return root_dir in child_dir and len( root_dir ) < len( child_dir ) - is_parent_and_child = staticmethod( is_parent_and_child ) - - def is_same( path1, path2 ): - path1 = path.normalize( path1 ) - path2 = path.normalize( path2 ) - return path1 == path2 - is_same = staticmethod( is_same ) - - def suffix( root_dir, child_dir ): - root_dir = path.normalize( root_dir ) - child_dir = path.normalize( child_dir ) - suffix = child_dir[ len( root_dir ): ] - if suffix.startswith( '/' ): - suffix = suffix[1:] - return suffix - suffix = staticmethod( suffix ) - - def production_dir( development_dir ): - development_dir = path.normalize( development_dir ) - suffix = path.suffix( settings.development_dir, development_dir ) - return path.normalize( os.path.join( settings.production_dir, suffix ) ) - production_dir = staticmethod( production_dir ) - - def development_dir( production_dir ): - production_dir = path.normalize( production_dir ) - suffix = path.suffix( settings.production_dir, production_dir ) - return path.normalize( os.path.join( settings.development_dir, suffix ) ) - development_dir = staticmethod( development_dir ) - - def components( p ): - answer = [] - root = p - while root: - root, leaf = os.path.split( root ) - if not leaf: - answer.append( root ) - break - else: - answer.append( leaf ) - - answer.reverse() - return answer - - components = staticmethod( components ) - - def common_prefix( path1, path2 ): - #Returns common prefix of 2 pathes as os path - common_prefix = '' - comp1 = path.components(path1) - comp2 = path.components(path2) - for i in range( min( len( comp1 ), len( comp2 ) ) ): - if comp1[i] != comp2[i]: - if not i: - return None - else: - return path.normalize( os.path.join( *comp1[:i] ) ) - else: - if len( comp1 ) < len( comp2 ): - return path.normalize( os.path.join( *comp1 ) ) - else: - return path.normalize( os.path.join( *comp2 ) ) - common_prefix = staticmethod( common_prefix ) - - def relative_path( from_path, to_path ): - from_path = path.normalize( from_path ) - to_path = path.normalize( to_path ) - if from_path == to_path: - return '.' - - common_prefix = path.common_prefix( from_path, to_path ) - if not common_prefix: - return to_path #this could happen on windows machine - - comm_pref_components = path.components( common_prefix ) - fp_components = path.components( from_path ) - tp_components = path.components( to_path ) - if comm_pref_components == fp_components: - return os.path.join( '.', *tp_components[ len( fp_components ): ] ) - else: - #move up until common prefix - temp = ['..'] * ( len( fp_components ) - len( comm_pref_components ) ) - #move down from common component - temp.extend( tp_components[ len( comm_pref_components ): ] ) - relative_path = os.path.join( *temp ) - return relative_path.replace( '\\', '/' ) - relative_path = staticmethod( relative_path ) - - def copytree(src, dst, symlinks=False): - if not os.path.exists( dst ): - os.mkdir(dst) - for name in os.listdir(src): - srcname = os.path.join(src, name) - dstname = os.path.join(dst, name) - if symlinks and os.path.islink(srcname): - linkto = os.readlink(srcname) - os.symlink(linkto, dstname) - elif os.path.isdir(srcname): - name_only = os.path.split( srcname )[1] - if name.startswith('.'): - continue - path.copytree(srcname, dstname, symlinks) - else: - shutil.copy2(srcname, dstname) - copytree = staticmethod( copytree ) - -def preview_html( html ): - f = os.path.join( settings.temp_dir, 'preview.html' ) - f = file( f, 'w+b' ) - f.write( html ) - f.close() - -def take_sys_snapshot(): - return dict( modules=set( sys.modules.keys() ) - , path=set( sys.path ) ) - -def restore_sys_snapshot( snapshot ): - new_modules = set( sys.modules.keys() ).difference( snapshot['modules'] ) - for x in new_modules: - while x in sys.modules: - sys.modules.pop( x ) - new_paths = set( sys.path ).difference( snapshot['path'] ) - for x in new_paths: - while x in sys.path: - sys.path.remove( x ) - -if __name__ == '__main__': - print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo\acmo.dsp', r'C:\AC_SERVER_III_V3_1\3rdParty\Boost' ) - print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo', r'C:\AC_SERVER_III_V3_1\acmo\xyz' ) - \ No newline at end of file +import os +import sys +import shutil +import webbrowser +from sets import Set as set +from environment import settings + +class path: + def normalize( some_path ): + n = os.path.normpath( os.path.normcase( some_path ) ) + return n.replace( '\\', '/' ) + normalize = staticmethod( normalize ) + + def is_parent_and_child( root_dir, child_dir ): + root_dir = path.normalize( root_dir ) + child_dir = path.normalize( child_dir ) + return root_dir in child_dir and len( root_dir ) < len( child_dir ) + is_parent_and_child = staticmethod( is_parent_and_child ) + + def is_same( path1, path2 ): + path1 = path.normalize( path1 ) + path2 = path.normalize( path2 ) + return path1 == path2 + is_same = staticmethod( is_same ) + + def suffix( root_dir, child_dir ): + root_dir = path.normalize( root_dir ) + child_dir = path.normalize( child_dir ) + suffix = child_dir[ len( root_dir ): ] + if suffix.startswith( '/' ): + suffix = suffix[1:] + return suffix + suffix = staticmethod( suffix ) + + def production_dir( development_dir ): + development_dir = path.normalize( development_dir ) + suffix = path.suffix( settings.development_dir, development_dir ) + return path.normalize( os.path.join( settings.production_dir, suffix ) ) + production_dir = staticmethod( production_dir ) + + def development_dir( production_dir ): + production_dir = path.normalize( production_dir ) + suffix = path.suffix( settings.production_dir, production_dir ) + return path.normalize( os.path.join( settings.development_dir, suffix ) ) + development_dir = staticmethod( development_dir ) + + def components( p ): + answer = [] + root = p + while root: + root, leaf = os.path.split( root ) + if not leaf: + answer.append( root ) + break + else: + answer.append( leaf ) + + answer.reverse() + return answer + + components = staticmethod( components ) + + def common_prefix( path1, path2 ): + #Returns common prefix of 2 pathes as os path + common_prefix = '' + comp1 = path.components(path1) + comp2 = path.components(path2) + for i in range( min( len( comp1 ), len( comp2 ) ) ): + if comp1[i] != comp2[i]: + if not i: + return None + else: + return path.normalize( os.path.join( *comp1[:i] ) ) + else: + if len( comp1 ) < len( comp2 ): + return path.normalize( os.path.join( *comp1 ) ) + else: + return path.normalize( os.path.join( *comp2 ) ) + common_prefix = staticmethod( common_prefix ) + + def relative_path( from_path, to_path ): + from_path = path.normalize( from_path ) + to_path = path.normalize( to_path ) + if from_path == to_path: + return '.' + + common_prefix = path.common_prefix( from_path, to_path ) + if not common_prefix: + return to_path #this could happen on windows machine + + comm_pref_components = path.components( common_prefix ) + fp_components = path.components( from_path ) + tp_components = path.components( to_path ) + if comm_pref_components == fp_components: + return os.path.join( '.', *tp_components[ len( fp_components ): ] ) + else: + #move up until common prefix + temp = ['..'] * ( len( fp_components ) - len( comm_pref_components ) ) + #move down from common component + temp.extend( tp_components[ len( comm_pref_components ): ] ) + relative_path = os.path.join( *temp ) + return relative_path.replace( '\\', '/' ) + relative_path = staticmethod( relative_path ) + + def copytree(src, dst, symlinks=False): + if not os.path.exists( dst ): + os.makedirs(dst) + for name in os.listdir(src): + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + if symlinks and os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + name_only = os.path.split( srcname )[1] + if name.startswith('.'): + continue + path.copytree(srcname, dstname, symlinks) + else: + shutil.copy2(srcname, dstname) + copytree = staticmethod( copytree ) + +def preview_html( html ): + f = os.path.join( settings.temp_dir, 'preview.html' ) + f = file( f, 'w+b' ) + f.write( html ) + f.close() + +def take_sys_snapshot(): + return dict( modules=set( sys.modules.keys() ) + , path=set( sys.path ) ) + +def restore_sys_snapshot( snapshot ): + new_modules = set( sys.modules.keys() ).difference( snapshot['modules'] ) + for x in new_modules: + while x in sys.modules: + sys.modules.pop( x ) + new_paths = set( sys.path ).difference( snapshot['path'] ) + for x in new_paths: + while x in sys.path: + sys.path.remove( x ) + +if __name__ == '__main__': + print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo\acmo.dsp', r'C:\AC_SERVER_III_V3_1\3rdParty\Boost' ) + print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo', r'C:\AC_SERVER_III_V3_1\acmo\xyz' ) + Modified: website/templates/online/page_template.html =================================================================== --- website/templates/online/page_template.html 2007-01-02 08:17:13 UTC (rev 828) +++ website/templates/online/page_template.html 2007-01-02 08:18:14 UTC (rev 829) @@ -26,7 +26,7 @@ </div> <div class="right"> <!-- Google CSE Search Box Begins --> - <form id="searchbox_017839341659215598962:rpxttlw8grw" action="http://www.google.com/cse"> + <form action="http://www.google.com/cse" id="searchbox_017839341659215598962:rpxttlw8grw"> <input type="hidden" name="cx" value="017839341659215598962:rpxttlw8grw" /> <input name="q" type="text" size="25" /> <input type="submit" name="sa" value="Search" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 08:17:15
|
Revision: 828 http://svn.sourceforge.net/pygccxml/?rev=828&view=rev Author: roman_yakovenko Date: 2007-01-02 00:17:13 -0800 (Tue, 02 Jan 2007) Log Message: ----------- fixing compilation bug Modified Paths: -------------- pyplusplus_dev/docs/links.rest pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py pyplusplus_dev/pyplusplus/code_repository/call_policies.py Modified: pyplusplus_dev/docs/links.rest =================================================================== --- pyplusplus_dev/docs/links.rest 2007-01-01 21:49:42 UTC (rev 827) +++ pyplusplus_dev/docs/links.rest 2007-01-02 08:17:13 UTC (rev 828) @@ -45,6 +45,9 @@ * http://www.google.com :-) + This site uses Google custom search engine, turned to provide better results + when you search for materials related to `Boost.Python`_ library. + * http://boost.org/libs/python/doc/index.html - tutorials, FAQs, reference manuals @@ -73,6 +76,26 @@ .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Py++` : ./pyplusplus.html + +---------------------------------- +Libraries inspired by Boost.Python +---------------------------------- + +* `Luabind`_ - interfacing C++ and `Lua`_ + +.. _`Luabind` : http://www.rasterbar.com/products/luabind/docs.html +.. _`Lua` : http://www.lua.org/ + +* `Pyd`_ - interfacing C++ and `D programming language`_ + +.. _`Pyd` : http://pyd.dsource.org/index.html +.. _`D programming language` : http://www.digitalmars.com/d/ + +* `Sq Plus`_ - interfacing C++ and `Squirrel`_ + +.. _`Sq Plus` : http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html +.. _`Squirrel` : http://wiki.squirrel-lang.org/ + .. Local Variables: mode: indented-text Modified: pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2007-01-01 21:49:42 UTC (rev 827) +++ pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2007-01-02 08:17:13 UTC (rev 828) @@ -134,7 +134,8 @@ else: self.__return_vars.insert( 0 , declarations.call_invocation.join( - declarations.templates.join( make_object, [self.__call_policy_alias] ) + declarations.templates.join( make_object + , [self.__call_policy_alias, self.__result_var.type.decl_string] ) , [self.__result_var.name] ) ) if 0 == len( self.__return_vars ): Modified: pyplusplus_dev/pyplusplus/code_repository/call_policies.py =================================================================== --- pyplusplus_dev/pyplusplus/code_repository/call_policies.py 2007-01-01 21:49:42 UTC (rev 827) +++ pyplusplus_dev/pyplusplus/code_repository/call_policies.py 2007-01-02 08:17:13 UTC (rev 828) @@ -71,7 +71,7 @@ }; template< typename CallPolicies, class T > -bpl::object make_object( T const & x ){ +bpl::object make_object( T x ){ //constructs object using CallPolicies result_converter typedef BOOST_DEDUCED_TYPENAME CallPolicies::result_converter:: template apply< T >::type result_converter_t; result_converter_t rc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-01 21:49:45
|
Revision: 827 http://svn.sourceforge.net/pygccxml/?rev=827&view=rev Author: roman_yakovenko Date: 2007-01-01 13:49:42 -0800 (Mon, 01 Jan 2007) Log Message: ----------- fixing few issues with web site Modified Paths: -------------- website/site_creator/environment.py website/templates/online/page_template.html Modified: website/site_creator/environment.py =================================================================== --- website/site_creator/environment.py 2007-01-01 05:43:59 UTC (rev 826) +++ website/site_creator/environment.py 2007-01-01 21:49:42 UTC (rev 827) @@ -7,27 +7,24 @@ pygccxml_sources_root = None pyplusplus_sources_root = None pydsc_sources_root = None - if sys.platform == 'win32': - project_root = 'd:/dev/language-binding/sources/website' - sources_root = 'd:/dev/language-binding/sources' - pygccxml_sources_root = 'd:/dev/language-binding/sources/pygccxml_dev' - pyplusplus_sources_root = 'd:/dev/language-binding/sources/pyplusplus_dev' - pydsc_sources_root = 'd:/dev/language-binding/sources/pydsc_dev' - else: - project_root = '/home/roman/language-binding/website' - sources_root = '/home/roman/language-binding/sources' - pygccxml_sources_root = '/home/roman/language-binding/sources/pygccxml_dev' - pyplusplus_sources_root = '/home/roman/language-binding/sources/pyplusplus_dev' - pydsc_sources_root = '/home/roman/language-binding/sources/pydsc_dev' + + project_root = os.path.split( os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) ) )[0] + + sources_root = os.path.split( project_root )[0] + pygccxml_sources_root = os.path.join( sources_root, 'pygccxml_dev' ) + pyplusplus_sources_root = os.path.join( sources_root, 'pyplusplus_dev' ) + pydsc_sources_root = os.path.join( sources_root, 'pydsc_dev' ) + temp_dir = os.path.join( project_root, 'dev', 'tmp' ) - development_dir = project_root#os.path.join( project_root, 'dev') + development_dir = project_root development_www_dir = os.path.join( development_dir, 'www') - production_dir = r'D:\dev\language-binding\website\production'#os.path.join( project_root, 'production') + production_dir = os.path.join( os.path.split( sources_root )[0], 'production' ) production_www_dir = os.path.join( production_dir, 'www') configuration_file = 'www_configuration' templates_dir = os.path.join( development_dir, 'templates', 'offline' ) templates_dir = os.path.join( development_dir, 'templates', 'online' ) site_css = 'language_binding.css' home_url = 'http://www.language-binding.net' + sys.path.append( os.path.join( settings.development_dir, 'tools', 'kid-svn-12-10-2006' ) ) sys.path.append( os.path.join( settings.development_dir, 'tools', 'pykleur-svn-11-11-2006' ) ) Modified: website/templates/online/page_template.html =================================================================== --- website/templates/online/page_template.html 2007-01-01 05:43:59 UTC (rev 826) +++ website/templates/online/page_template.html 2007-01-01 21:49:42 UTC (rev 827) @@ -26,13 +26,13 @@ </div> <div class="right"> <!-- Google CSE Search Box Begins --> - <form id="searchbox_017839341659215598962:rpxttlw8grw" action="http://"> + <form id="searchbox_017839341659215598962:rpxttlw8grw" action="http://www.google.com/cse"> <input type="hidden" name="cx" value="017839341659215598962:rpxttlw8grw" /> <input name="q" type="text" size="25" /> <input type="submit" name="sa" value="Search" /> <input type="hidden" name="cof" value="FORID:10" /> </form> - <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_017839341659215598962%3Arpxttlw8grw"></script> + <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_017839341659215598962%3Arpxttlw8grw"></script> <!-- Google CSE Search Box Ends --> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-01 05:43:58
|
Revision: 826 http://svn.sourceforge.net/pygccxml/?rev=826&view=rev Author: roman_yakovenko Date: 2006-12-31 21:43:59 -0800 (Sun, 31 Dec 2006) Log Message: ----------- fixing bug Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp pyplusplus_dev/unittests/function_transformations_tester.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2006-12-31 11:27:03 UTC (rev 825) +++ pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2007-01-01 05:43:59 UTC (rev 826) @@ -109,9 +109,9 @@ @property def pre_return_code( self ): if None is self.__pre_return_code: - if not self.__controller.return_variables \ - or self.__function.call_policies.is_default() \ - or declarations.is_void( self.__function.return_type ): + if declarations.is_void( self.__function.return_type ) \ + and ( self.__function.call_policies.is_default() \ + or False == bool( self.__controller.return_variables ) ): self.__pre_return_code = '' else: c_p_typedef = 'typedef %s %s;' \ Modified: pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2006-12-31 11:27:03 UTC (rev 825) +++ pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2007-01-01 05:43:59 UTC (rev 826) @@ -212,6 +212,11 @@ int do_nothing( int& v ){ return v; } + + modify_type_tester_t* clone(int& c){ + return new modify_type_tester_t(); + } + }; } Modified: pyplusplus_dev/unittests/function_transformations_tester.py =================================================================== --- pyplusplus_dev/unittests/function_transformations_tester.py 2006-12-31 11:27:03 UTC (rev 825) +++ pyplusplus_dev/unittests/function_transformations_tester.py 2007-01-01 05:43:59 UTC (rev 826) @@ -75,6 +75,10 @@ do_nothing = cls.mem_fun( 'do_nothing' ) do_nothing.add_transformation( ft.modify_type(0, declarations.remove_reference ) ) + clone = cls.mem_fun( 'clone' ) + clone.call_policies = call_policies.return_value_policy( call_policies.manage_new_object ) + clone.add_transformation( ft.modify_type(0, declarations.remove_reference ) ) + def run_tests(self, module): """Run the actual unit tests. """ @@ -221,6 +225,7 @@ tmp = module.modify_type_tester_t() self.failUnless( 123 == tmp.do_nothing(123) ) + self.failUnless( tmp != tmp.clone(123) ) def create_suite(): suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-31 11:27:04
|
Revision: 825 http://svn.sourceforge.net/pygccxml/?rev=825&view=rev Author: roman_yakovenko Date: 2006-12-31 03:27:03 -0800 (Sun, 31 Dec 2006) Log Message: ----------- updating docs Modified Paths: -------------- pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest pyplusplus_dev/pyplusplus/function_transformers/transformers.py Added Paths: ----------- pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest Modified: pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest 2006-12-31 09:34:53 UTC (rev 824) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/built_in.rest 2006-12-31 11:27:03 UTC (rev 825) @@ -16,6 +16,8 @@ * ``inout`` +* ``modify_type`` + * ``input_static_array`` * ``output_static_array`` Added: pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest (rev 0) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/modify_type.rest 2006-12-31 11:27:03 UTC (rev 825) @@ -0,0 +1,78 @@ +=========================== +``modify_type`` transformer +=========================== + +.. contents:: Table of contents + +---------- +Definition +---------- + +"modify_type" transformer changes type of the function argument. + +"modify_type" transformer takes two arguments: + +1. name or index of the original function argument + +2. a callable, which takes as argument reference to type and returns new type + +New in version grater than 0.8.5. + +Known limits +------------ + +Implicit conversion should exist between new type and the old one. + +------- +Example +------- + +.. code-block:: C++ + + #include <string> + + inline void hello_world( std::string& hw ){ + hw = "hello world!"; + } + +Lets say that you need to expose ``hello_world`` function. As you know +``std::string`` is mapped to `Python`_ string, which is immutable type, so you +have to create small wrapper for the function. Next `Py++`_ code does it for you: + + .. code-block:: Python + + from pygccxml import declarations + from pyplusplus import module_builder + from pyplusplus import function_transformers as FT + + mb = module_builder.module_builder_t( ... ) + hw = mb.mem_fun( 'hello_world' ) + hw.add_transformation( FT.modify_type(0, declarations.remove_reference) ) + +What you see below is the relevant pieces of generated code: + + .. code-block:: C++ + + namespace bp = boost::python; + + static void hello_world_a3478182294a057b61508c30b1361318( ::std::string hw ){ + ::hello_world(hw); + } + + BOOST_PYTHON_MODULE(...){ + ... + bp::def( "hello_world", &hello_world_a3478182294a057b61508c30b1361318 ); + } + +.. _`Py++` : ./../pyplusplus.html +.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html +.. _`Python`: http://www.python.org +.. _`GCC-XML`: http://www.gccxml.org + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: Modified: pyplusplus_dev/pyplusplus/function_transformers/transformers.py =================================================================== --- pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2006-12-31 09:34:53 UTC (rev 824) +++ pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2006-12-31 11:27:03 UTC (rev 825) @@ -14,6 +14,7 @@ - L{inout_t} - L{input_array_t} - L{output_array_t} + - L{type_modifier_t} """ import os import string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-31 09:34:54
|
Revision: 824 http://svn.sourceforge.net/pygccxml/?rev=824&view=rev Author: roman_yakovenko Date: 2006-12-31 01:34:53 -0800 (Sun, 31 Dec 2006) Log Message: ----------- update fonts Modified Paths: -------------- website/templates/online/language_binding.css website/templates/online/page_template.html Property Changed: ---------------- website/ website/site_creator/ website/templates/online/ website/tools/ Property changes on: website ___________________________________________________________________ Name: svn:ignore + www Property changes on: website/site_creator ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: website/templates/online ___________________________________________________________________ Name: svn:ignore + *.pyc Modified: website/templates/online/language_binding.css =================================================================== --- website/templates/online/language_binding.css 2006-12-31 08:43:40 UTC (rev 823) +++ website/templates/online/language_binding.css 2006-12-31 09:34:53 UTC (rev 824) @@ -17,6 +17,22 @@ text-align: left; } +body{ + margin-top: 95px; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 10pt; +} + + +div.top-links{ + font-size: 10pt; + display: block; + left: 0px; + bottom: 0px; + margin-top: 10px; + margin-left: 10px; +} + a:link { color: #0033CC; background-color: inherit; @@ -55,25 +71,6 @@ margin: 10px 0px 0px 10px; } -div.top-links{ - font-size: 10pt; - display: block; - left: 0px; - bottom: 0px; - margin-top: 10px; - margin-left: 10px; -} - -div.top-links-adsense { - font-size: 12pt; - display: block; - left: 0px; - bottom: 0px; - margin-top: 3px; - margin-left: 10px; -} - - img{border:none;} a.python-logo img { @@ -85,11 +82,6 @@ width: 211px; height: 71px; } -body{ - margin-top: 95px; - font: 14px serif; -} - div.document { margin-left: 140px; padding-top: 0px; @@ -124,8 +116,8 @@ float: right; /*background-color: #DFDFDF;*/ color: #000; - margin: 2px 0px 0px 2px; - padding: 6px 0px 0px 6px; + /*margin: 2px 0px 0px 2px;*/ + /*padding: 6px 0px 0px 6px;*/ /*border: thin solid #BBB;*/ } Modified: website/templates/online/page_template.html =================================================================== --- website/templates/online/page_template.html 2006-12-31 08:43:40 UTC (rev 823) +++ website/templates/online/page_template.html 2006-12-31 09:34:53 UTC (rev 824) @@ -8,6 +8,7 @@ <head> <title>${page_title}</title> <link href="${site_css}" rel="stylesheet" type="text/css"/> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> </head> <body> <div class="top"> Property changes on: website/tools ___________________________________________________________________ Name: svn:ignore + pykleur-svn-11-11-2006 kid-svn-12-10-2006 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-31 08:43:42
|
Revision: 823 http://svn.sourceforge.net/pygccxml/?rev=823&view=rev Author: roman_yakovenko Date: 2006-12-31 00:43:40 -0800 (Sun, 31 Dec 2006) Log Message: ----------- adding website build scripts Added Paths: ----------- website/ website/site_creator/ website/site_creator/create_sitemap.bat website/site_creator/environment.py website/site_creator/file_system_iter.py website/site_creator/main.py website/site_creator/page_creator.py website/site_creator/template_wrapper.py website/site_creator/topics_creator.py website/site_creator/transform_html.py website/site_creator/utils.py website/site_creator/www_configuration_reader.py website/templates/ website/templates/css_cheat_sheet.pdf website/templates/offline/ website/templates/offline/language_binding.css website/templates/offline/page_template.html website/templates/offline/source_code.css website/templates/offline/topics_template.html website/templates/online/ website/templates/online/language_binding.css website/templates/online/page_template.html website/templates/online/topics_template.html website/tools/ website/tools/kid-svn-12-10-2006.zip website/tools/pykleur-svn-11-11-2006.zip Added: website/site_creator/create_sitemap.bat =================================================================== --- website/site_creator/create_sitemap.bat (rev 0) +++ website/site_creator/create_sitemap.bat 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1 @@ +c:\python\python.exe "D:\language-binding\dev\tools\sitemap_gen-1.4\sitemap_gen.py" --config="D:\language-binding\dev\site_creator\sitemap.xml" \ No newline at end of file Added: website/site_creator/environment.py =================================================================== --- website/site_creator/environment.py (rev 0) +++ website/site_creator/environment.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,33 @@ +import os +import sys + +class settings: + project_root = None + sources_root = None + pygccxml_sources_root = None + pyplusplus_sources_root = None + pydsc_sources_root = None + if sys.platform == 'win32': + project_root = 'd:/dev/language-binding/sources/website' + sources_root = 'd:/dev/language-binding/sources' + pygccxml_sources_root = 'd:/dev/language-binding/sources/pygccxml_dev' + pyplusplus_sources_root = 'd:/dev/language-binding/sources/pyplusplus_dev' + pydsc_sources_root = 'd:/dev/language-binding/sources/pydsc_dev' + else: + project_root = '/home/roman/language-binding/website' + sources_root = '/home/roman/language-binding/sources' + pygccxml_sources_root = '/home/roman/language-binding/sources/pygccxml_dev' + pyplusplus_sources_root = '/home/roman/language-binding/sources/pyplusplus_dev' + pydsc_sources_root = '/home/roman/language-binding/sources/pydsc_dev' + temp_dir = os.path.join( project_root, 'dev', 'tmp' ) + development_dir = project_root#os.path.join( project_root, 'dev') + development_www_dir = os.path.join( development_dir, 'www') + production_dir = r'D:\dev\language-binding\website\production'#os.path.join( project_root, 'production') + production_www_dir = os.path.join( production_dir, 'www') + configuration_file = 'www_configuration' + templates_dir = os.path.join( development_dir, 'templates', 'offline' ) + templates_dir = os.path.join( development_dir, 'templates', 'online' ) + site_css = 'language_binding.css' + home_url = 'http://www.language-binding.net' +sys.path.append( os.path.join( settings.development_dir, 'tools', 'kid-svn-12-10-2006' ) ) +sys.path.append( os.path.join( settings.development_dir, 'tools', 'pykleur-svn-11-11-2006' ) ) Added: website/site_creator/file_system_iter.py =================================================================== --- website/site_creator/file_system_iter.py (rev 0) +++ website/site_creator/file_system_iter.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,141 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +from types import * + +##If you want include files that doesn't have extension then use filter like '*.' + +def _make_list( argument ): + if type(argument) in StringTypes: + if argument: + return [argument] + else: + return [] + elif type(argument) is ListType: + return argument + else: + raise TypeError( 'Argument "%s" must be or list of strings or string.' % argument ) + +class base_files_iterator: + def __init__(self, file_exts, is_include_exts = True): + self.__file_exts = _make_list( file_exts ) + self.__is_include_exts = is_include_exts + + def _is_to_skip(self, file_path): + if not self.__file_exts: + return 0 + file_ext = os.path.splitext( file_path )[1] + if not file_ext: + file_ext = '.' + file_ext + file_ext = '*' + file_ext + if file_ext.lower() in self.__file_exts: + return not self.__is_include_exts + else: + return self.__is_include_exts + + def _subfolders_and_files(self, folder_path): + files, folders = [], [] + folder_contents = os.listdir(folder_path) + for object_name in folder_contents: + object_path = os.path.join(folder_path, object_name) + if os.path.isfile( object_path ) and not self._is_to_skip( object_path ): + files.append( object_path ) + elif os.path.isdir( object_path ): + folders.append( object_path ) + else: + pass + return folders, files + + def __iter__(self): + raise NotImplementedError + + def next(self): + raise NotImplementedError + + def restart(self): + raise NotImplementedError + +class files_iterator_generator(base_files_iterator): + def __init__(self, folders, file_ext_filter = '', is_include_filter = True, is_recursive = True): + base_files_iterator.__init__(self, file_ext_filter, is_include_filter) + self.__folders = _make_list( folders ) + self.__is_recursive = is_recursive + self.__file_generator = None + + def __walk(self): + folders = self.__folders[:] + while folders: + sub_folders, files = self._subfolders_and_files( folders.pop(0) ) + if self.__is_recursive: + for folder in sub_folders: + folders.append( folder ) + for file_os in files: + yield file_os + + def __iter__(self): + self.__file_generator = self.__walk() + return self + + def next(self): + return self.__file_generator.next() + + def restart(self): + self.__file_generator = None + + +class folders_iterator_generator: + def __init__(self, folders, is_recursive = 1): + self.__folders = [] + for root in _make_list( folders ): + self.__folders.extend( self.__sub_folders( root ) ) + self.__is_recursive = is_recursive + self.__folder_generator = None + + def __sub_folders(self, folder_path): + sub_folders = [] + folder_contains = os.listdir(folder_path) + for object_in_folder in folder_contains: + full_path = os.path.join(folder_path, object_in_folder) + if os.path.isdir( full_path ): + sub_folders.append( full_path ) + return sub_folders + + def __walk(self): + folders = self.__folders[:] + for curr_folder in folders: + yield curr_folder + if self.__is_recursive: + for f in folders_iterator_generator( [curr_folder], True ): + yield f + + def __iter__(self): + self.__folder_generator = self.__walk() + return self + + def next(self): + return self.__folder_generator.next() + + def restart(self): + self.__folder_generator = None + +#preserving backward computability names +file_iter = files_iterator_generator +folder_iter = folders_iterator_generator +#new names +files_iterator = files_iterator_generator +folders_iterator = folders_iterator_generator + +if '__main__' == __name__: + #lFileCount = 0 + #for file_os in files_iterator( r'C:\Program Files\Microsoft Visual Studio\VC98\Include\stlport', ['*.h', '*.'], True, False): + #print file_os + #lFileCount += 1 + #print lFileCount + + for folder in folders_iterator( '/home/roman/language-binding', False ): + print folder + for folder in folders_iterator( '/home/roman/language-binding', True ): + print folder Added: website/site_creator/main.py =================================================================== --- website/site_creator/main.py (rev 0) +++ website/site_creator/main.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,108 @@ +import os +import sys +import stat +import utils +import shutil +from environment import settings +from file_system_iter import folders_iterator, files_iterator +import page_creator +from docutils import core +import www_configuration_reader +import transform_html +#import codecs +#import cStringIO +#from docutils.core import publish_file + +class creator_t: + def __init__( self ): + self.adsence_injector = transform_html.adsence_injector_t() + + def make_deletable( self, path_ ): + mode = stat.S_IRWXU + if os.path.isdir( path_ ): + for dir_ in folders_iterator( path_ ): + os.chmod( dir_, mode ) + for file_ in files_iterator( path_ ): + os.chmod( file_, mode ) + else: + os.chmod( path_, mode ) + + def create_dirs(self): + shutil.copyfile( os.path.join( settings.sources_root, 'index.rest' ) + , os.path.join( settings.development_www_dir, 'index.rest' ) ) + + pygccxml_dev_www = os.path.join( settings.development_www_dir, 'pygccxml' ) + if os.path.exists( pygccxml_dev_www ): + self.make_deletable( pygccxml_dev_www ) + shutil.rmtree( pygccxml_dev_www ) + utils.path.copytree( os.path.join( settings.pygccxml_sources_root, 'docs' ) + , pygccxml_dev_www) + + pyplusplus_dev_www = os.path.join( settings.development_www_dir, 'pyplusplus' ) + if os.path.exists( pyplusplus_dev_www ): + self.make_deletable( pyplusplus_dev_www ) + shutil.rmtree( pyplusplus_dev_www ) + utils.path.copytree( os.path.join( settings.pyplusplus_sources_root, 'docs' ) + , pyplusplus_dev_www) + + pydsc_dev_www = os.path.join( settings.development_www_dir, 'pydsc' ) + if os.path.exists( pydsc_dev_www ): + self.make_deletable( pydsc_dev_www ) + shutil.rmtree( pydsc_dev_www ) + utils.path.copytree( os.path.join( settings.pydsc_sources_root, 'docs' ) + , pydsc_dev_www) + + if os.path.exists( settings.production_www_dir ): + self.make_deletable( settings.production_www_dir ) + shutil.rmtree( settings.production_www_dir ) + utils.path.copytree( settings.development_www_dir, settings.production_www_dir ) + + to_be_removed = [] + for dir_ in folders_iterator( [settings.production_www_dir, settings.development_www_dir] ): + name = os.path.split( dir_ )[1] + if name.lower() == '.svn': + to_be_removed.append( dir_ ) + map( self.make_deletable, to_be_removed ) + for dir_ in to_be_removed: + if os.path.exists( dir_ ): + shutil.rmtree( dir_ ) + + def copy_css(self): + shutil.copyfile( os.path.join( settings.templates_dir, settings.site_css ) + , os.path.join( settings.production_www_dir, settings.site_css ) ) + + def visit_file( self, rest_file ): + dir_, rest_file_name = os.path.split( rest_file ) + www_c_reader = www_configuration_reader.reader_t( dir_ ) + if rest_file_name in www_c_reader.files_to_skip: + return + destrination_file_name = os.path.splitext( rest_file_name )[0] + '.html' + destrination_file_name = os.path.join( utils.path.production_dir( dir_ ) + , destrination_file_name ) + + curr_work_dir = os.path.abspath( os.curdir ) + try: + print 'file: ', destrination_file_name + os.chdir( dir_ ) + tmpl = page_creator.Template( rest_file ) + tmpl.write( destrination_file_name, encoding='utf-8', output='xhtml' ) + finally: + os.chdir( curr_work_dir ) + + def create_html_files(self): + for rest_file in files_iterator(settings.development_www_dir, ['*.rest'] ): + self.visit_file( rest_file ) + + def clean_www_dir( self ): + exts = [ '*.rest', '*.rest~', '*.bak', '*.pyc', '*.py', '*.py~' + , '*.vsd', '*.txt' ] + for file_ in files_iterator( settings.production_www_dir, exts ): + os.remove( file_ ) + +if __name__ == '__main__': + c = creator_t() + c.create_dirs() + c.copy_css() + c.create_html_files() + c.clean_www_dir() + print 'done' \ No newline at end of file Added: website/site_creator/page_creator.py =================================================================== --- website/site_creator/page_creator.py (rev 0) +++ website/site_creator/page_creator.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,161 @@ +import os +from environment import settings + +import utils +import cStringIO +import xml.dom.minidom +import template_wrapper +from docutils import core +import docutils.parsers.rst +import www_configuration_reader + +import sys +sys.path.append( 'D:\pykleur' ) + +import pykleur + +def code_block( name, arguments, options, content, lineno, content_offset, block_text, state, state_machine ): + """ + The code-block directive provides syntax highlighting for blocks of code. + + .. code-block:: CPP + + #include <iostream> + + int main( int argc, char* argv[] ) + { + std::cout << "Hello world" << std::endl; + } + + The directive can also be told to include a source file directly:: + + .. code-block:: + :language: Python + :source-file: ../myfile.py + + You cannot both specify a source-file and include code directly. + """ + + try: + language = arguments[0] + except IndexError: + language = options['language'] + + if content and 'source-file' in options: + error = state_machine.reporter.error( "You cannot both specify a source-file and include code directly.", + docutils.nodes.literal_block(block_text,block_text), line=lineno) + return [error] + + source_code = None + if content: + source_code = os.linesep.join( map( lambda s: s.rstrip(), content ) ) + else: + source_code = file( options['source-file'] ).read() + + html = pykleur.highlight( source_code + , pykleur.lexers.get_lexer_by_name( language.lower() ) + , pykleur.formatters.HtmlFormatter(noclasses=True, style='friendly') ) + + raw = docutils.nodes.raw('', html, format='html') + return [raw] + +code_block.arguments = (0,2,1) +code_block.options = {'language' : docutils.parsers.rst.directives.unchanged, + 'source-file' : docutils.parsers.rst.directives.path,} +code_block.content = 1 + + +# Simply importing this module will make the directive available. +docutils.parsers.rst.directives.register_directive( 'code-block', code_block ) + +class Template( template_wrapper.Template ): + def __init__( self, rest_file_path ): + self._rest_file_path = rest_file_path + self.__html_template = os.path.join( settings.templates_dir, 'page_template.html' ) + template_wrapper.Template.__init__( self, file=self.__html_template ) + self.template_inst.content_colspan={'colspan':2} + if rest_file_path == os.path.join( settings.development_www_dir, 'index.rest' ): + self.template_inst.content_colspan={'colspan':1} + self.template_inst.rest_file_path=rest_file_path + self.template_inst.site_css = self.findout_site_css() + self.template_inst.page_title = "" + self.template_inst.page_content = "" + self.template_inst.title_items = self.findout_title_items() + #self.template_inst.meta_tags = {} + html = self.rest2html( rest_file_path ) + self.update_page( html ) + + def rest_dir_path(self): + return os.path.split( self._rest_file_path )[0] + + def findout_site_css(self): + production_dir = utils.path.production_dir( os.path.split( self.template_inst.rest_file_path )[0] ) + relative_path = utils.path.relative_path( production_dir + , settings.production_www_dir ) + return utils.path.normalize( os.path.join( relative_path, settings.site_css ) ) + + def update_page(self, html): + html_document = xml.dom.minidom.parseString( html ) + title_elem = html_document.getElementsByTagName( 'title' )[0] + if title_elem.hasChildNodes(): + self.template_inst.page_title = title_elem.childNodes[0].data + body_elem = html_document.getElementsByTagName( 'body' )[0] + body_div_elem = body_elem.getElementsByTagName( 'div' )[0] + for elem in body_div_elem.childNodes[:]: + try: + if isinstance( elem, xml.dom.minidom.Text ) \ + and elem.data == os.linesep: + body_div_elem.removeChild( elem ) + continue + elif elem.tagName == 'h1' and elem.getAttribute('class') == 'title': + body_div_elem.removeChild( elem ) + else: + pass + except IndexError: + pass + except AttributeError: + pass + self.template_inst.page_content = body_div_elem.toxml() + + #meta_elems = html_document.getElementsByTagName( 'meta' ) + #meta_tags = {} + #for meta_elem in meta_elems: + #meta_tags[ 'content' ] = meta_elem.getAttribute( 'content' ) + #meta_tags[ 'name' ] = meta_elem.getAttribute( 'name' ) + #self.template_inst.meta_tags = meta_tags + + def findout_title_items( self ): + title_items = [] + + parent_dir = self.rest_dir_path() + while parent_dir != settings.development_www_dir: + current_name = www_configuration_reader.reader_t( parent_dir ).name + #if parent_dir == self.rest_dir_path(): + # title_items.append( (None, current_name) ) + #else: + title_items.append( ( self.findout_href(parent_dir), current_name) ) + parent_dir = os.path.split( parent_dir )[0] + title_items.append( (self.findout_href(parent_dir), 'Home') ) + title_items.reverse() + return title_items + + def findout_href(self, dir_ ): + fname = www_configuration_reader.reader_t( dir_ ).main_html_file + href = os.path.join( utils.path.relative_path( utils.path.production_dir( self.rest_dir_path() ) + , utils.path.production_dir( dir_ ) ) + , fname ) + return href.replace( '\\', '/' ) + + def rest2html( self, rest_file_name ): + content = core.publish_file( source_path=rest_file_name + , destination=cStringIO.StringIO() + , writer_name='html' ) + return content + +if __name__ == '__main__': + f = file( os.path.join( settings.temp_dir, 'page.html' ), 'w+' ) + template = Template( settings.development_www_dir + , os.path.join( settings.development_www_dir, 'main.rest' ) ) + f.write( template.serialize() ) + f.close() + print 'done' Added: website/site_creator/template_wrapper.py =================================================================== --- website/site_creator/template_wrapper.py (rev 0) +++ website/site_creator/template_wrapper.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,50 @@ +import environment +import kid + +class Template( kid.BaseTemplate ): + def __init__( self, file=None, source=None, name=None, **kw ): + self.template_inst = kid.Template( file, source, name, **kw ) + + def write(self, file, encoding=None, fragment=0, output=None): + return self.template_inst.write( file, encoding, fragment, output) + + def serialize(self, encoding=None, fragment=0, output=None): + if output == None: + output = 'xhtml-strict' + return self.template_inst.serialize(encoding, fragment, output) + + def generate(self, encoding=None, fragment=0, output=None): + return self.template_inst.generate(encoding, fragment, output) + + def __iter__(self): + return iter( self.template_inst ) + + def __str__(self): + return str( self.template_inst ) + + def __unicode__(self): + return unicode( self.template_inst ) + + def initialize(self): + return self.template_inst.initialize() + + def pull(self): + return self.template_inst.pull() + + def _pull(self): + return self.template_inst._pull() + + def content(self): + return self.template_inst.content() + + def transform(self, stream=None, filters=[]): + return self.template_inst.transform(stream, filters) + + def _get_match_templates(self): + return self.template_inst._get_match_templates() + + def _get_serializer(self, serializer): + return self.template_inst._get_serializer( serializer ) + + def _get_assume_encoding(self): + return self.template_inst._get_assume_encoding() Added: website/site_creator/topics_creator.py =================================================================== --- website/site_creator/topics_creator.py (rev 0) +++ website/site_creator/topics_creator.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,84 @@ +import os +from environment import settings +import template_wrapper +import kid +import utils +from file_system_iter import folders_iterator, files_iterator +import www_configuration_reader + +class Template( template_wrapper.Template ): + def __init__( self, rest_file_path ): + self._html = os.path.join( settings.templates_dir, 'topics_template.html' ) + self._rest_file_path = rest_file_path + self._www_config_reader = www_configuration_reader.reader_t( self.rest_dir_path() ) + template_wrapper.Template.__init__( self, file=self._html ) + self.template_inst.title_items = self.findout_title_items() + self.template_inst.items = self.findout_items() + + def rest_dir_path(self): + return os.path.split( self._rest_file_path )[0] + + def rest_file_name( self ): + return os.path.split( self._rest_file_path )[1] + + def findout_title_items( self ): + title_items = [] + + parent_dir = self.rest_dir_path() + while parent_dir != settings.development_www_dir: + current_name = www_configuration_reader.reader_t( parent_dir ).name + if parent_dir == self.rest_dir_path(): + title_items.append( (None, current_name) ) + else: + title_items.append( ( self.findout_href(parent_dir), current_name) ) + parent_dir = os.path.split( parent_dir )[0] + title_items.append( (self.findout_href(parent_dir), 'Home') ) + title_items.reverse() + return title_items + + def findout_items(self): + if len( self.template_inst.title_items ) == 1: #Main page + return [] + star = '* ' + items = [] + + #if len( self.template_inst.title_items ) == 1: + # items.append( self.template_inst.title_items[0] ) + #else: + # items.append( ( self.findout_href( self.rest_dir_path() ) + # , www_configuration_reader.reader_t( self.rest_dir_path() ).name ) ) + + main_html_file_name_only = os.path.splitext( self._www_config_reader.main_html_file )[0] + for file_ in files_iterator( self.rest_dir_path(), ['*.rest'], True, False ): + file_name = os.path.split( file_ )[1] + file_name_only = os.path.splitext( file_name )[0] + if file_name_only == main_html_file_name_only: + continue #don't add link to main file + if ( file_name_only == 'index' and self.rest_dir_path() == settings.development_www_dir ) \ + or file_name in self._www_config_reader.files_to_skip: + continue + name = self._www_config_reader.find_out_name( file_name ) + if file_name == self.rest_file_name(): + items.append( (file_name_only + '.html', star + name) ) + else: + items.append( (file_name_only + '.html', name) ) + + for dir_ in folders_iterator( self.rest_dir_path(), is_recursive=False ): + www_config_reader = www_configuration_reader.reader_t( dir_ ) + if www_config_reader.expose_to_web: + items.append( (self.findout_href(dir_), www_config_reader.name ) ) + + def remove_star( name ): + if name.startswith( star ): + return name[len(star):] + return name + + items.sort( lambda x, y: cmp( remove_star(x[1]), remove_star(y[1]) ) ) + return items + + def findout_href(self, dir_ ): + fname = www_configuration_reader.reader_t( dir_ ).main_html_file + href = os.path.join( utils.path.relative_path( utils.path.production_dir( self.rest_dir_path() ) + , utils.path.production_dir( dir_ ) ) + , fname ) + return href.replace( '\\', '/' ) Added: website/site_creator/transform_html.py =================================================================== --- website/site_creator/transform_html.py (rev 0) +++ website/site_creator/transform_html.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,127 @@ +import os +import xml.dom.minidom + +#I should find next xml +""" +<p class="topic-title first"> +<a id="table-of-contents" name="table-of-contents">Table of contents</a> +</p> +""" +class adsence_injector_t: + #'<span style="margin-left: 23px; margin-bottom: 0; font-size: +1;">' + link_unit = os.linesep.join([ + '<li>' + , ' <script type="text/javascript"><!--' + , ' google_ad_client = "pub-0886572017808006";' + , ' google_alternate_color = "0000FF";' + , ' google_ad_width = 200;' + , ' google_ad_height = 95;' + , ' google_ad_format = "200x90_0ads_al_s";' + , ' google_ad_channel ="2925640868";' + , ' google_color_border = "FFFFFF";' + , ' google_color_bg = "FFFFFF";' + , ' google_color_link = "0033CC";' + , ' google_color_url = "0033CC";' + , ' google_color_text = "000000";' + , ' //--></script>' + , ' <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">' + , ' </script>' + , '</li>']) + + content = os.linesep.join([ + '<root>' + , '<script type="text/javascript"><!--' + , ' google_ad_client = "pub-0886572017808006";' + , ' google_alternate_color = "0000FF";' + , ' google_ad_width = 728;' + , ' google_ad_height = 90;' + , ' google_ad_format = "728x90_as";' + , ' google_ad_type = "text_image";' + , ' google_ad_channel ="8135159582";' + , ' google_color_border = "FFFFFF";' + , ' google_color_bg = "FFFFFF";' + , ' google_color_link = "0033CC";' + , ' google_color_url = "0033CC";' + , ' google_color_text = "000000";' + , ' //--></script>' + , ' <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">' + , ' </script>' + , '</root>']) + + def __init__( self ): + self.link_unit_xml = xml.dom.minidom.parseString( self.link_unit ) + self.content_xml = xml.dom.minidom.parseString( self.content ) + + def is_my_case( self, elem ): + if not elem.hasAttribute('id') or not elem.hasAttribute('name'): + return False + if elem.getAttribute('id') != "table-of-contents": + return False + if elem.getAttribute('name') != "table-of-contents": + return False + if not elem.hasChildNodes(): + return False + if 1 != len( elem.childNodes ): + return False + child = elem.childNodes[0] + if not isinstance( child, xml.dom.minidom.Text ): + return False + if child.data != "Table of contents": + return False + parent = elem.parentNode + if not parent.hasAttribute( 'class' ): + return False + if not parent.hasAttribute('class'): + return False + if parent.getAttribute('class') != "topic-title first": + return False + return True + + def __replace_elem( self, elem ): + elem = elem.parentNode.parentNode + ul_elems = elem.getElementsByTagName("ul") + relevant_ul = filter( lambda node: node.parentNode is elem, ul_elems )[0] + link_unit_elem = relevant_ul.ownerDocument.importNode( self.link_unit_xml.documentElement, True ) + relevant_ul.insertBefore( link_unit_elem, relevant_ul.firstChild ) + #parent = elem.parentNode + #parent.removeChild( elem ) + #link_unit_elem = parent.ownerDocument.importNode( self.link_unit_xml.documentElement, True ) + #parent.appendChild( link_unit_elem ) + content_elem = relevant_ul.ownerDocument.importNode( self.content_xml.documentElement, True ) + relevant_ul.parentNode.appendChild( content_elem ) + + def buitify( self, doc ): + answer = [] + for line in doc.split('\n'): + if line.strip(): + answer.append( line ) + return '\n'.join( answer ) + + def rename_contents_topic(self, doc): + #class="contents topic"==> contents topic + cls_elems = doc.documentElement.getElementsByTagName("div") + for elem in cls_elems: + if not elem.hasAttribute( 'class' ): + continue + if elem.getAttribute('class') != "contents topic": + continue + else: + elem.setAttribute('class', 'contentstopic' ) + + def inject( self, html_document ): + doc = xml.dom.minidom.parseString( html_document ) + root_elem = doc.documentElement + a_elems = root_elem.getElementsByTagName("a") + relevant_elems = filter( self.is_my_case, a_elems ) + if 1 == len( relevant_elems ): + self.__replace_elem( relevant_elems[0] ) + else: + print 'relevant <a> element has not been found or there is more then 1 relvant element.' + self.rename_contents_topic( doc ) + #new_html_document = doc.toprettyxml() + new_html_document = doc.toxml() + return self.buitify( new_html_document ) + +if __name__ == "__main__": + t = adsence_injector_t( ) + t.inject('/home/roman/language-binding/production/www/pyplusplus/pyplusplus.html') \ No newline at end of file Added: website/site_creator/utils.py =================================================================== --- website/site_creator/utils.py (rev 0) +++ website/site_creator/utils.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,146 @@ +import os +import sys +import shutil +import webbrowser +from sets import Set as set +from environment import settings + +class path: + def normalize( some_path ): + n = os.path.normpath( os.path.normcase( some_path ) ) + return n.replace( '\\', '/' ) + normalize = staticmethod( normalize ) + + def is_parent_and_child( root_dir, child_dir ): + root_dir = path.normalize( root_dir ) + child_dir = path.normalize( child_dir ) + return root_dir in child_dir and len( root_dir ) < len( child_dir ) + is_parent_and_child = staticmethod( is_parent_and_child ) + + def is_same( path1, path2 ): + path1 = path.normalize( path1 ) + path2 = path.normalize( path2 ) + return path1 == path2 + is_same = staticmethod( is_same ) + + def suffix( root_dir, child_dir ): + root_dir = path.normalize( root_dir ) + child_dir = path.normalize( child_dir ) + suffix = child_dir[ len( root_dir ): ] + if suffix.startswith( '/' ): + suffix = suffix[1:] + return suffix + suffix = staticmethod( suffix ) + + def production_dir( development_dir ): + development_dir = path.normalize( development_dir ) + suffix = path.suffix( settings.development_dir, development_dir ) + return path.normalize( os.path.join( settings.production_dir, suffix ) ) + production_dir = staticmethod( production_dir ) + + def development_dir( production_dir ): + production_dir = path.normalize( production_dir ) + suffix = path.suffix( settings.production_dir, production_dir ) + return path.normalize( os.path.join( settings.development_dir, suffix ) ) + development_dir = staticmethod( development_dir ) + + def components( p ): + answer = [] + root = p + while root: + root, leaf = os.path.split( root ) + if not leaf: + answer.append( root ) + break + else: + answer.append( leaf ) + + answer.reverse() + return answer + + components = staticmethod( components ) + + def common_prefix( path1, path2 ): + #Returns common prefix of 2 pathes as os path + common_prefix = '' + comp1 = path.components(path1) + comp2 = path.components(path2) + for i in range( min( len( comp1 ), len( comp2 ) ) ): + if comp1[i] != comp2[i]: + if not i: + return None + else: + return path.normalize( os.path.join( *comp1[:i] ) ) + else: + if len( comp1 ) < len( comp2 ): + return path.normalize( os.path.join( *comp1 ) ) + else: + return path.normalize( os.path.join( *comp2 ) ) + common_prefix = staticmethod( common_prefix ) + + def relative_path( from_path, to_path ): + from_path = path.normalize( from_path ) + to_path = path.normalize( to_path ) + if from_path == to_path: + return '.' + + common_prefix = path.common_prefix( from_path, to_path ) + if not common_prefix: + return to_path #this could happen on windows machine + + comm_pref_components = path.components( common_prefix ) + fp_components = path.components( from_path ) + tp_components = path.components( to_path ) + if comm_pref_components == fp_components: + return os.path.join( '.', *tp_components[ len( fp_components ): ] ) + else: + #move up until common prefix + temp = ['..'] * ( len( fp_components ) - len( comm_pref_components ) ) + #move down from common component + temp.extend( tp_components[ len( comm_pref_components ): ] ) + relative_path = os.path.join( *temp ) + return relative_path.replace( '\\', '/' ) + relative_path = staticmethod( relative_path ) + + def copytree(src, dst, symlinks=False): + if not os.path.exists( dst ): + os.mkdir(dst) + for name in os.listdir(src): + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + if symlinks and os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + name_only = os.path.split( srcname )[1] + if name.startswith('.'): + continue + path.copytree(srcname, dstname, symlinks) + else: + shutil.copy2(srcname, dstname) + copytree = staticmethod( copytree ) + +def preview_html( html ): + f = os.path.join( settings.temp_dir, 'preview.html' ) + f = file( f, 'w+b' ) + f.write( html ) + f.close() + +def take_sys_snapshot(): + return dict( modules=set( sys.modules.keys() ) + , path=set( sys.path ) ) + +def restore_sys_snapshot( snapshot ): + new_modules = set( sys.modules.keys() ).difference( snapshot['modules'] ) + for x in new_modules: + while x in sys.modules: + sys.modules.pop( x ) + new_paths = set( sys.path ).difference( snapshot['path'] ) + for x in new_paths: + while x in sys.path: + sys.path.remove( x ) + +if __name__ == '__main__': + print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo\acmo.dsp', r'C:\AC_SERVER_III_V3_1\3rdParty\Boost' ) + print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo', r'C:\AC_SERVER_III_V3_1\acmo\xyz' ) + \ No newline at end of file Added: website/site_creator/www_configuration_reader.py =================================================================== --- website/site_creator/www_configuration_reader.py (rev 0) +++ website/site_creator/www_configuration_reader.py 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,51 @@ +import os +import sys +from environment import settings +import utils + +class reader_t( object ): + def __init__( self, dir_ ): + object.__init__( self ) + self.__working_dir = dir_ + + def _exists( self ): + return os.path.exists( os.path.join( self.__working_dir, settings.configuration_file + '.py' ) ) + exists = property( _exists ) + + def _get_value( self, name, default_value=None ): + if not self.exists: + return default_value + sys_snapshot = utils.take_sys_snapshot() + try: + sys.path.append( self.__working_dir ) + config = __import__( settings.configuration_file ) + if hasattr( config, name ): + return getattr( config, name ) + else: + return default_value + finally: + utils.restore_sys_snapshot( sys_snapshot ) + + def _name( self ): + return self._get_value( 'name', os.path.split( self.__working_dir )[1] ) + name = property( _name ) + + def find_out_name( self, file_name ): + values = self._get_value( 'names', {} ) + name_only = os.path.splitext( file_name )[0] + return values.get( name_only, name_only ) + + def _expose_to_web( self ): + return self._get_value( 'expose_to_web', True ) + expose_to_web = property( _expose_to_web ) + + def _main_html_file( self ): + if self.__working_dir == settings.development_www_dir: + return 'index.html' + else: + return self._get_value( 'main_html_file', os.path.split( self.__working_dir )[1] + '.html' ) + main_html_file = property( _main_html_file ) + + def _files_to_skip( self ): + return self._get_value( 'files_to_skip', [] ) + files_to_skip = property( _files_to_skip ) \ No newline at end of file Added: website/templates/css_cheat_sheet.pdf =================================================================== --- website/templates/css_cheat_sheet.pdf (rev 0) +++ website/templates/css_cheat_sheet.pdf 2006-12-31 08:43:40 UTC (rev 823) @@ -0,0 +1,8688 @@ +%PDF-1.4 +%\xE2\xE3\xCF\xD3 +10 0 obj <</Linearized 1/L 382999/O 13/E 374243/N 1/T 382752/H [ 29716 1920]>> +endobj + +xref +10 1471 +0000000016 00000 n +0000031636 00000 n +0000031726 00000 n +0000031766 00000 n +0000031952 00000 n +0000045577 00000 n +0000045973 00000 n +0000046471 00000 n +0000046519 00000 n +0000046567 00000 n +0000046615 00000 n +0000046663 00000 n +0000046711 00000 n +0000046759 00000 n +0000046807 00000 n +0000046855 00000 n +0000046903 00000 n +0000046951 00000 n +0000046999 00000 n +0000047047 00000 n +0000047095 00000 n +0000047143 00000 n +0000047191 00000 n +0000047239 00000 n +0000047287 00000 n +0000047335 00000 n +0000047383 00000 n +0000047431 00000 n +0000047479 00000 n +0000047527 00000 n +0000047575 00000 n +0000047623 00000 n +0000047670 00000 n +0000047718 00000 n +0000047765 00000 n +0000047813 00000 n +0000047861 00000 n +0000047908 00000 n +0000047955 00000 n +0000048002 00000 n +0000048050 00000 n +0000048097 00000 n +0000048145 00000 n +0000048193 00000 n +0000048241 00000 n +0000048289 00000 n +0000048337 00000 n +0000048385 00000 n +0000048433 00000 n +0000048481 00000 n +0000048529 00000 n +0000048577 00000 n +0000048625 00000 n +0000048673 00000 n +0000048721 00000 n +0000048769 00000 n +0000048817 00000 n +0000048865 00000 n +0000048913 00000 n +0000048961 00000 n +0000049009 00000 n +0000049057 00000 n +0000049105 00000 n +0000049153 00000 n +0000049201 00000 n +0000049249 00000 n +0000049297 00000 n +0000049345 00000 n +0000049393 00000 n +0000049441 00000 n +0000049489 00000 n +0000049537 00000 n +0000049585 00000 n +0000049633 00000 n +0000049681 00000 n +0000049729 00000 n +0000049777 00000 n +0000049825 00000 n +0000049873 00000 n +0000049921 00000 n +0000049969 00000 n +0000050017 00000 n +0000050065 00000 n +0000050113 00000 n +0000050161 00000 n +0000050209 00000 n +0000050257 00000 n +0000050305 00000 n +0000050353 00000 n +0000050401 00000 n +0000050449 00000 n +0000050498 00000 n +0000050547 00000 n +0000050596 00000 n +0000050645 00000 n +0000050693 00000 n +0000050741 00000 n +0000050790 00000 n +0000050839 00000 n +0000050888 00000 n +0000050936 00000 n +0000050985 00000 n +0000051034 00000 n +0000051083 00000 n +0000051131 00000 n +0000051180 00000 n +0000051229 00000 n +0000051278 00000 n +0000051327 00000 n +0000051376 00000 n +0000051425 00000 n +0000051474 00000 n +0000051523 00000 n +0000051572 00000 n +0000051621 00000 n +0000051670 00000 n +0000051719 00000 n +0000051768 00000 n +0000051817 00000 n +0000051866 00000 n +0000051915 00000 n +0000051964 00000 n +0000052013 00000 n +0000052062 00000 n +0000052111 00000 n +0000052160 00000 n +0000052209 00000 n +0000052258 00000 n +0000052307 00000 n +0000052356 00000 n +0000052405 00000 n +0000052454 00000 n +0000052503 00000 n +0000052552 00000 n +0000052601 00000 n +0000052649 00000 n +0000052698 00000 n +0000052747 00000 n +0000052796 00000 n +0000052845 00000 n +0000052894 00000 n +0000052943 00000 n +0000052992 00000 n +0000053041 00000 n +0000053090 00000 n +0000053139 00000 n +0000053188 00000 n +0000053237 00000 n +0000053286 00000 n +0000053335 00000 n +0000053384 00000 n +0000053433 00000 n +0000053482 00000 n +0000053531 00000 n +0000053580 00000 n +0000053629 00000 n +0000053677 00000 n +0000053726 00000 n +0000053774 00000 n +0000053822 00000 n +0000053870 00000 n +0000053918 00000 n +0000053966 00000 n +0000054014 00000 n +0000054062 00000 n +0000054111 00000 n +0000054159 00000 n +0000054207 00000 n +0000054255 00000 n +0000054303 00000 n +0000054351 00000 n +0000054399 00000 n +0000054447 00000 n +0000054495 00000 n +0000054543 00000 n +0000054591 00000 n +0000054639 00000 n +0000054687 00000 n +0000054734 00000 n +0000054782 00000 n +0000054830 00000 n +0000054878 00000 n +0000054926 00000 n +0000054974 00000 n +0000055022 00000 n +0000055070 00000 n +0000055118 00000 n +0000055166 00000 n +0000055214 00000 n +0000055262 00000 n +0000055310 00000 n +0000055358 00000 n +0000055406 00000 n +0000055454 00000 n +0000055502 00000 n +0000055550 00000 n +0000055598 00000 n +0000055646 00000 n +0000055694 00000 n +0000055742 00000 n +0000055790 00000 n +0000055838 00000 n +0000055886 00000 n +0000055934 00000 n +0000055982 00000 n +0000056029 00000 n +0000056077 00000 n +0000056124 00000 n +0000056172 00000 n +0000056219 00000 n +0000056266 00000 n +0000056313 00000 n +0000056360 00000 n +0000056408 00000 n +0000056456 00000 n +0000056504 00000 n +0000056552 00000 n +0000056600 00000 n +0000056647 00000 n +0000056695 00000 n +0000056743 00000 n +0000056791 00000 n +0000056838 00000 n +0000056886 00000 n +0000056934 00000 n +0000056981 00000 n +0000057029 00000 n +0000057077 00000 n +0000057125 00000 n +0000057173 00000 n +0000057221 00000 n +0000057269 00000 n +0000057317 00000 n +0000057365 00000 n +0000057413 00000 n +0000057461 00000 n +0000057509 00000 n +0000057557 00000 n +0000057605 00000 n +0000057653 00000 n +0000057700 00000 n +0000057747 00000 n +0000057795 00000 n +0000057843 00000 n +0000057891 00000 n +0000057939 00000 n +0000057987 00000 n +0000058035 00000 n +0000058083 00000 n +0000058131 00000 n +0000058179 00000 n +0000058227 00000 n +0000058275 00000 n +0000058323 00000 n +0000058371 00000 n +0000058419 00000 n +0000058467 00000 n +0000058515 00000 n +0000058563 00000 n +0000058611 00000 n +0000058659 00000 n +0000058707 00000 n +0000058755 00000 n +0000058803 00000 n +0000058851 00000 n +0000058899 00000 n +0000058947 00000 n +0000058994 00000 n +0000059042 00000 n +0000059090 00000 n +0000059138 00000 n +0000059186 00000 n +0000059234 00000 n +0000059282 00000 n +0000059330 00000 n +0000059378 00000 n +0000059426 00000 n +0000059474 00000 n +0000059522 00000 n +0000059570 00000 n +0000059618 00000 n +0000059666 00000 n +0000059714 00000 n +0000059762 00000 n +0000059810 00000 n +0000059858 00000 n +0000059906 00000 n +0000059954 00000 n +0000060002 00000 n +0000060049 00000 n +0000060097 00000 n +0000060144 00000 n +0000060192 00000 n +0000060239 00000 n +0000060287 00000 n +0000060334 00000 n +0000060381 00000 n +0000060428 00000 n +0000060475 00000 n +0000060523 00000 n +0000060571 00000 n +0000060619 00000 n +0000060667 00000 n +0000060715 00000 n +0000060763 00000 n +0000060811 00000 n +0000060859 00000 n +0000060907 00000 n +0000060955 00000 n +0000061003 00000 n +0000061051 00000 n +0000061099 00000 n +0000061147 00000 n +0000061195 00000 n +0000061243 00000 n +0000061291 00000 n +0000061339 00000 n +0000061387 00000 n +0000061435 00000 n +0000061483 00000 n +0000061531 00000 n +0000061579 00000 n +0000061627 00000 n +0000061675 00000 n +0000061723 00000 n +0000061771 00000 n +0000061819 00000 n +0000061867 00000 n +0000061915 00000 n +0000061963 00000 n +0000062010 00000 n +0000062058 00000 n +0000062105 00000 n +0000062153 00000 n +0000062200 00000 n +0000062248 00000 n +0000062296 00000 n +0000062344 00000 n +0000062392 00000 n +0000062440 00000 n +0000062488 00000 n +0000062536 00000 n +0000062584 00000 n +0000062631 00000 n +0000062679 00000 n +0000062727 00000 n +0000062775 00000 n +0000062823 00000 n +0000062871 00000 n +0000062919 00000 n +0000062967 00000 n +0000063015 00000 n +0000063063 00000 n +0000063111 00000 n +0000063159 00000 n +0000063207 00000 n +0000063255 00000 n +0000063303 00000 n +0000063351 00000 n +0000063399 00000 n +0000063447 00000 n +0000063495 00000 n +0000063544 00000 n +0000063592 00000 n +0000063641 00000 n +0000063689 00000 n +0000063738 00000 n +0000063786 00000 n +0000063834 00000 n +0000063882 00000 n +0000063930 00000 n +0000063978 00000 n +0000064026 00000 n +0000064074 00000 n +0000064122 00000 n +0000064170 00000 n +0000064218 00000 n +0000064266 00000 n +0000064314 00000 n +0000064362 00000 n +0000064410 00000 n +0000064458 00000 n +0000064506 00000 n +0000064554 00000 n +0000064602 00000 n +0000064650 00000 n +0000064698 00000 n +0000064746 00000 n +0000064794 00000 n +0000064842 00000 n +0000064889 00000 n +0000064936 00000 n +0000064984 00000 n +0000065032 00000 n +0000065080 00000 n +0000065127 00000 n +0000065175 00000 n +0000065222 00000 n +0000065270 00000 n +0000065318 00000 n +0000065365 00000 n +0000065412 00000 n +0000065460 00000 n +0000065508 00000 n +0000065556 00000 n +0000065604 00000 n +0000065653 00000 n +0000065702 00000 n +0000065750 00000 n +0000065798 00000 n +0000065846 00000 n +0000065895 00000 n +0000065943 00000 n +0000065992 00000 n +0000066040 00000 n +0000066088 00000 n +0000066136 00000 n +0000066184 00000 n +0000066232 00000 n +0000066281 00000 n +0000066330 00000 n +0000066379 00000 n +0000066427 00000 n +0000066476 00000 n +0000066525 00000 n +0000066574 00000 n +0000066623 00000 n +0000066672 00000 n +0000066721 00000 n +0000066770 00000 n +0000066819 00000 n +0000066868 00000 n +0000066917 00000 n +0000066966 00000 n +0000067015 00000 n +0000067064 00000 n +0000067113 00000 n +0000067162 00000 n +0000067211 00000 n +0000067260 00000 n +0000067309 00000 n +0000067358 00000 n +0000067407 00000 n +0000067456 00000 n +0000067505 00000 n +0000067554 00000 n +0000067603 00000 n +0000067652 00000 n +0000067701 00000 n +0000067750 00000 n +0000067798 00000 n +0000067846 00000 n +0000067894 00000 n +0000067942 00000 n +0000067990 00000 n +0000068038 00000 n +0000068086 00000 n +0000068134 00000 n +0000068182 00000 n +0000068230 00000 n +0000068278 00000 n +0000068327 00000 n +0000068375 00000 n +0000068423 00000 n +0000068471 00000 n +0000068519 00000 n +0000068568 00000 n +0000068617 00000 n +0000068666 00000 n +0000068715 00000 n +0000068764 00000 n +0000068813 00000 n +0000068862 00000 n +0000068911 00000 n +0000068960 00000 n +0000069009 00000 n +0000069058 00000 n +0000069107 00000 n +0000069156 00000 n +0000069205 00000 n +0000069254 00000 n +0000069303 00000 n +0000069352 00000 n +0000069401 00000 n +0000069450 00000 n +0000069499 00000 n +0000069548 00000 n +0000073723 00000 n +0000074099 00000 n +0000078332 00000 n +0000083172 00000 n +0000088051 00000 n +0000091337 00000 n +0000094236 00000 n +0000094394 00000 n +0000099464 00000 n +0000103557 00000 n +0000103792 00000 n +0000104124 00000 n +0000104350 00000 n +0000104671 00000 n +0000104912 00000 n +0000105239 00000 n +0000105480 00000 n +0000105807 00000 n +0000106030 00000 n +0000106331 00000 n +0000106608 00000 n +0000106974 00000 n +0000107142 00000 n +0000107383 00000 n +0000107624 00000 n +0000107949 00000 n +0000108199 00000 n +0000108531 00000 n +0000108802 00000 n +0000109153 00000 n +0000109406 00000 n +0000109750 00000 n +0000109843 00000 n +0000110049 00000 n +0000110275 00000 n +0000110583 00000 n +0000110700 00000 n +0000110919 00000 n +0000111133 00000 n +0000111441 00000 n +0000111546 00000 n +0000111763 00000 n +0000111971 00000 n +0000112283 00000 n +0000112500 00000 n +0000112812 00000 n +0000113038 00000 n +0000113361 00000 n +0000113584 00000 n +0000113898 00000 n +0000114000 00000 n +0000114205 00000 n +0000114286 00000 n +0000114473 00000 n +0000114572 00000 n +0000114765 00000 n +0000114855 00000 n +0000115048 00000 n +0000115295 00000 n +0000115623 00000 n +0000115725 00000 n +0000115920 00000 n +0000116185 00000 n +0000116542 00000 n +0000116629 00000 n +0000116819 00000 n +0000117051 00000 n +0000117376 00000 n +0000117578 00000 n +0000117887 00000 n +0000118098 00000 n +0000118390 00000 n +0000118652 00000 n +0000119000 00000 n +0000119108 00000 n +0000119325 00000 n +0000119605 00000 n +0000119990 00000 n +0000120098 00000 n +0000120325 00000 n +0000120587 00000 n +0000120948 00000 n +0000121065 00000 n +0000121296 00000 n +0000121404 00000 n +0000121613 00000 n +0000121697 00000 n +0000121886 00000 n +0000121949 00000 n +0000122121 00000 n +0000122365 00000 n +0000122692 00000 n +0000122912 00000 n +0000123235 00000 n +0000123476 00000 n +0000123817 00000 n +0000124055 00000 n +0000124398 00000 n +0000124451 00000 n +0000124621 00000 n +0000124889 00000 n +0000125244 00000 n +0000125307 00000 n +0000125479 00000 n +0000125729 00000 n +0000126063 00000 n +0000126126 00000 n +0000126298 00000 n +0000126578 00000 n +0000126947 00000 n +0000127007 00000 n +0000127178 00000 n +0000127458 00000 n +0000127858 00000 n +0000127921 00000 n +0000128093 00000 n +0000128352 00000 n +0000128704 00000 n +0000128764 00000 n +0000128935 00000 n +0000129143 00000 n +0000129446 00000 n +0000129518 00000 n +0000129696 00000 n +0000129792 00000 n +0000129985 00000 n +0000130078 00000 n +0000130270 00000 n +0000130369 00000 n +0000130562 00000 n +0000130661 00000 n +0000130875 00000 n +0000130977 00000 n +0000131197 00000 n +0000131305 00000 n +0000131528 00000 n +0000131606 00000 n +0000131788 00000 n +0000131884 00000 n +0000132093 00000 n +0000132177 00000 n +0000132364 00000 n +0000132472 00000 n +0000132668 00000 n +0000132954 00000 n +0000133297 00000 n +0000133384 00000 n +0000133575 00000 n +0000133798 00000 n +0000134115 00000 n +0000134241 00000 n +0000134473 00000 n +0000134765 00000 n +0000135115 00000 n +0000135356 00000 n +0000135682 00000 n +0000135914 00000 n +0000136225 00000 n +0000136457 00000 n +0000136780 00000 n +0000137003 00000 n +0000137302 00000 n +0000137543 00000 n +0000137868 00000 n +0000138109 00000 n +0000138421 00000 n +0000138638 00000 n +0000138940 00000 n +0000139172 00000 n +0000139488 00000 n +0000139684 00000 n +0000139964 00000 n +0000140208 00000 n +0000140529 00000 n +0000140725 00000 n +0000141004 00000 n +0000141245 00000 n +0000141561 00000 n +0000141742 00000 n +0000142023 00000 n +0000142285 00000 n +0000142614 00000 n +0000142831 00000 n +0000143126 00000 n +0000143433 00000 n +0000143811 00000 n +0000144022 00000 n +0000144314 00000 n +0000144564 00000 n +0000144891 00000 n +0000145132 00000 n +0000145441 00000 n +0000145724 00000 n +0000146073 00000 n +0000146350 00000 n +0000146691 00000 n +0000146784 00000 n +0000146987 00000 n +0000147216 00000 n +0000147519 00000 n +0000147609 00000 n +0000147810 00000 n +0000148027 00000 n +0000148340 00000 n +0000148424 00000 n +0000148624 00000 n +0000148714 00000 n +0000148913 00000 n +0000149006 00000 n +0000149202 00000 n +0000149292 00000 n +0000149491 00000 n +0000149569 00000 n +0000149753 00000 n +0000149852 00000 n +0000150055 00000 n +0000150145 00000 n +0000150336 00000 n +0000150506 00000 n +0000150569 00000 n +0000150741 00000 n +0000150804 00000 n +0000150976 00000 n +0000151036 00000 n +0000151207 00000 n +0000151270 00000 n +0000151442 00000 n +0000151502 00000 n +0000151673 00000 n +0000151733 00000 n +0000151904 00000 n +0000152027 00000 n +0000152253 00000 n +0000152316 00000 n +0000152488 00000 n +0000152578 00000 n +0000152780 00000 n +0000152846 00000 n +0000153023 00000 n +0000153134 00000 n +0000153343 00000 n +0000153427 00000 n +0000153612 00000 n +0000153735 00000 n +0000153956 00000 n +0000154121 00000 n +0000154347 00000 n +0000154558 00000 n +0000154875 00000 n +0000155155 00000 n +0000155513 00000 n +0000155805 00000 n +0000156214 00000 n +0000156506 00000 n +0000156911 00000 n +0000157182 00000 n +0000157556 00000 n +0000157803 00000 n +0000158145 00000 n +0000158404 00000 n +0000158749 00000 n +0000159002 00000 n +0000159351 00000 n +0000159625 00000 n +0000159998 00000 n +0000160263 00000 n +0000160613 00000 n +0000160887 00000 n +0000161267 00000 n +0000161565 00000 n +0000161967 00000 n +0000162223 00000 n +0000162580 00000 n +0000162836 00000 n +0000163179 00000 n +0000163408 00000 n +0000163712 00000 n +0000163947 00000 n +0000164253 00000 n +0000164506 00000 n +0000164814 00000 n +0000165016 00000 n +0000165286 00000 n +0000165403 00000 n +0000165614 00000 n +0000165674 00000 n +0000165845 00000 n +0000166086 00000 n +0000166385 00000 n +0000166557 00000 n +0000166782 00000 n +0000167044 00000 n +0000167390 00000 n +0000167555 00000 n +0000167785 00000 n +0000168059 00000 n +0000168413 00000 n +0000168533 00000 n +0000168758 00000 n +0000169020 00000 n +0000169366 00000 n +0000169483 00000 n +0000169706 00000 n +0000169947 00000 n +0000170274 00000 n +0000170400 00000 n +0000170623 00000 n +0000170746 00000 n +0000170970 00000 n +0000171099 00000 n +0000171327 00000 n +0000171444 00000 n +0000171670 00000 n +0000171799 00000 n +0000172025 00000 n +0000172254 00000 n +0000172577 00000 n +0000172806 00000 n +0000173132 00000 n +0000173388 00000 n +0000173728 00000 n +0000173990 00000 n +0000174332 00000 n +0000174585 00000 n +0000174912 00000 n +0000175102 00000 n +0000175352 00000 n +0000175623 00000 n +0000175971 00000 n +0000176155 00000 n +0000176397 00000 n +0000176647 00000 n +0000176993 00000 n +0000177183 00000 n +0000177429 00000 n +0000177676 00000 n +0000178017 00000 n +0000178119 00000 n +0000178321 00000 n +0000178544 00000 n +0000178843 00000 n +0000178951 00000 n +0000179157 00000 n +0000179362 00000 n +0000179647 00000 n +0000179746 00000 n +0000179951 00000 n +0000180053 00000 n +0000180256 00000 n +0000180340 00000 n +0000180538 00000 n +0000180652 00000 n +0000180870 00000 n +0000180966 00000 n +0000181157 00000 n +0000181350 00000 n +0000181628 00000 n +0000181845 00000 n +0000182117 00000 n +0000182237 00000 n +0000182448 00000 n +0000182520 00000 n +0000182699 00000 n +0000182786 00000 n +0000182975 00000 n +0000183104 00000 n +0000183329 00000 n +0000183389 00000 n +0000183560 00000 n +0000183677 00000 n +0000183896 00000 n +0000183968 00000 n +0000184147 00000 n +0000184315 00000 n +0000184559 00000 n +0000184640 00000 n +0000184830 00000 n +0000185083 00000 n +0000185420 00000 n +0000185504 00000 n +0000185694 00000 n +0000185953 00000 n +0000186330 00000 n +0000186495 00000 n +0000186732 00000 n +0000187000 00000 n +0000187381 00000 n +0000187631 00000 n +0000187986 00000 n +0000188230 00000 n +0000188572 00000 n +0000188816 00000 n +0000189169 00000 n +0000189401 00000 n +0000189756 00000 n +0000189931 00000 n +0000190179 00000 n +0000190381 00000 n +0000190650 00000 n +0000190840 00000 n +0000191094 00000 n +0000191281 00000 n +0000191531 00000 n +0000191706 00000 n +0000191955 00000 n +0000192120 00000 n +0000192364 00000 n +0000192611 00000 n +0000192971 00000 n +0000193136 00000 n +0000193376 00000 n +0000193632 00000 n +0000193990 00000 n +0000194155 00000 n +0000194395 00000 n +0000194672 00000 n +0000195050 00000 n +0000195228 00000 n +0000195474 00000 n +0000195745 00000 n +0000196146 00000 n +0000196327 00000 n +0000196578 00000 n +0000196852 00000 n +0000197248 00000 n +0000197501 00000 n +0000197873 00000 n +0000198060 00000 n +0000198336 00000 n +0000198444 00000 n +0000198670 00000 n +0000198772 00000 n +0000198998 00000 n +0000199163 00000 n +0000199399 00000 n +0000199525 00000 n +0000199765 00000 n +0000199955 00000 n +0000200213 00000 n +0000200385 00000 n +0000200632 00000 n +0000200825 00000 n +0000201083 00000 n +0000201206 00000 n +0000201448 00000 n +0000201620 00000 n +0000201862 00000 n +0000202052 00000 n +0000202304 00000 n +0000202472 00000 n +0000202700 00000 n +0000202878 00000 n +0000203125 00000 n +0000203245 00000 n +0000203469 00000 n +0000203674 00000 n +0000203934 00000 n +0000204054 00000 n +0000204274 00000 n +0000204488 00000 n +0000204755 00000 n +0000204857 00000 n +0000205067 00000 n +0000205166 00000 n +0000205363 00000 n +0000205565 00000 n +0000205817 00000 n +0000205895 00000 n +0000206083 00000 n +0000206143 00000 n +0000206314 00000 n +0000206437 00000 n +0000206663 00000 n +0000206741 00000 n +0000206929 00000 n +0000206992 00000 n +0000207164 00000 n +0000207251 00000 n +0000207447 00000 n +0000207534 00000 n +0000207725 00000 n +0000207895 00000 n +0000208006 00000 n +0000208231 00000 n +0000208475 00000 n +0000208797 00000 n +0000209068 00000 n +0000209432 00000 n +0000209712 00000 n +0000210086 00000 n +0000210348 00000 n +000021... [truncated message content] |
From: <rom...@us...> - 2006-12-31 08:18:38
|
Revision: 822 http://svn.sourceforge.net/pygccxml/?rev=822&view=rev Author: roman_yakovenko Date: 2006-12-31 00:18:38 -0800 (Sun, 31 Dec 2006) Log Message: ----------- adding new trasnformer - type_modifier Modified Paths: -------------- pyplusplus_dev/pyplusplus/function_transformers/__init__.py pyplusplus_dev/pyplusplus/function_transformers/transformers.py pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp pyplusplus_dev/unittests/function_transformations_tester.py Modified: pyplusplus_dev/pyplusplus/function_transformers/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/function_transformers/__init__.py 2006-12-29 19:07:42 UTC (rev 821) +++ pyplusplus_dev/pyplusplus/function_transformers/__init__.py 2006-12-31 08:18:38 UTC (rev 822) @@ -44,3 +44,8 @@ def creator( function ): return transformers.output_static_array_t( function, *args, **keywd ) return creator + +def modify_type( *args, **keywd ): + def creator( function ): + return transformers.type_modifier_t( function, *args, **keywd ) + return creator Modified: pyplusplus_dev/pyplusplus/function_transformers/transformers.py =================================================================== --- pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2006-12-29 19:07:42 UTC (rev 821) +++ pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2006-12-31 08:18:38 UTC (rev 822) @@ -66,7 +66,7 @@ % ( function, self.arg_ref.name, arg.type) def __str__(self): - return "output(%d)"%(self.arg_index) + return "output(%d)"%(self.arg.name) def required_headers( self ): """Returns list of header files that transformer generated code depends on.""" @@ -103,39 +103,31 @@ def configure_virtual_mem_fun( self, controller ): self.__configure_v_mem_fun_default( controller.default_controller ) self.__configure_v_mem_fun_override( controller.override_controller ) - - + # input_t -class input_t(transformer.transformer_t): - """Handles a single input variable. - - The reference on the specified variable is removed. - - void setValue(int& v) -> setValue(v) +class type_modifier_t(transformer.transformer_t): + """Change/modify type of the argument. + + Right now compiler should be able to use implicit conversion """ - def __init__(self, function, arg_ref): + def __init__(self, function, arg_ref, modifier): """Constructor. - The specified argument must be a reference or a pointer. - - @param idx: Index of the argument that is an output value (the first arg has index 1). - @type idx: int + modifier is callable, which take the type of the argument and should return + new type """ transformer.transformer_t.__init__( self, function ) self.arg = self.get_argument( arg_ref ) self.arg_index = self.function.arguments.index( self.arg ) + self.modifier = modifier - if not is_ref_or_ptr( self.arg.type ): - raise ValueError( '%s\nin order to use "input" transformation, argument %s type must be a reference or a pointer (got %s).' ) \ - % ( function, self.arg_ref.name, arg.type) - def __str__(self): - return "input(%d)"%(self.idx) + return "type_modifier(%s)" % self.arg.name def __configure_sealed( self, controller ): w_arg = controller.find_wrapper_arg( self.arg.name ) - w_arg.type = remove_ref_or_ptr( self.arg.type ) + w_arg.type = self.modifier( self.arg.type ) def __configure_v_mem_fun_default( self, controller ): self.__configure_sealed( controller ) @@ -147,8 +139,35 @@ self.__configure_sealed( controller ) def configure_virtual_mem_fun( self, controller ): - self.__configure_v_mem_fun_default( controller.default_controller ) + self.__configure_v_mem_fun_default( controller.default_controller ) + +# input_t +class input_t(type_modifier_t): + """Handles a single input variable. + + The reference on the specified variable is removed. + + void setValue(int& v) -> setValue(v) + """ + + def __init__(self, function, arg_ref): + """Constructor. + + The specified argument must be a reference or a pointer. + + @param idx: Index of the argument that is an output value (the first arg has index 1). + @type idx: int + """ + type_modifier_t.__init__( self, function, arg_ref, remove_ref_or_ptr ) + + if not is_ref_or_ptr( self.arg.type ): + raise ValueError( '%s\nin order to use "input" transformation, argument %s type must be a reference or a pointer (got %s).' ) \ + % ( function, self.arg_ref.name, arg.type) + + def __str__(self): + return "input(%s)"%(self.arg.name) + # inout_t class inout_t(transformer.transformer_t): """Handles a single input/output variable. @@ -173,7 +192,7 @@ % ( function, self.arg_ref.name, arg.type) def __str__(self): - return "inout(%d)"%(self.arg_index) + return "inout(%s)"%(self.arg.name) def __configure_sealed(self, controller): w_arg = controller.find_wrapper_arg( self.arg.name ) @@ -230,7 +249,7 @@ if not is_ptr_or_array( self.arg.type ): raise ValueError( '%s\nin order to use "input_array" transformation, argument %s type must be a array or a pointer (got %s).' ) \ - % ( function, self.arg_ref.name, arg.type) + % ( function, self.arg.name, self.arg.type) self.array_size = size self.array_item_type = declarations.array_item_type( self.arg.type ) @@ -308,7 +327,7 @@ if not is_ptr_or_array( self.arg.type ): raise ValueError( '%s\nin order to use "input_array" transformation, argument %s type must be a array or a pointer (got %s).' ) \ - % ( function, self.arg_ref.name, arg.type) + % ( function, self.arg.name, self.arg.type) self.array_size = size self.array_item_type = declarations.array_item_type( self.arg.type ) Modified: pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2006-12-29 19:07:42 UTC (rev 821) +++ pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2006-12-31 08:18:38 UTC (rev 822) @@ -208,6 +208,12 @@ } }; +struct modify_type_tester_t{ + int do_nothing( int& v ){ + return v; + } +}; + } #endif//__function_transformations_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/function_transformations_tester.py =================================================================== --- pyplusplus_dev/unittests/function_transformations_tester.py 2006-12-29 19:07:42 UTC (rev 821) +++ pyplusplus_dev/unittests/function_transformations_tester.py 2006-12-31 08:18:38 UTC (rev 822) @@ -8,6 +8,7 @@ import math import unittest import fundamental_tester_base +from pygccxml import declarations from pyplusplus import function_transformers as ft from pyplusplus.module_builder import call_policies @@ -69,6 +70,10 @@ cls = mb.class_("bug_render_target_t") cls.mem_fun("get_statistics", arg_types=['float &']*2).add_transformation( ft.output(0), ft.output(1) ) + + cls = mb.class_( 'modify_type_tester_t' ) + do_nothing = cls.mem_fun( 'do_nothing' ) + do_nothing.add_transformation( ft.modify_type(0, declarations.remove_reference ) ) def run_tests(self, module): """Run the actual unit tests. @@ -214,6 +219,9 @@ tmp.get_statistics() self.failUnless( 2.0 + 3.0 == module.bug_render_target_t.get_static_statistics( tmp ) ) + tmp = module.modify_type_tester_t() + self.failUnless( 123 == tmp.do_nothing(123) ) + def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-29 19:07:42
|
Revision: 821 http://svn.sourceforge.net/pygccxml/?rev=821&view=rev Author: roman_yakovenko Date: 2006-12-29 11:07:42 -0800 (Fri, 29 Dec 2006) Log Message: ----------- adding new use case for smart_ptr Modified Paths: -------------- pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/bindings.cpp pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/classes.hpp pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/test.py pyplusplus_dev/examples/pyboost_dev/dev/rational/generate_code.py Modified: pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/bindings.cpp =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/bindings.cpp 2006-12-28 19:40:19 UTC (rev 820) +++ pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/bindings.cpp 2006-12-29 19:07:42 UTC (rev 821) @@ -3,20 +3,26 @@ namespace bp = boost::python; -// "get_pointer" function returns pointer to the object managed by smart pointer -// class instance +//namespace boost{ + // "get_pointer" function returns pointer to the object managed by smart pointer + // class instance -template<class T> -inline T * get_pointer(smart_ptr_t<T> const& p){ - return p.get(); -} + template<class T> + inline T * get_pointer(smart_ptr_t<T> const& p){ + return p.get(); + } -inline derived_t * get_pointer(derived_ptr_t const& p){ - return p.get(); -} - + inline derived_t * get_pointer(derived_ptr_t const& p){ + return p.get(); + } +//} + +//using boost::get_pointer; + namespace boost{ namespace python{ + using boost::get_pointer; + // "pointee" class tells Boost.Python the type of the object managed by smart // pointer class. // You can read more about "pointee" class here: @@ -34,6 +40,7 @@ } } + // "get_pointer" and "pointee" are needed, in order to allow Boost.Python to // work with user defined smart pointer @@ -116,7 +123,14 @@ bp::def( "val_get_value", &::val_get_value ); bp::def( "create_derived", &::create_derived ); bp::def( "create_base", &::create_base ); - + + + bp::class_< numeric_t, smart_ptr_t< numeric_t > >( "numeric_t" ) + .def_readwrite( "value", &numeric_t::value ); + + bp::def( "create_numeric", &::create_numeric ); + bp::def( "get_numeric_value", &::get_numeric_value ); + // Work around for the public member variable, where type of the variable // is smart pointer problem bp::class_< shared_data::buffer_t >( "buffer_t" ) Modified: pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/classes.hpp =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/classes.hpp 2006-12-28 19:40:19 UTC (rev 820) +++ pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/classes.hpp 2006-12-29 19:07:42 UTC (rev 821) @@ -13,7 +13,7 @@ derived_t(){} virtual int get_value() const{ return 0xD; } }; - + // Some smart pointer classes does not have reach interface as boost ones. // In order to provide same level of convenience, users are forced to create // classes, which derive from smart pointer class. @@ -94,6 +94,32 @@ return a->get_value(); } + +struct numeric_t{ + numeric_t() + : value(0) + {} + + int value; +}; + +smart_ptr_t< numeric_t > create_numeric( int value ){ + smart_ptr_t< numeric_t > num( new numeric_t() ); + num->value = value; + return num; +} + +int get_numeric_value( smart_ptr_t< numeric_t > n ){ + if( n.get() ){ + return n->value; + } + else{ + return 0; + } +} + + + namespace shared_data{ // Boost.Python has small problem with user defined smart pointers and public Modified: pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/test.py =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/test.py 2006-12-28 19:40:19 UTC (rev 820) +++ pyplusplus_dev/docs/bpl_lessons_learned/smart_ptrs/test.py 2006-12-29 19:07:42 UTC (rev 821) @@ -68,6 +68,14 @@ self.fail("TypeError exception was not raised.") except TypeError: pass + + def test_numeric( self ): + numeric = custom_sptr.create_numeric(21) + self.failUnless( 21 == numeric.value ) + self.failUnless( 21 == custom_sptr.get_numeric_value(numeric) ) + numeric = custom_sptr.numeric_t() + self.failUnless( 0 == numeric.value ) + self.failUnless( 0 == custom_sptr.get_numeric_value(numeric) ) def create_suite(): suite = unittest.TestSuite() Modified: pyplusplus_dev/examples/pyboost_dev/dev/rational/generate_code.py =================================================================== --- pyplusplus_dev/examples/pyboost_dev/dev/rational/generate_code.py 2006-12-28 19:40:19 UTC (rev 820) +++ pyplusplus_dev/examples/pyboost_dev/dev/rational/generate_code.py 2006-12-29 19:07:42 UTC (rev 821) @@ -58,8 +58,8 @@ bad_rational = self.__mb.class_('bad_rational' ) bad_rational.include() - self.__mb.free_function( 'lcm<long>' ).include() - self.__mb.free_function( 'gcd<long>' ).include() + self.__mb.namespace( 'boost' ).free_function( 'lcm<long>', recursive=False ).include() + self.__mb.namespace( 'boost' ).free_function( 'gcd<long>', recursive=False ).include() self.__mb.free_function( 'rational_cast<double, long>' ).include() self.__mb.free_function( 'rational_cast<double, long>' ).alias = 'to_double' self.__mb.free_function( 'rational_cast<long, long>' ).include() @@ -106,4 +106,4 @@ export() print 'done' - \ No newline at end of file + 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...> - 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 06:07:38
|
Revision: 818 http://svn.sourceforge.net/pygccxml/?rev=818&view=rev Author: roman_yakovenko Date: 2006-12-27 22:07:36 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Modified Paths: -------------- graphical_installer/setup.py Modified: graphical_installer/setup.py =================================================================== --- graphical_installer/setup.py 2006-12-27 20:31:01 UTC (rev 817) +++ graphical_installer/setup.py 2006-12-28 06:07:36 UTC (rev 818) @@ -2,54 +2,55 @@ import os import re import sys +import utils +import config import shutil import tarfile -import widgets -from environment import config - 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 ) - config.logger.info( 'executing command: %s' % cmd ) + utils.logger.info( 'executing command: %s' % cmd ) input, output = os.popen4( cmd ) input.close() reports = [] while True: data = output.readline() - config.logger.info( data ) + utils.logger.info( data ) if not data: break exit_status = output.close() if None is exit_status: exit_status = 0 else: - config.logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) + utils.logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) return exit_status def build_gccxml(): - config.logger.info( 'create environment for building GCC_XML' ) + 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 ): - config.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) + utils.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 ) + utils.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) else: - config.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) + utils.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) + utils.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 ) + utils.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) + 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] @@ -79,18 +80,35 @@ tmp = file( gccxml_config_file, 'w+' ) tmp.write( gccxml_config ) tmp.close() - config.logger.info( 'copying GCC_XML files to the install directory' ) + utils.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' ) + utils.logger.info( 'copying GCC_XML files to the install directory - done' ) else: execute( config.cmake.native_build, 'install' ) - #TODO remove build directory - + 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 = widgets.load_dir( "Select directory GCC_XML will be installed in" ) + config.gccxml_install_dir = utils.load_dir( "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: - config.logger.info( 'extracting "%s"' % arch ) + utils.logger.info( 'extracting "%s"' % arch ) tarfile.TarFile( arch, "r" ).extractall( config.working_dir ) - config.logger.info( 'extracting "%s" - done' % arch ) + 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...> - 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-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 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 11:36:15
|
Revision: 814 http://svn.sourceforge.net/pygccxml/?rev=814&view=rev Author: roman_yakovenko Date: 2006-12-27 03:36:14 -0800 (Wed, 27 Dec 2006) Log Message: ----------- fixing small bug Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-12-25 15:47:10 UTC (rev 813) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-12-27 11:36:14 UTC (rev 814) @@ -368,7 +368,7 @@ calldef_t.__init__( self ) def _get_alias( self): - if not self._alias or self.name == super( member_operator_t, self )._get_alias(): + if not self._alias or self.name == super( casting_operator_t, self )._get_alias(): return_type = declarations.remove_alias( self.return_type ) decl_string = return_type.decl_string for type_, alias in self.SPECIAL_CASES.items(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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-25 08:59:48
|
Revision: 812 http://svn.sourceforge.net/pygccxml/?rev=812&view=rev Author: roman_yakovenko Date: 2006-12-25 00:59:48 -0800 (Mon, 25 Dec 2006) Log Message: ----------- I have better idea for installer Removed Paths: ------------- pygccxml_dev/gccxml_installer/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-21 07:17:50
|
Revision: 811 http://svn.sourceforge.net/pygccxml/?rev=811&view=rev Author: roman_yakovenko Date: 2006-12-20 23:17:50 -0800 (Wed, 20 Dec 2006) Log Message: ----------- small doc fix Modified Paths: -------------- pyplusplus_dev/announcement.txt Modified: pyplusplus_dev/announcement.txt =================================================================== --- pyplusplus_dev/announcement.txt 2006-12-21 06:46:12 UTC (rev 810) +++ pyplusplus_dev/announcement.txt 2006-12-21 07:17:50 UTC (rev 811) @@ -30,7 +30,7 @@ * Adding new algorithm, which controls the registration order of the functions. http://language-binding.net/pyplusplus/documentation/functions/registration_order.html -* Added new "Py++" defined `return_pointee_value`_ call policy: +* Added new "Py++" defined "return_pointee_value" call policy: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies * Opaque types are fully supported: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-21 06:46:11
|
Revision: 810 http://svn.sourceforge.net/pygccxml/?rev=810&view=rev Author: roman_yakovenko Date: 2006-12-20 22:46:12 -0800 (Wed, 20 Dec 2006) Log Message: ----------- small fix Modified Paths: -------------- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest Modified: pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest 2006-12-21 06:27:28 UTC (rev 809) +++ pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest 2006-12-21 06:46:12 UTC (rev 810) @@ -59,7 +59,7 @@ } The second approach is a little bit "evil" because it redefines ``get_pointer`` -function for all shared pointer classes. So you should be careful. +function for all shared pointer class instantiations. So you should be careful. Files ----- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-12-21 06:27:28
|
Revision: 809 http://svn.sourceforge.net/pygccxml/?rev=809&view=rev Author: roman_yakovenko Date: 2006-12-20 22:27:28 -0800 (Wed, 20 Dec 2006) Log Message: ----------- adding doc Modified Paths: -------------- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest Added Paths: ----------- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch.rest Added: pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch (rev 0) +++ pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch 2006-12-21 06:27:28 UTC (rev 809) @@ -0,0 +1,99 @@ +*** pointer_holder.hpp.orig 2006-11-24 22:39:59.000000000 +0200 +--- pointer_holder.hpp 2006-12-08 20:05:58.000000000 +0200 +*************** +*** 35,40 **** +--- 35,42 ---- + + # include <boost/detail/workaround.hpp> + ++ # include <boost/type_traits/remove_const.hpp> ++ + namespace boost { namespace python { + + template <class T> class wrapper; +*************** +*** 122,146 **** + template <class Pointer, class Value> + void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only) + { + if (dst_t == python::type_id<Pointer>() + && !(null_ptr_only && get_pointer(this->m_p)) + ) + return &this->m_p; +! +! Value* p = get_pointer(this->m_p); + if (p == 0) + return 0; + + if (void* wrapped = holds_wrapped(dst_t, p, p)) + return wrapped; + +! type_info src_t = python::type_id<Value>(); + return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); + } + + template <class Pointer, class Value> + void* pointer_holder_back_reference<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only) + { + if (dst_t == python::type_id<Pointer>() + && !(null_ptr_only && get_pointer(this->m_p)) + ) +--- 124,153 ---- + template <class Pointer, class Value> + void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only) + { ++ typedef typename boost::remove_const< Value >::type NonConstValue; ++ + if (dst_t == python::type_id<Pointer>() + && !(null_ptr_only && get_pointer(this->m_p)) + ) + return &this->m_p; +! +! Value* tmp = get_pointer(this->m_p); +! NonConstValue* p = const_cast<NonConstValue*>( tmp ); + if (p == 0) + return 0; + + if (void* wrapped = holds_wrapped(dst_t, p, p)) + return wrapped; + +! type_info src_t = python::type_id<NonConstValue>(); + return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); + } + + template <class Pointer, class Value> + void* pointer_holder_back_reference<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only) + { ++ typedef typename boost::remove_const< Value >::type NonConstValue; ++ + if (dst_t == python::type_id<Pointer>() + && !(null_ptr_only && get_pointer(this->m_p)) + ) +*************** +*** 149,160 **** + if (!get_pointer(this->m_p)) + return 0; + +! Value* p = get_pointer(m_p); + + if (dst_t == python::type_id<held_type>()) + return p; + +! type_info src_t = python::type_id<Value>(); + return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); + } + +--- 156,168 ---- + if (!get_pointer(this->m_p)) + return 0; + +! Value* tmp = get_pointer(this->m_p); +! NonConstValue* p = const_cast<NonConstValue*>( tmp ); + + if (dst_t == python::type_id<held_type>()) + return p; + +! type_info src_t = python::type_id<NonConstValue>(); + return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); + } + Added: pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch.rest =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch.rest (rev 0) +++ pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch.rest 2006-12-21 06:27:28 UTC (rev 809) @@ -0,0 +1,3 @@ +.. code-block:: + :language: diff + :source-file: ./pointer_holder.hpp.patch Modified: pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest 2006-12-21 05:44:30 UTC (rev 808) +++ pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/shared_ptr.rest 2006-12-21 06:27:28 UTC (rev 809) @@ -10,46 +10,57 @@ .. include:: ./definition.rest --------- -Solution --------- +--------- +Solutions +--------- -The solution is pretty simple: +There are two possible solutions to the problem. The first one is to fix +Boost.Python library: `pointer_holder.hpp.patch`_ . The patch was contributed +to the library ( 8-December-2006 ) and some day it will be commited to the CVS. +It is also possible to solve the problem, without changing Boost.Python library: + .. code-block:: C++ - namespace boost{ namespace python{ + namespace boost{ + + template<class T> + inline T* get_pointer( boost::shared_ptr<const T> const& p ){ + return const_cast< T* >( p.get() ); + } + + } + + namespace boost{ namespace python{ + + template<class T> + struct pointee< boost::shared_ptr<T const> >{ + typedef T type; + }; + + } } //boost::python - template<class T> - inline T* get_pointer( boost::shared_ptr<const T> const& p ){ - return const_cast<T*>(p.get()); - } - - template<class T> - struct pointee< boost::shared_ptr<const T> >{ - typedef T type; - }; - - } } //boost::python - - namespace utils{ - - template< class T > - register_shared_ptrs_to_python(){ - namespace bpl = boost::python; - bpl::register_ptr_to_python< boost::shared_ptr< T > >(); - bpl::register_ptr_to_python< boost::shared_ptr< const T > >(); - bpl::implicitly_convertible< boost::shared_ptr< T >, boost::shared_ptr< const T > >(); - } - - } - - BOOST_PYTHON_MODULE(...){ - class_< YourClass >( "YourClass" ) - ...; - utils::register_shared_ptrs_to_python< YourClass >(); - } + namespace utils{ + + template< class T > + register_shared_ptrs_to_python(){ + namespace bpl = boost::python; + bpl::register_ptr_to_python< boost::shared_ptr< T > >(); + bpl::register_ptr_to_python< boost::shared_ptr< const T > >(); + bpl::implicitly_convertible< boost::shared_ptr< T >, boost::shared_ptr< const T > >(); + } + + } + + BOOST_PYTHON_MODULE(...){ + class_< YourClass >( "YourClass" ) + ...; + utils::register_shared_ptrs_to_python< YourClass >(); + } +The second approach is a little bit "evil" because it redefines ``get_pointer`` +function for all shared pointer classes. So you should be careful. + Files ----- @@ -62,11 +73,14 @@ * `test.py`_ file contains complete unit tests for the exposed classes +* `pointer_holder.hpp.patch`_ file contains patch for the library + All files contain comments, which describe what and why was done. -.. _`solution.cpp` : ./solution.hpp.html +.. _`solution.cpp` : ./solution.cpp.html .. _`sconstruct` : ./sconstruct.html .. _`test.py` : ./test.py.html +.. _`pointer_holder.hpp.patch` : ./pointer_holder.hpp.patch.html -------- Download This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |