pygccxml-commit Mailing List for C++ Python language bindings (Page 41)
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-08 07:23:21
|
Revision: 858 http://svn.sourceforge.net/pygccxml/?rev=858&view=rev Author: roman_yakovenko Date: 2007-01-07 23:23:19 -0800 (Sun, 07 Jan 2007) Log Message: ----------- adding non overridable tester Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/messages/warnings_.py pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/non_overridable_to_be_exported.cpp pyplusplus_dev/unittests/data/non_overridable_to_be_exported.hpp pyplusplus_dev/unittests/non_overridable_tester.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-01-07 14:32:46 UTC (rev 857) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-01-08 07:23:19 UTC (rev 858) @@ -153,9 +153,7 @@ return algorithm.create_identifier( self, declarations.full_name( self.declaration.parent ) ) def unoverriden_function_body( self ): - msg = r'This function could not be overriden in Python!' - msg = msg + 'Reason: function returns reference to local variable!' - return 'throw std::logic_error("%s");' % msg + return 'throw std::logic_error("%s");' % self.declaration.non_overridable_reason def throw_specifier_code( self ): if self.declaration.does_throw: @@ -256,7 +254,7 @@ } def create_body( self ): - if declarations.is_reference( self.declaration.return_type ): + if not self.declaration.overridable: return self.unoverriden_function_body() template = [] template.append( '%(override)s func_%(alias)s = this->get_override( "%(alias)s" );' ) @@ -665,7 +663,7 @@ } def create_body( self ): - if declarations.is_reference( self.declaration.return_type ): + if not self.declaration.overridable: return self.unoverriden_function_body() template = [] @@ -720,7 +718,7 @@ } def create_body( self ): - if declarations.is_reference( self.declaration.return_type ): + if not self.declaration.overridable: return self.unoverriden_function_body() template = [] Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-01-07 14:32:46 UTC (rev 857) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-01-08 07:23:19 UTC (rev 858) @@ -33,6 +33,7 @@ self._use_default_arguments = True self._create_with_signature = False self._overridable = None + self._non_overridable_reason = None self._transformations = None def get_call_policies(self): @@ -90,7 +91,7 @@ and self.virtuality != declarations.VIRTUALITY_TYPES.NOT_VIRTUAL \ and declarations.is_reference( self.return_type ): self._overridable = False - self._non_overridable_reason = messages.W1003 + self._non_overridable_reason = messages.W1049 else: self._overridable = True self._non_overridable_reason = "" @@ -98,10 +99,18 @@ def set_overridable( self, overridable ): self._overridable = overridable - + overridable = property( get_overridable, set_overridable , doc = get_overridable.__doc__ ) + @property + def non_overridable_reason( self ): + return self._non_overridable_reason + + def mark_as_non_overridable( self, reason ): + self.overridable = False + self._non_overridable_reason = reason + @property def transformations(self): """Get method for property 'function_transformers'. Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py =================================================================== --- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 14:32:46 UTC (rev 857) +++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-08 07:23:19 UTC (rev 858) @@ -145,7 +145,10 @@ W1048 = 'There are two or more aliases within "pyplusplus::aliases" namespace for ' \ 'the class. In order to enjoy from automatic aliasing, the class alias ' \ 'should be unique. Other aliases: %s' - + +W1049 = 'This method could not be overriden in Python - method returns reference ' \ + 'to local variable!' + warnings = globals() for identifier, explanation in warnings.items(): Added: pyplusplus_dev/unittests/data/non_overridable_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/non_overridable_to_be_exported.cpp (rev 0) +++ pyplusplus_dev/unittests/data/non_overridable_to_be_exported.cpp 2007-01-08 07:23:19 UTC (rev 858) @@ -0,0 +1,13 @@ +// 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) + +#include "non_overridable_to_be_exported.hpp" + +namespace non_overridable{ + + +}//non_overridable + + Added: pyplusplus_dev/unittests/data/non_overridable_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/non_overridable_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/non_overridable_to_be_exported.hpp 2007-01-08 07:23:19 UTC (rev 858) @@ -0,0 +1,47 @@ +// 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) + +#ifndef __non_overridable_to_be_exported_hpp__ +#define __non_overridable_to_be_exported_hpp__ +#include <string> + +namespace non_overridables{ + +struct non_overridable_v_t{ + + + static bool test( const non_overridable_v_t& impl ){ + return impl.void_ptr() ? true : false; + } + + + virtual const void* void_ptr() const { + return this; + } + + virtual std::string& string_ref() const { + static std::string x( "string_ref" ); + return x; + } + +}; + +struct non_overridable_pv_t{ + + static bool test( const non_overridable_pv_t& impl ){ + return impl.void_ptr() ? true : false; + } + + virtual void* void_ptr() const = 0; + + virtual std::string& string_ref() const = 0; + +}; + + + +} + +#endif//__non_overridable_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/non_overridable_tester.py =================================================================== --- pyplusplus_dev/unittests/non_overridable_tester.py (rev 0) +++ pyplusplus_dev/unittests/non_overridable_tester.py 2007-01-08 07:23:19 UTC (rev 858) @@ -0,0 +1,63 @@ +# 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 +import sys +import ctypes +import unittest +import fundamental_tester_base +from pyplusplus.module_builder import call_policies + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'non_overridable' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize( self, mb ): + mb.mem_funs( 'string_ref' ).call_policies \ + = call_policies.return_value_policy( call_policies.copy_non_const_reference ) + + non_overridable_pv_t = mb.class_( 'non_overridable_pv_t' ) + non_overridable_pv_t.mem_fun( 'void_ptr' ).mark_as_non_overridable( reason='xxx void*' ) + + def create_pv_derived(self, module): + class py_pv_t( module.non_overridable_pv_t ): + def __init__( self ): + module.non_overridable_pv_t.__init__( self ) + + def void_ptr( self ): + return ctypes.c_void_p( id(self) ) + return py_pv_t() + + def create_v_derived(self, module): + class py_v_t( module.non_overridable_v_t ): + def __init__( self ): + module.non_overridable_v_t.__init__( self ) + + def void_ptr( self ): + return ctypes.c_void_p( id(self) ) + return py_v_t() + + def run_tests( self, module): + x = self.create_pv_derived(module) + self.failUnlessRaises( RuntimeError, module.non_overridable_pv_t.test, x ) + + y = self.create_v_derived(module) + self.failUnlessRaises( ReferenceError, module.non_overridable_v_t.test, y ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2007-01-07 14:32:46 UTC (rev 857) +++ pyplusplus_dev/unittests/test_all.py 2007-01-08 07:23:19 UTC (rev 858) @@ -70,6 +70,7 @@ import function_transformations_tester import throw_tester import duplicate_aliases_tester +import non_overridable_tester def create_suite(times): testers = [ @@ -136,6 +137,7 @@ , function_transformations_tester , throw_tester , duplicate_aliases_tester + , non_overridable_tester ] main_suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-07 14:32:46
|
Revision: 857 http://svn.sourceforge.net/pygccxml/?rev=857&view=rev Author: roman_yakovenko Date: 2007-01-07 06:32:46 -0800 (Sun, 07 Jan 2007) Log Message: ----------- adding support for auto aliasing Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py pyplusplus_dev/pyplusplus/messages/warnings_.py pyplusplus_dev/unittests/classes_tester.py pyplusplus_dev/unittests/data/classes_to_be_exported.hpp Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-01-07 12:51:09 UTC (rev 856) +++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-01-07 14:32:46 UTC (rev 857) @@ -47,18 +47,27 @@ name = self.name return algorithm.create_valid_name( name ) + def __select_alias_directives( self ): + if not isinstance( self, declarations.class_t ): + return [] + return list( set( filter( lambda typedef: typedef.is_directive, self.aliases ) ) ) + def _get_alias(self): if not self._alias: - if declarations.templates.is_instantiation( self.name ): - container_aliases = [ 'value_type', 'key_type', 'mapped_type' ] - if isinstance( self, declarations.class_t ) \ - and 1 == len( set( map( lambda typedef: typedef.name, self.aliases ) ) ) \ - and self.aliases[0].name not in container_aliases: - self._alias = self.aliases[0].name + directives = self.__select_alias_directives() + if 1 == len( directives ): + self._alias = directives[0].name + else: + if declarations.templates.is_instantiation( self.name ): + container_aliases = [ 'value_type', 'key_type', 'mapped_type' ] + if isinstance( self, declarations.class_t ) \ + and 1 == len( set( map( lambda typedef: typedef.name, self.aliases ) ) ) \ + and self.aliases[0].name not in container_aliases: + self._alias = self.aliases[0].name + else: + self._alias = self._generate_valid_name() else: - self._alias = self._generate_valid_name() - else: - self._alias = self.name + self._alias = self.name return self._alias def _set_alias(self, alias): self._alias = alias @@ -132,7 +141,12 @@ if declarations.templates.is_instantiation( self.name ) \ and self.alias == self._generate_valid_name(): msgs.append( messages.W1043 % self.alias ) - + + directives = self.__select_alias_directives() + if 1 < len( directives ): + msgs.append( messages.W1048 + % ', '.join( map( lambda typedef: typedef.name, directives ) ) ) + msgs.extend( self._readme_impl() ) return messages.filter_disabled_msgs( msgs, self.__msgs_to_ignore ) Modified: pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py 2007-01-07 12:51:09 UTC (rev 856) +++ pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py 2007-01-07 14:32:46 UTC (rev 857) @@ -19,3 +19,14 @@ def __init__(self, *arguments, **keywords): declarations.typedef_t.__init__(self, *arguments, **keywords ) decl_wrapper.decl_wrapper_t.__init__( self ) + self.__is_directive = None + + @property + def is_directive( self ): + if None is self.__is_directive: + dpath = declarations.declaration_path( self ) + if len( dpath ) != 4: + self.__is_directive = False + else: + self.__is_directive = dpath[:3] == ['::', 'pyplusplus', 'aliases'] + return self.__is_directive Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py =================================================================== --- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 12:51:09 UTC (rev 856) +++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 14:32:46 UTC (rev 857) @@ -142,6 +142,10 @@ 'of the classes will not be exposed to Python.' \ 'Other classes : %s' +W1048 = 'There are two or more aliases within "pyplusplus::aliases" namespace for ' \ + 'the class. In order to enjoy from automatic aliasing, the class alias ' \ + 'should be unique. Other aliases: %s' + warnings = globals() for identifier, explanation in warnings.items(): Modified: pyplusplus_dev/unittests/classes_tester.py =================================================================== --- pyplusplus_dev/unittests/classes_tester.py 2007-01-07 12:51:09 UTC (rev 856) +++ pyplusplus_dev/unittests/classes_tester.py 2007-01-07 14:32:46 UTC (rev 857) @@ -19,6 +19,9 @@ def customize(self, mb ): mb.class_( 'fundamental2' ).alias = 'FUNDAMENTAL2' + apple = mb.class_( 'apple' ) + self.failUnless( apple.alias == 'the_tastest_fruit' ) + apple.alias = 'apple' def run_tests(self, module): self.failIfRaisesAny( module.fundamental1 ) @@ -52,4 +55,4 @@ unittest.TextTestRunner(verbosity=2).run( create_suite() ) if __name__ == "__main__": - run_suite() \ No newline at end of file + run_suite() Modified: pyplusplus_dev/unittests/data/classes_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/classes_to_be_exported.hpp 2007-01-07 12:51:09 UTC (rev 856) +++ pyplusplus_dev/unittests/data/classes_to_be_exported.hpp 2007-01-07 14:32:46 UTC (rev 857) @@ -97,4 +97,13 @@ }//classes +namespace pyplusplus{ namespace aliases{ + +typedef classes::hierarchical::apple the_tastest_fruit; + +typedef classes::protected_static::protected_static_t PROTECTED_STATIC_T_1; +typedef classes::protected_static::protected_static_t PROTECTED_STATIC_T_2; + +}} + #endif//__classes_to_be_exported_hpp__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-07 12:51:08
|
Revision: 856 http://svn.sourceforge.net/pygccxml/?rev=856&view=rev Author: roman_yakovenko Date: 2007-01-07 04:51:09 -0800 (Sun, 07 Jan 2007) Log Message: ----------- adding new feature - aliases test. Modified Paths: -------------- pyplusplus_dev/pyplusplus/messages/warnings_.py pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.cpp pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.hpp pyplusplus_dev/unittests/duplicate_aliases_tester.py Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py =================================================================== --- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 07:28:43 UTC (rev 855) +++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 12:51:09 UTC (rev 856) @@ -137,6 +137,11 @@ 'The function wrapper can throw any exception. ' \ 'In case of exception in run-time, the behaviour of the program is undefined! ' +W1047 = 'There are two or more classes that use same alias("%s"). ' \ + 'Duplicated aliases causes few problems, but the main one is that some ' \ + 'of the classes will not be exposed to Python.' \ + 'Other classes : %s' + warnings = globals() for identifier, explanation in warnings.items(): Modified: pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py 2007-01-07 07:28:43 UTC (rev 855) +++ pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py 2007-01-07 12:51:09 UTC (rev 856) @@ -19,6 +19,41 @@ def add_exported( self, decl ): self.__exported_decls.append( decl ) + def __select_duplicate_aliases( self, decls ): + duplicated = {} + for decl in decls: + if not duplicated.has_key( decl.alias ): + duplicated[ decl.alias ] = set() + duplicated[ decl.alias ].add( decl ) + for alias, buggy_decls in duplicated.items(): + if 1 == len( buggy_decls ): + del duplicated[ alias ] + return duplicated + + def __report_duplicate_aliases_impl( self, control_decl, duplicated ): + if control_decl.alias in duplicated: + buggy_decls = duplicated[control_decl.alias].copy() + buggy_decls.remove( control_decl ) + warning = messages.W1047 % ( control_decl.alias + , os.linesep.join( map( str, buggy_decls ) ) ) + self.__logger.warn( "%s;%s" % ( control_decl, warning ) ) + + if isinstance( control_decl, declarations.class_t ): + query = lambda i_decl: isinstance( i_decl, declarations.class_types ) \ + and i_decl.ignore == False + i_decls = control_decl.classes( query, recursive=False, allow_empty=True ) + i_duplicated = self.__select_duplicate_aliases( i_decls ) + for i_decl in i_decls: + self.__report_duplicate_aliases_impl( i_decl, i_duplicated ) + + def __report_duplicate_aliases( self ): + decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \ + and isinstance( decl.parent, declarations.namespace_t ) + , self.__exported_decls ) + duplicated = self.__select_duplicate_aliases( decls ) + for decl in decls: + self.__report_duplicate_aliases_impl( decl, duplicated ) + def __is_std_decl( self, decl ): #Every class under std should be exported by Boost.Python and\\or Py++ #Also this is not the case right now, I prefer to hide the warnings @@ -34,6 +69,7 @@ def __build_dependencies( self, decl ): if self.__is_std_decl( decl ): + #TODO add element_type to the list of dependencies return [] #std declarations should be exported by Py++! dependencies = decl.i_depend_on_them(recursive=False) @@ -69,7 +105,7 @@ groups[ id( depend_on_decl ) ].append( dependency ) return groups - def __create_msg( self, dependencies ): + def __create_dependencies_msg( self, dependencies ): depend_on_decl = dependencies[0].find_out_depend_on_declaration() decls = [] for dependency in dependencies: @@ -80,4 +116,5 @@ used_not_exported_decls = self.__find_out_used_but_not_exported() groups = self.__group_by_unexposed( used_not_exported_decls ) for group in groups.itervalues(): - self.__logger.warn( self.__create_msg( group ) ) + self.__logger.warn( self.__create_dependencies_msg( group ) ) + self.__report_duplicate_aliases() Added: pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.cpp (rev 0) +++ pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.cpp 2007-01-07 12:51:09 UTC (rev 856) @@ -0,0 +1,13 @@ +// 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) + +#include "duplicate_aliases_to_be_exported.hpp" + +namespace duplicate_aliases{ + + +}//duplicate_aliases + + Added: pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/duplicate_aliases_to_be_exported.hpp 2007-01-07 12:51:09 UTC (rev 856) @@ -0,0 +1,22 @@ +// 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) + +#ifndef __duplicate_aliases_to_be_exported_hpp__ +#define __duplicate_aliases_to_be_exported_hpp__ + +namespace duplicate_aliases{ + +struct duplicate_aliases_1{}; +struct duplicate_aliases_2{}; +struct duplicate_aliases_3{ + + struct i_duplicate_aliases_4{}; + struct i_duplicate_aliases_5{}; + +}; + +} + +#endif//__duplicate_aliases_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/duplicate_aliases_tester.py =================================================================== --- pyplusplus_dev/unittests/duplicate_aliases_tester.py (rev 0) +++ pyplusplus_dev/unittests/duplicate_aliases_tester.py 2007-01-07 12:51:09 UTC (rev 856) @@ -0,0 +1,38 @@ +# 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 +import sys +import unittest +import fundamental_tester_base +from pyplusplus import code_creators + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'duplicate_aliases' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize(self, mb): + classes = mb.classes( lambda decl: 'duplicate_aliases' in decl.name ) + classes.alias = 'duplicate_aliases' + + def run_tests( self, module): + #check compilation + pass + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2007-01-07 07:28:43 UTC (rev 855) +++ pyplusplus_dev/unittests/test_all.py 2007-01-07 12:51:09 UTC (rev 856) @@ -69,6 +69,7 @@ import declarations_order_bug_tester import function_transformations_tester import throw_tester +import duplicate_aliases_tester def create_suite(times): testers = [ @@ -134,6 +135,7 @@ , declarations_order_bug_tester , function_transformations_tester , throw_tester + , duplicate_aliases_tester ] main_suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-07 07:28:44
|
Revision: 855 http://svn.sourceforge.net/pygccxml/?rev=855&view=rev Author: roman_yakovenko Date: 2007-01-06 23:28:43 -0800 (Sat, 06 Jan 2007) Log Message: ----------- adding warning and xml cache Modified Paths: -------------- pygccxml_dev/pygccxml/parser/scanner.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/messages/warnings_.py pyplusplus_dev/unittests/fundamental_tester_base.py Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-01-07 06:14:07 UTC (rev 854) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-01-07 07:28:43 UTC (rev 855) @@ -322,7 +322,7 @@ if isinstance( calldef, declaration_t ): calldef.name = attrs.get(XML_AN_NAME, '') calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) - throw_stmt = attrs.get( XML_AN_THROW, "" ) + throw_stmt = attrs.get( XML_AN_THROW, None ) if None is throw_stmt: calldef.does_throw = True calldef.exceptions = [] Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-01-07 06:14:07 UTC (rev 854) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-01-07 07:28:43 UTC (rev 855) @@ -208,6 +208,13 @@ return messages.W1011 return '' + def _readme_impl( self ): + msgs = super( member_function_t, self )._readme_impl() + if self.does_throw == False \ + and self.virtuality != declarations.VIRTUALITY_TYPES.NOT_VIRTUAL: + msgs.append( messages.W1046 ) + return msgs + class constructor_t( declarations.constructor_t, calldef_t ): """defines a set of properties, that will instruct Py++ how to expose the constructor""" def __init__(self, *arguments, **keywords): Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py =================================================================== --- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 06:14:07 UTC (rev 854) +++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-07 07:28:43 UTC (rev 855) @@ -132,6 +132,11 @@ 'You can fix this by setting array size to the actual one.' \ 'For more information see "array_t" class documentation.' +W1046 = 'The virtual function was declared with empty throw. ' \ + 'Adding the ability to override the function from Python breaks the exception specification. ' \ + 'The function wrapper can throw any exception. ' \ + 'In case of exception in run-time, the behaviour of the program is undefined! ' + warnings = globals() for identifier, explanation in warnings.items(): Modified: pyplusplus_dev/unittests/fundamental_tester_base.py =================================================================== --- pyplusplus_dev/unittests/fundamental_tester_base.py 2007-01-07 06:14:07 UTC (rev 854) +++ pyplusplus_dev/unittests/fundamental_tester_base.py 2007-01-07 07:28:43 UTC (rev 855) @@ -7,6 +7,7 @@ import sys import unittest import autoconfig +from pygccxml import parser from pyplusplus import module_builder LICENSE = """// Copyright 2004 Roman Yakovenko. @@ -63,7 +64,12 @@ def _create_extension_source_file(self): global LICENSE - mb = module_builder.module_builder_t( [self.__to_be_exported_header] + + xml_file = os.path.split( self.__to_be_exported_header )[1] + xml_file = os.path.join( autoconfig.build_dir, xml_file + '.xml' ) + xml_cached_fc = parser.create_cached_source_fc( self.__to_be_exported_header, xml_file ) + + mb = module_builder.module_builder_t( [xml_cached_fc] , gccxml_path=autoconfig.gccxml.executable , include_paths=[autoconfig.boost.include] , undefine_symbols=['__MINGW32__'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-07 06:14:07
|
Revision: 854 http://svn.sourceforge.net/pygccxml/?rev=854&view=rev Author: roman_yakovenko Date: 2007-01-06 22:14:07 -0800 (Sat, 06 Jan 2007) Log Message: ----------- updating history files Modified Paths: -------------- pygccxml_dev/docs/history/history.rest pyplusplus_dev/docs/history/history.rest pyplusplus_dev/unittests/temp/named_tuple.py Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2007-01-07 05:40:51 UTC (rev 853) +++ pygccxml_dev/docs/history/history.rest 2007-01-07 06:14:07 UTC (rev 854) @@ -18,8 +18,29 @@ * Darren Garnier * Gottfried Ganssauge * Gaetan Lehmann +* Martin Preisler + ------------- +Version 0.8.* +------------- + +1. ``is_base_and_derived`` function was changed. The second argument could be + a tuple, which contains classes. Function returns ``True`` if at least one + class derives from the base one. + +.. line separator + +2. Class ``calldef_t`` has new instance variable - ``does_throw``. It describes + whether the function throws any exception or not. + +.. line separator + +3. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported + function default arguments. Reference to "enum" declaration extracted properly. + Many thanks to Martin Preisler for reporting the bug. + +------------- Version 0.8.5 ------------- Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2007-01-07 05:40:51 UTC (rev 853) +++ pyplusplus_dev/docs/history/history.rest 2007-01-07 06:14:07 UTC (rev 854) @@ -18,6 +18,7 @@ * Georgiy Dernovoy * Gottfried Ganssauge * Andy Miller +* Martin Preisler ------------ Project name @@ -32,7 +33,18 @@ 3. Users always changed the name of the projects. I saw at least 6 different names. + ------------- +Version 0.8.* +------------- + +1. Bug fixes: + + * Declaration of virtual functions that have an exception specification with + an empty throw was fixed. Now the exception specification is generated properly. + Many thanks to Martin Preisler for reporting the bug. + +------------- Version 0.8.5 ------------- Modified: pyplusplus_dev/unittests/temp/named_tuple.py =================================================================== --- pyplusplus_dev/unittests/temp/named_tuple.py 2007-01-07 05:40:51 UTC (rev 853) +++ pyplusplus_dev/unittests/temp/named_tuple.py 2007-01-07 06:14:07 UTC (rev 854) @@ -1,5 +1,5 @@ -# This file has been generated by Py++. - +# This file has been generated by Py++. + # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at @@ -43,4 +43,4 @@ assert a == 0 and b == 1 assert nt[ "a" ] == 0 and nt[ "b" ] == 1 - + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-07 05:40:51
|
Revision: 853 http://svn.sourceforge.net/pygccxml/?rev=853&view=rev Author: roman_yakovenko Date: 2007-01-06 21:40:51 -0800 (Sat, 06 Jan 2007) Log Message: ----------- adding "no-throw" specifier to generated virtual functions Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/calldef.py pygccxml_dev/pygccxml/parser/scanner.py pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/unittests/data/throw_to_be_exported.hpp Modified: pygccxml_dev/pygccxml/declarations/calldef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/calldef.py 2007-01-06 21:55:12 UTC (rev 852) +++ pygccxml_dev/pygccxml/declarations/calldef.py 2007-01-07 05:40:51 UTC (rev 853) @@ -105,13 +105,14 @@ class calldef_t( declaration.declaration_t ): """base class for all "callable" declarations""" - def __init__( self, name='', arguments=None, exceptions=None, return_type=None, has_extern=False ): + def __init__( self, name='', arguments=None, exceptions=None, return_type=None, has_extern=False, does_throw=True ): declaration.declaration_t.__init__( self, name ) if not arguments: arguments = [] self._arguments = arguments if not exceptions: exceptions = [] + self._does_throw = does_throw self._exceptions = exceptions self._return_type = return_type self._has_extern = has_extern @@ -126,6 +127,7 @@ items = [ self.arguments , self.return_type , self.has_extern + , self.does_throw , self._sorted_list( self.exceptions ) ] items.extend( self._get__cmp__call_items() ) return items @@ -136,6 +138,7 @@ return self.return_type == other.return_type \ and self.arguments == other.arguments \ and self.has_extern == other.has_extern \ + and self.does_throw == other.does_throw \ and self._sorted_list( self.exceptions ) \ == other._sorted_list( other.exceptions ) @@ -168,6 +171,16 @@ """list of all optional arguments, the arguments that have default value""" return self.arguments[ len( self.required_args ) : ] + def _get_does_throw(self): + return self._does_throw + def _set_does_throw(self, does_throw): + self._does_throw = does_throw + does_throw = property( _get_does_throw, _set_does_throw, + doc="""If False, than function does not throw any exception. + In this case, function was declared with empty throw + statement. + """) + def _get_exceptions(self): return self._exceptions def _set_exceptions(self, exceptions): Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-01-06 21:55:12 UTC (rev 852) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-01-07 05:40:51 UTC (rev 853) @@ -322,7 +322,16 @@ if isinstance( calldef, declaration_t ): calldef.name = attrs.get(XML_AN_NAME, '') calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) - calldef.exceptions = attrs.get( XML_AN_THROW, "" ).split() + throw_stmt = attrs.get( XML_AN_THROW, "" ) + if None is throw_stmt: + calldef.does_throw = True + calldef.exceptions = [] + elif "" == throw_stmt: + calldef.does_throw = False + calldef.exceptions = [] + else: + calldef.does_throw = True + calldef.exceptions = throw_stmt.split() def __read_member_function( self, calldef, attrs ): self.__read_calldef( calldef, attrs ) Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-01-06 21:55:12 UTC (rev 852) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-01-07 05:40:51 UTC (rev 853) @@ -158,12 +158,16 @@ return 'throw std::logic_error("%s");' % msg def throw_specifier_code( self ): - if not self.declaration.exceptions: - return '' - exceptions = map( lambda exception: - algorithm.create_identifier( self, declarations.full_name( exception ) ) - , self.declaration.exceptions ) - return ' throw( ' + self.PARAM_SEPARATOR.join( exceptions ) + ' )' + if self.declaration.does_throw: + if not self.declaration.exceptions: + return '' + else: + exceptions = map( lambda exception: + algorithm.create_identifier( self, declarations.full_name( exception ) ) + , self.declaration.exceptions ) + return ' throw( ' + self.PARAM_SEPARATOR.join( exceptions ) + ' )' + else: + return ' throw()' class free_function_t( calldef_t ): def __init__( self, function ): Modified: pyplusplus_dev/unittests/data/throw_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/throw_to_be_exported.hpp 2007-01-06 21:55:12 UTC (rev 852) +++ pyplusplus_dev/unittests/data/throw_to_be_exported.hpp 2007-01-07 05:40:51 UTC (rev 853) @@ -18,7 +18,7 @@ struct mem_fun_throw_exception_t{ void raise_nothing() throw() {}; - void raise_nothing(int) throw() {}; + virtual void raise_nothing(int) throw() {}; virtual void raise_always() throw( my_exception ){}; virtual void raise_always(int) throw( my_exception ){}; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-06 21:55:17
|
Revision: 852 http://svn.sourceforge.net/pygccxml/?rev=852&view=rev Author: roman_yakovenko Date: 2007-01-06 13:55:12 -0800 (Sat, 06 Jan 2007) Log Message: ----------- adding new guide, which will cover automatic conversion Modified Paths: -------------- pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest Added Paths: ----------- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/auto_conversion.cpp pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/automatic_conversion.rest pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/definition.rest pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct.rest pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py.rest pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/www_configuration.py Removed Paths: ------------- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/generate_code.py Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/auto_conversion.cpp =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/auto_conversion.cpp (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/auto_conversion.cpp 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,114 @@ +#include "boost/python.hpp" +#include "boost/python/object.hpp" //len function +#include "boost/python/ssize_t.hpp" //ssize_t type definition +#include <string> + +struct point3d_t{ + point3d_t() + : x(0), y(0), z(0) + {} + + int x, y, z; +}; + +namespace bpl = boost::python; + +namespace point3d_conversion{ + +struct to_tuple{ + + to_tuple(){ + bpl::to_python_converter< point3d_t, to_tuple>(); + } + + static PyObject* convert(point3d_t const& pt){ + return bpl::incref( bpl::make_tuple( pt.x, pt.y, pt.z ).ptr() ); + } + +}; + +struct from_tuple{ + + static void* convertible(PyObject* py_seq){ + if( !PySequence_Check( py_seq ) ){ + //check that the argument is a sequence + return 0; + } + bpl::object seq = bpl::object( bpl::handle<>( py_seq ) ); + bpl::ssize_t size = bpl::len( seq ); + if( 3 != size ){ + return 0; + } + for( bpl::ssize_t i = 0; i < 3; ++i ){ + //test that every item in sequence has int type + bpl::object item = seq[i]; + bpl::extract<int> type_checker( item ); + if( !type_checker.check() ){ + return 0; + } + } + return py_seq; + } + + //rvalue_from_python_stage1_data is a class defined in + //boost/python/converter/rvalue_from_python_data.hpp file. The file contains + //nice and not "very" technical explanation about data management for rvalue + //conversions from Python to C++ types. + + //In my words, the rvalue_from_python_stage1_data class contains memory + //needed for construction of appropriate C++ object. The class also manages + //the life time of the constructed C++ object. + + static void + construct( PyObject* py_seq, bpl::converter::rvalue_from_python_stage1_data* data){ + if( !convertible( py_seq ) ){ + bpl::throw_error_already_set(); + } + + //At this point you are exposed to low level implementation details + //of Boost.Python library. You use the reinterpret_cast, in order to get + //access to the number of bytes, needed to store C++ object + typedef bpl::converter::rvalue_from_python_storage<point3d_t> point3d_storage_t; + point3d_storage_t* the_storage = reinterpret_cast<point3d_storage_t*>( data ); + //Now we need to get access to the memory, which will held the object. + void* memory_chunk = the_storage->storage.bytes; + //You should use placement new in order to create object in specific + //location + point3d_t* point = new (memory_chunk) point3d_t(); + //We allocated the memory, now we should tell Boost.Python to manage( free ) + //it later + data->convertible = memory_chunk; + + bpl::object seq = bpl::object( bpl::handle<>( py_seq ) ); + //Now I actually creates the object from the Python tuple + bpl::object tmp = seq[0]; + point->x = bpl::extract< int >( tmp ); + tmp = seq[1]; + point->y = bpl::extract< int >( tmp ); + tmp = seq[2]; + point->z = bpl::extract< int >( tmp ); + } + +}; + +void register_conversion(){ + + bpl::to_python_converter< point3d_t, to_tuple>(); + + bpl::converter::registry::push_back( &from_tuple::convertible + , &from_tuple::construct + , bpl::type_id<point3d_t>() ); +} + +}//namespace point3d_conversion + +point3d_t zero_point() { + return point3d_t(); +} + + +BOOST_PYTHON_MODULE( auto_conversion ){ + point3d_conversion::register_conversion(); + bpl::def("zero_point", &::zero_point); +} + Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/automatic_conversion.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/automatic_conversion.rest (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/automatic_conversion.rest 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,103 @@ +=================================================== +How to register ``shared_ptr<const T>`` conversion? +=================================================== + +.. contents:: Table of contents + +------------ +Introduction +------------ + +.. include:: ./definition.rest + +--------- +Solutions +--------- + +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{ + + 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 + + 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 class instantiations. So you should be careful. + +Files +----- + +* `solution.cpp`_ file contains definition of a class and few functions, which + have ``shared_ptr< T >`` and ``shared_ptr< const T>`` as return type or as an + argument. The file also contains source code that exposes the defined + functionality to Python. + +* `sconstruct`_ file contains build instructions for scons build tool. + +* `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.cpp.html +.. _`sconstruct` : ./sconstruct.html +.. _`test.py` : ./test.py.html +.. _`pointer_holder.hpp.patch` : ./pointer_holder.hpp.patch.html + +-------- +Download +-------- + +https://sourceforge.net/project/showfiles.php?group_id=118209 + + +.. _`Py++` : ./../pyplusplus.html +.. _`pygccxml` : http://www.language-binding.net/pygccxml/pygccxml.html +.. _`SourceForge`: http://sourceforge.net/index.php + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: + Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/definition.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/definition.rest (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/definition.rest 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,3 @@ +Boost.Python allows to define automatic conversion from\\to Python classes. +While this is very, very useful functionality, the documentation for it does not +exist. The example will shed some light on "rvalue"\\"lvalue" converters. \ No newline at end of file Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,10 @@ +#scons build script +SharedLibrary( target=r'auto_conversion' + , source=[ r'auto_conversion.cpp' ] + , LIBS=[ r"boost_python" ] + , LIBPATH=[ r"/home/roman/boost_cvs/bin",r"" ] + , CPPPATH=[ r"/home/roman/boost_cvs" + , r"/usr/include/python2.4" ] + , SHLIBPREFIX='' + , SHLIBSUFFIX='.so' +) Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct.rest (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/sconstruct.rest 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,3 @@ +.. code-block:: + :language: Python + :source-file: ./sconstruct Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,30 @@ +import unittest +import shared_ptr + + +class tester_t( unittest.TestCase ): + def __init__( self, *args ): + unittest.TestCase.__init__( self, *args ) + + def test( self ): + ptr = shared_ptr.create_ptr() + self.failUnless( ptr.text == "ptr" ) + self.failUnless( shared_ptr.read_ptr( ptr ) == "ptr" ) + + const_ptr = shared_ptr.create_const_ptr() + self.failUnless( const_ptr.text == "const ptr" ) + self.failUnless( shared_ptr.read_const_ptr( const_ptr ) == "const ptr" ) + + #testing conversion functionality + self.failUnless( shared_ptr.read_const_ptr( ptr ) == "ptr" ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py.rest (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/test.py.rest 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,3 @@ +.. code-block:: + :language: Python + :source-file: ./test.py Added: pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/www_configuration.py =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/www_configuration.py (rev 0) +++ pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/www_configuration.py 2007-01-06 21:55:12 UTC (rev 852) @@ -0,0 +1,3 @@ +name = 'automatic conversion' +files_to_skip = ['definition.rest'] +names = {} Modified: pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest 2007-01-06 19:27:46 UTC (rev 851) +++ pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest 2007-01-06 21:55:12 UTC (rev 852) @@ -26,6 +26,13 @@ .. _`boost::shared_ptr< const T>` : ./shared_ptr/shared_ptr.html +`automatic conversion`_ + + .. include:: ./automatic_conversion/definition.rest + +.. _`automatic conversion` : ./automatic_conversion/automatic_conversion.html + + .. _`Py++` : ./../pyplusplus.html .. _`pygccxml` : http://www.language-binding.net/pygccxml/pygccxml.html .. _`SourceForge`: http://sourceforge.net/index.php Deleted: pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/generate_code.py =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/generate_code.py 2007-01-06 19:27:46 UTC (rev 851) +++ pyplusplus_dev/docs/troubleshooting_guide/smart_ptrs/generate_code.py 2007-01-06 21:55:12 UTC (rev 852) @@ -1,120 +0,0 @@ -#The code contained in this file will show you how to instruct Py++ to generate -#code, that uses your smart pointer class. -# - -#Advise: -#Using your favorite editor create regular C++ header file and to it next code. -#You don't really need to generate it every time. -# -# template<class T> -# inline T * get_pointer(smart_ptr_t<T> const& p){ -# return p.get(); -# } -# -# template <class T> -# struct pointee< smart_ptr_t<T> >{ -# typedef T type; -# }; - - -HELD_TYPE_TMPL = \ -""" -namespace boost{ namespace python{ - -%(class_name)s* get_pointer( %(class_ptr_name)s const& p ){ - return p.get(); -} - -template <> -struct pointee< %(class_ptr_name)s >{ - typedef %(class_name)s type; -}; - -}}// namespace boost::python -""" - -REGISTER_PTR_TO_PYTHON_TMPL = \ -""" -boost::python::register_ptr_to_python< %(sp_inst_class_name)s >(); -""" - -IMPLICITLY_CONVERTIBLE_TMPL = \ -""" -boost::python::implicitly_convertible< %(derived)s, %(base)s >(); -""" - - -def get_pointee( sp_instantiation ): - #sp_instantiation - reference to smart_ptr_t<XXX> - #returns reference to XXX type/declaration - #I will find m_managed member variable and will find out its type - no_ptr = declarations.remove_pointer( sp_instantiation.variable ('m_managed').type ) - no_alias = declarations.remove_alias( no_ptr ) - return declarations.remove_declarated( no_alias ) - -def expose_single( sp_instantiation ): - #This function instructs Py++ how to expose pointee class functionality - #related to your smart pointer - #sp_instantiation - reference to smart_ptr_t<XXX> - - # You don't need to expose smart_ptr_t< X > class - sp_instantiation.exclude() - - pointee = get_pointee( sp_instantiation ) - - #Our example defines derived_ptr_t class: - #struct derived_ptr_t : public smart_ptr_t< derived_t > - #{...}; - #Next if checks that smart_ptr_t< XXX > class has a derived class - #and "exposes" it. - if sp_instantiation.derived: - assert 1 == len( sp_instantiation.derived ) - sp_derived = sp_instantiation.derived[0].related_class - #You don't want to expose it - sp_derived.exclude() - - #Adding your custom code to pointee class. - #You don't have to warry about order or place of generated code, - #Py++ does it right. - - #Telling Boost.Python how to work with your smart pointer - pointee.add_declaration_code( - HELD_TYPE_TMPL % { 'class_name': pointee.decl_string - , 'class_ptr_name': sp_derived.decl_string } ) - - #Telling Boost.Python about relationship between classes - pointee.add_registration_code( - IMPLICITLY_CONVERTIBLE_TMPL % { 'derived' : sp_derived.decl_string - , 'base' : sp_instantiation.decl_string } - , works_on_instance=False ) - - pointee.add_registration_code( - REGISTER_PTR_TO_PYTHON_TMPL % { 'sp_inst_class_name' : sp_derived.decl_string } - , works_on_instance=False ) - - #Setting class held type - pointee.held_type = 'smart_ptr_t< %s >' % pointee.wrapper_alias - - #Registering relationships between classes - pointee.add_registration_code( - IMPLICITLY_CONVERTIBLE_TMPL % { 'derived' : pointee.held_type - , 'base' : sp_instantiation.decl_string } - , works_on_instance=False ) - - pointee.add_registration_code( - REGISTER_PTR_TO_PYTHON_TMPL % { 'sp_inst_class_name' : sp_instantiation.decl_string } - , works_on_instance=False ) - - #Registering relationships between classes - base_classes = filter( lambda hierarchy_info: hierarchy_info.access_type == 'public', pointee.bases ) - for base in base_classes: - pointee.add_registration_code( - IMPLICITLY_CONVERTIBLE_TMPL % { 'derived' : sp_instantiation.decl_string - , 'base' : 'smart_ptr_t< %s >' % base.related_class.decl_string } - , works_on_instance=False) - -def expose(mb): - sp_instantiations = mb.classes( lambda decl: decl.name.startswith( 'smart_ptr_t' ) ) - map( lambda sp: expose_single( sp ), sp_instantiations ) - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-06 19:27:46
|
Revision: 851 http://svn.sourceforge.net/pygccxml/?rev=851&view=rev Author: roman_yakovenko Date: 2007-01-06 11:27:46 -0800 (Sat, 06 Jan 2007) Log Message: ----------- adding new file ext that should be deleted Modified Paths: -------------- developer_scripts/clean_source_dir.py Modified: developer_scripts/clean_source_dir.py =================================================================== --- developer_scripts/clean_source_dir.py 2007-01-06 19:26:24 UTC (rev 850) +++ developer_scripts/clean_source_dir.py 2007-01-06 19:27:46 UTC (rev 851) @@ -28,6 +28,7 @@ , '*.dat' , '*.ncb' , '*.out' + , '*.dblite' ] to_be_deleted_files = [ '.sconsign' ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-06 19:26:28
|
Revision: 850 http://svn.sourceforge.net/pygccxml/?rev=850&view=rev Author: roman_yakovenko Date: 2007-01-06 11:26:24 -0800 (Sat, 06 Jan 2007) Log Message: ----------- adding new test Modified Paths: -------------- pyplusplus_dev/unittests/temp/named_tuple.py pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/throw_to_be_exported.cpp pyplusplus_dev/unittests/data/throw_to_be_exported.hpp pyplusplus_dev/unittests/throw_tester.py Added: pyplusplus_dev/unittests/data/throw_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/throw_to_be_exported.cpp (rev 0) +++ pyplusplus_dev/unittests/data/throw_to_be_exported.cpp 2007-01-06 19:26:24 UTC (rev 850) @@ -0,0 +1,13 @@ +// 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) + +#include "throw_to_be_exported.hpp" + +namespace throw_exceptions{ + + +}//throw_exceptions + + Added: pyplusplus_dev/unittests/data/throw_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/throw_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/throw_to_be_exported.hpp 2007-01-06 19:26:24 UTC (rev 850) @@ -0,0 +1,29 @@ +// 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) + +#ifndef __throw_to_be_exported_hpp__ +#define __throw_to_be_exported_hpp__ + +namespace throw_exceptions{ + +struct my_exception{ +}; + +inline void raise_nothing() throw() {}; +inline void raise_nothing(int) throw() {}; +inline void raise_always() throw( my_exception ){}; +inline void raise_always(int) throw( my_exception ){}; + +struct mem_fun_throw_exception_t{ + void raise_nothing() throw() {}; + void raise_nothing(int) throw() {}; + virtual void raise_always() throw( my_exception ){}; + virtual void raise_always(int) throw( my_exception ){}; +}; + + +} + +#endif//__throw_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/temp/named_tuple.py =================================================================== --- pyplusplus_dev/unittests/temp/named_tuple.py 2007-01-04 22:05:32 UTC (rev 849) +++ pyplusplus_dev/unittests/temp/named_tuple.py 2007-01-06 19:26:24 UTC (rev 850) @@ -1,5 +1,5 @@ -# This file has been generated by Py++. - +# This file has been generated by Py++. + # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at @@ -43,4 +43,4 @@ assert a == 0 and b == 1 assert nt[ "a" ] == 0 and nt[ "b" ] == 1 - + Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2007-01-04 22:05:32 UTC (rev 849) +++ pyplusplus_dev/unittests/test_all.py 2007-01-06 19:26:24 UTC (rev 850) @@ -68,6 +68,7 @@ import inner_class_bug_tester import declarations_order_bug_tester import function_transformations_tester +import throw_tester def create_suite(times): testers = [ @@ -132,6 +133,7 @@ , inner_class_bug_tester , declarations_order_bug_tester , function_transformations_tester + , throw_tester ] main_suite = unittest.TestSuite() Added: pyplusplus_dev/unittests/throw_tester.py =================================================================== --- pyplusplus_dev/unittests/throw_tester.py (rev 0) +++ pyplusplus_dev/unittests/throw_tester.py 2007-01-06 19:26:24 UTC (rev 850) @@ -0,0 +1,34 @@ +# 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 +import sys +import unittest +import fundamental_tester_base +from pyplusplus import code_creators + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'throw' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def run_tests( self, module): + #check compilation + pass + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() \ 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...> - 2007-01-04 22:05:31
|
Revision: 849 http://svn.sourceforge.net/pygccxml/?rev=849&view=rev Author: roman_yakovenko Date: 2007-01-04 14:05:32 -0800 (Thu, 04 Jan 2007) Log Message: ----------- changing gccml location Modified Paths: -------------- pyplusplus_dev/environment.py Modified: pyplusplus_dev/environment.py =================================================================== --- pyplusplus_dev/environment.py 2007-01-04 22:04:45 UTC (rev 848) +++ pyplusplus_dev/environment.py 2007-01-04 22:05:32 UTC (rev 849) @@ -37,7 +37,7 @@ boost.libs = [ '/home/roman/boost_cvs/libs/python/build/bin-stage' ] boost.include = '/home/roman/boost_cvs' python.include = '/usr/include/python2.4' - gccxml.executable = '/home/roman/gccxml-build/bin/gccxml' + gccxml.executable = '/home/roman/gccxml/bin/gccxml' _my_path = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 22:04:48
|
Revision: 848 http://svn.sourceforge.net/pygccxml/?rev=848&view=rev Author: roman_yakovenko Date: 2007-01-04 14:04:45 -0800 (Thu, 04 Jan 2007) Log Message: ----------- fixing bug reported by Martin Preisler Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py Modified: pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py 2007-01-04 21:44:37 UTC (rev 847) +++ pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py 2007-01-04 22:04:45 UTC (rev 848) @@ -141,6 +141,9 @@ base_type = declarations.remove_alias( base_type ) decl = base_type.declaration + if declarations.is_class_declaration( decl ): + return None + if decl.is_abstract: return None if declarations.has_destructor( decl ) and not declarations.has_public_destructor( decl ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 21:44:39
|
Revision: 847 http://svn.sourceforge.net/pygccxml/?rev=847&view=rev Author: roman_yakovenko Date: 2007-01-04 13:44:37 -0800 (Thu, 04 Jan 2007) Log Message: ----------- fixing bug reported by Martin Preisler Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/unittests/autoconfig.py Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2007-01-04 21:21:25 UTC (rev 846) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2007-01-04 21:44:37 UTC (rev 847) @@ -394,7 +394,7 @@ all_derived = None if isinstance( derived, class_declaration.class_t ): - all_derived = ( derived ) + all_derived = ( [derived] ) else: #tuple all_derived = derived Modified: pygccxml_dev/pygccxml/parser/patcher.py =================================================================== --- pygccxml_dev/pygccxml/parser/patcher.py 2007-01-04 21:21:25 UTC (rev 846) +++ pygccxml_dev/pygccxml/parser/patcher.py 2007-01-04 21:44:37 UTC (rev 847) @@ -57,11 +57,12 @@ type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) if not declarations.is_enum( type_ ): return False - return type_.declaration.has_value_name( arg.default_value ) + enum_type = declarations.enum_declaration( type_ ) + return enum_type.has_value_name( arg.default_value ) def __fix_unqualified_enum( self, func, arg): type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) - enum_type = type_.declaration + enum_type = declarations.enum_declaration( type_ ) return self.__join_names( enum_type.parent.decl_string, arg.default_value ) def __is_invalid_integral(self, func, arg): Modified: pygccxml_dev/unittests/autoconfig.py =================================================================== --- pygccxml_dev/unittests/autoconfig.py 2007-01-04 21:21:25 UTC (rev 846) +++ pygccxml_dev/unittests/autoconfig.py 2007-01-04 21:44:37 UTC (rev 847) @@ -18,7 +18,7 @@ if sys.platform == 'win32': gccxml_path = r'd:/dev/gccxml_cvs/gccxml-bin/bin/release/gccxml.exe' else: - gccxml_path = '/home/roman/gccxml-build/bin/gccxml' + gccxml_path = '/home/roman/gccxml/bin/gccxml' try: import pygccxml This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 21:21:28
|
Revision: 846 http://svn.sourceforge.net/pygccxml/?rev=846&view=rev Author: roman_yakovenko Date: 2007-01-04 13:21:25 -0800 (Thu, 04 Jan 2007) Log Message: ----------- fixing small bug some files were not copied by "make" command Modified Paths: -------------- installers/install_gccxml.py Modified: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-01-04 20:10:16 UTC (rev 845) +++ installers/install_gccxml.py 2007-01-04 21:21:25 UTC (rev 846) @@ -60,7 +60,17 @@ shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) utils.logger.info( 'copying GCC_XML files to the install directory - done' ) else: + utils.execute( config.cmake.native_build ) utils.execute( config.cmake.native_build, 'install' ) + #for some reason not always next files are copied to the right place + bin_dir = os.path.join( config.gccxml_install_dir, 'bin' ) + share_dir = os.path.join( config.gccxml_install_dir, 'share', 'gccxml-0.7' ) + for f in ( 'gccxml_config', 'gccxml_find_flags' ): + ff_bin = os.path.join( bin_dir, f ) + ff_shared = os.path.join( share_dir, f ) + if not os.path.exists( ff_bin ): + shutil.copyfile( ff_shared, ff_bin ) + utils.logger.info( 'removing GCC_XML build directory' ) shutil.rmtree( build_dir, True ) utils.logger.info( 'removing GCC_XML build directory - done' ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 20:10:17
|
Revision: 845 http://svn.sourceforge.net/pygccxml/?rev=845&view=rev Author: roman_yakovenko Date: 2007-01-04 12:10:16 -0800 (Thu, 04 Jan 2007) Log Message: ----------- rename dir from bpl_lessons_learned to troubleshooting_guide Added Paths: ----------- pyplusplus_dev/docs/troubleshooting_guide/ Removed Paths: ------------- pyplusplus_dev/docs/bpl_lessons_learned/ Copied: pyplusplus_dev/docs/troubleshooting_guide (from rev 843, pyplusplus_dev/docs/bpl_lessons_learned) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 19:37:12
|
Revision: 844 http://svn.sourceforge.net/pygccxml/?rev=844&view=rev Author: roman_yakovenko Date: 2007-01-04 11:37:09 -0800 (Thu, 04 Jan 2007) Log Message: ----------- adding GCC-XML installation notes Modified Paths: -------------- pygccxml_dev/docs/download.rest Modified: pygccxml_dev/docs/download.rest =================================================================== --- pygccxml_dev/docs/download.rest 2007-01-04 11:35:11 UTC (rev 843) +++ pygccxml_dev/docs/download.rest 2007-01-04 19:37:09 UTC (rev 844) @@ -36,20 +36,25 @@ There are few different ways to install GCC-XML on your system: 1. If you use Linux, than I am almost sure your system has "gccxml" package. - Consider to install it using "native"(rpm, deb, portage) packaging system. + Consider to install it using "native"(rpm, deb, portage) packaging system. -2. Install from source code. See `instructions`_ provided by Brad King, the author - of `GCC-XML`_. +.. line separator +2. Another option is to install it from the source code. See `instructions`_ + provided by Brad King, the author of `GCC-XML`_. Installation from sources + is supported for Windows, Linux and Mac platforms. + .. _`instructions` : http://gccxml.org/HTML/Install.html -3. You can use `GCC-XML`_ installer created by me. Go to download page and get - "gccxml_xxx_installer.zip" file. "xxx" is a name of your OS: Windows or Linux. - You will find installation instructions within the file. The setup is basically - small Python script, which installs `GCC-XML`_ to the specified directory. - It works pretty well for me. You don't have to download CMake build system - or something else. +3. You can use `GCC-XML`_ installer created by me. Go to `download page`_ and get + `"gccxml_installer.zip"`_ file. You will find installation instructions within + the file. The setup is basically small Python script, which installs `GCC-XML`_ + to the specified directory. It works pretty well for me on Linux and Windows. + You don't have to download CMake build system or anything else. +.. _`download page` : http://sourceforge.net/project/showfiles.php?group_id=118209&package_id=146545 +.. _`"gccxml_installer.zip"` : http://sourceforge.net/project/showfiles.php?group_id=118209&package_id=146545 + pygccxml -------- In command prompt or shell change current directory to be "pygccxml-X.Y.Z". @@ -74,4 +79,4 @@ indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 - End: \ No newline at end of file + End: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 11:35:11
|
Revision: 843 http://svn.sourceforge.net/pygccxml/?rev=843&view=rev Author: roman_yakovenko Date: 2007-01-04 03:35:11 -0800 (Thu, 04 Jan 2007) Log Message: ----------- extending is_base_and_derived to take a list of possible derived classes Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/unittests/type_traits_tester.py Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2007-01-04 06:46:32 UTC (rev 842) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2007-01-04 11:35:11 UTC (rev 843) @@ -390,13 +390,20 @@ def is_base_and_derived( based, derived ): """returns True, if there is "base and derived" relationship between classes, False otherwise""" assert isinstance( based, class_declaration.class_t ) - assert isinstance( derived, class_declaration.class_t ) + assert isinstance( derived, ( class_declaration.class_t, tuple ) ) - for base_desc in derived.recursive_bases: - if base_desc.related_class == based: - return True + all_derived = None + if isinstance( derived, class_declaration.class_t ): + all_derived = ( derived ) + else: #tuple + all_derived = derived + + for derived_cls in all_derived: + for base_desc in derived_cls.recursive_bases: + if base_desc.related_class == based: + return True return False - + def has_any_non_copyconstructor( type): """returns True, if class has any non "copy constructor", otherwise False""" assert isinstance( type, class_declaration.class_t ) Modified: pygccxml_dev/unittests/type_traits_tester.py =================================================================== --- pygccxml_dev/unittests/type_traits_tester.py 2007-01-04 06:46:32 UTC (rev 842) +++ pygccxml_dev/unittests/type_traits_tester.py 2007-01-04 11:35:11 UTC (rev 843) @@ -129,6 +129,7 @@ , type=declarations.class_t , name='derived' ) self.failUnless( base and derived and declarations.is_base_and_derived( base, derived ) ) + self.failUnless( base and derived and declarations.is_base_and_derived( base, ( derived, derived ) ) ) unrelated1 = declarations.find_declaration( ns.declarations , type=declarations.class_t @@ -232,4 +233,4 @@ unittest.TextTestRunner(verbosity=2).run( create_suite() ) if __name__ == "__main__": - run_suite() \ No newline at end of file + run_suite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-04 06:47:18
|
Revision: 842 http://svn.sourceforge.net/pygccxml/?rev=842&view=rev Author: roman_yakovenko Date: 2007-01-03 22:46:32 -0800 (Wed, 03 Jan 2007) Log Message: ----------- adding new warning adding auto documentation for properties Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/properties.py pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py pyplusplus_dev/pyplusplus/messages/warnings_.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/properties.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/properties.py 2007-01-03 21:19:39 UTC (rev 841) +++ pyplusplus_dev/pyplusplus/decl_wrappers/properties.py 2007-01-04 06:46:32 UTC (rev 842) @@ -15,7 +15,7 @@ It keeps """ - def __init__( self, name, fget, fset=None, doc='', is_static=False ): + def __init__( self, name, fget, fset=None, doc=None, is_static=False ): self._name = name self._fget = fget self._fset = fset @@ -34,9 +34,19 @@ def fset( self ): return self._fset - @property - def doc( self ): + def _get_doc( self ): + if None is self._doc: + doc = ['get'] + if self.fset: + doc.append( r'\\set' ) + doc.append( r' property, built on top of \"%s\"' % self.fget ) + if self.fset: + doc.append( r' and \"%s\"' % self.fset ) + self._doc = '"%s"' % ''.join( doc ) return self._doc + def _set_doc( self, doc ): + self._doc = doc + doc = property( _get_doc, _set_doc ) @property def is_static( self ): Modified: pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py 2007-01-03 21:19:39 UTC (rev 841) +++ pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py 2007-01-04 06:46:32 UTC (rev 842) @@ -101,6 +101,8 @@ return messages.W1033 if self.bits == 0 and self.name == "": return messages.W1034 + if declarations.is_array( self.type ) and declarations.array_size( self.type ) < 1: + return messages.W1045 type_ = declarations.remove_alias( self.type ) type_ = declarations.remove_const( type_ ) if declarations.is_pointer( type_ ): Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py =================================================================== --- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-03 21:19:39 UTC (rev 841) +++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-01-04 06:46:32 UTC (rev 842) @@ -128,6 +128,10 @@ W1044 = 'Py++ created an ugly alias ("%s") for function wrapper.' +W1045 = 'Py++ does not expose static arrays with unknown size. ' \ + 'You can fix this by setting array size to the actual one.' \ + 'For more information see "array_t" class documentation.' + warnings = globals() for identifier, explanation in warnings.items(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-03 21:19:45
|
Revision: 841 http://svn.sourceforge.net/pygccxml/?rev=841&view=rev Author: roman_yakovenko Date: 2007-01-03 13:19:39 -0800 (Wed, 03 Jan 2007) Log Message: ----------- small improvment Modified Paths: -------------- pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch.rest pyplusplus_dev/docs/bpl_lessons_learned/www_configuration.py Added Paths: ----------- pyplusplus_dev/docs/tutorials.rest Modified: 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 2007-01-03 18:15:11 UTC (rev 840) +++ pyplusplus_dev/docs/bpl_lessons_learned/shared_ptr/pointer_holder.hpp.patch.rest 2007-01-03 21:19:39 UTC (rev 841) @@ -1,3 +1,7 @@ +Download: `pointer_holder.hpp.patch`_ + +.. _`pointer_holder.hpp.patch` : pointer_holder.hpp.patch + .. code-block:: :language: diff :source-file: ./pointer_holder.hpp.patch Modified: pyplusplus_dev/docs/bpl_lessons_learned/www_configuration.py =================================================================== --- pyplusplus_dev/docs/bpl_lessons_learned/www_configuration.py 2007-01-03 18:15:11 UTC (rev 840) +++ pyplusplus_dev/docs/bpl_lessons_learned/www_configuration.py 2007-01-03 21:19:39 UTC (rev 841) @@ -1,3 +1,3 @@ -name = 'Boost.Python - lessons learned' +name = 'Boost.Python - troubleshooting guide' main_html_file = 'lessons_learned.html' names = { 'lessons_learned' : 'Boost.Python - lessons learned' } Added: pyplusplus_dev/docs/tutorials.rest =================================================================== --- pyplusplus_dev/docs/tutorials.rest (rev 0) +++ pyplusplus_dev/docs/tutorials.rest 2007-01-03 21:19:39 UTC (rev 841) @@ -0,0 +1,7 @@ +.. raw:: html + + <head><meta http-equiv="refresh" content="0; URL=./documentation/tutorials/tutorials.html"/></head> + <body> + Automatic redirection failed, please go to + <a href="./documentation/tutorials/tutorials.html">./documentation/tutorials/tutorials.html</a> + </body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-03 18:15:10
|
Revision: 840 http://svn.sourceforge.net/pygccxml/?rev=840&view=rev Author: roman_yakovenko Date: 2007-01-03 10:15:11 -0800 (Wed, 03 Jan 2007) Log Message: ----------- fixing some strange behaviour with SVN Added Paths: ----------- installers/utils.py Removed Paths: ------------- installers/utils.1.py Deleted: installers/utils.1.py =================================================================== --- installers/utils.1.py 2007-01-03 18:14:34 UTC (rev 839) +++ installers/utils.1.py 2007-01-03 18:15:11 UTC (rev 840) @@ -1,62 +0,0 @@ -import os -import sys -import tarfile -import logging -import Tkinter -import tkFileDialog - - -def __create_logger(): - logger = logging.getLogger('install') - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - return logger - -logger = __create_logger() - - -def ask_directory(title, root=None): - created = False - if not root: - root = Tkinter.Tk() - root.withdraw() - created = True - dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) - if created: - root.destroy() - return dir_ - -def tar_extract_all( archive, destination_dir ): - tar = tarfile.TarFile( archive, "r" ) - for tarinfo in tar.getmembers(): - if tarinfo.isdir(): - os.makedirs(os.path.join(destination_dir, tarinfo.name), 0777) - else: - tar.extract(tarinfo, destination_dir) - -def execute( command, *args, **keywd): - global logger - cmd_line = [ command ] - for key, value in keywd.items(): - cmd_line.append( '--%s=%s' % ( key, value ) ) - cmd_line.extend( args ) - cmd = ' '.join( cmd_line ) - logger.info( 'executing command: %s' % cmd ) - input, output = os.popen4( cmd ) - input.close() - reports = [] - while True: - data = output.readline() - logger.info( data ) - if not data: - break - exit_status = output.close() - if None is exit_status: - exit_status = 0 - else: - logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) - return exit_status - - Copied: installers/utils.py (from rev 839, installers/utils.1.py) =================================================================== --- installers/utils.py (rev 0) +++ installers/utils.py 2007-01-03 18:15:11 UTC (rev 840) @@ -0,0 +1,62 @@ +import os +import sys +import tarfile +import logging +import Tkinter +import tkFileDialog + + +def __create_logger(): + logger = logging.getLogger('install') + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger + +logger = __create_logger() + + +def ask_directory(title, root=None): + created = False + if not root: + root = Tkinter.Tk() + root.withdraw() + created = True + dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) + if created: + root.destroy() + return dir_ + +def tar_extract_all( archive, destination_dir ): + tar = tarfile.TarFile( archive, "r" ) + for tarinfo in tar.getmembers(): + if tarinfo.isdir(): + os.makedirs(os.path.join(destination_dir, tarinfo.name), 0777) + else: + tar.extract(tarinfo, destination_dir) + +def execute( command, *args, **keywd): + global logger + cmd_line = [ command ] + for key, value in keywd.items(): + cmd_line.append( '--%s=%s' % ( key, value ) ) + cmd_line.extend( args ) + cmd = ' '.join( cmd_line ) + logger.info( 'executing command: %s' % cmd ) + input, output = os.popen4( cmd ) + input.close() + reports = [] + while True: + data = output.readline() + logger.info( data ) + if not data: + break + exit_status = output.close() + if None is exit_status: + exit_status = 0 + else: + logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) + return exit_status + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-03 18:14:40
|
Revision: 839 http://svn.sourceforge.net/pygccxml/?rev=839&view=rev Author: roman_yakovenko Date: 2007-01-03 10:14:34 -0800 (Wed, 03 Jan 2007) Log Message: ----------- fixing some strange behaviour with SVN Added Paths: ----------- installers/utils.1.py Removed Paths: ------------- installers/utils.py Added: installers/utils.1.py =================================================================== --- installers/utils.1.py (rev 0) +++ installers/utils.1.py 2007-01-03 18:14:34 UTC (rev 839) @@ -0,0 +1,62 @@ +import os +import sys +import tarfile +import logging +import Tkinter +import tkFileDialog + + +def __create_logger(): + logger = logging.getLogger('install') + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger + +logger = __create_logger() + + +def ask_directory(title, root=None): + created = False + if not root: + root = Tkinter.Tk() + root.withdraw() + created = True + dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) + if created: + root.destroy() + return dir_ + +def tar_extract_all( archive, destination_dir ): + tar = tarfile.TarFile( archive, "r" ) + for tarinfo in tar.getmembers(): + if tarinfo.isdir(): + os.makedirs(os.path.join(destination_dir, tarinfo.name), 0777) + else: + tar.extract(tarinfo, destination_dir) + +def execute( command, *args, **keywd): + global logger + cmd_line = [ command ] + for key, value in keywd.items(): + cmd_line.append( '--%s=%s' % ( key, value ) ) + cmd_line.extend( args ) + cmd = ' '.join( cmd_line ) + logger.info( 'executing command: %s' % cmd ) + input, output = os.popen4( cmd ) + input.close() + reports = [] + while True: + data = output.readline() + logger.info( data ) + if not data: + break + exit_status = output.close() + if None is exit_status: + exit_status = 0 + else: + logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) + return exit_status + + Deleted: installers/utils.py =================================================================== --- installers/utils.py 2007-01-02 21:34:25 UTC (rev 838) +++ installers/utils.py 2007-01-03 18:14:34 UTC (rev 839) @@ -1,27 +0,0 @@ -import os -import sys -import logging -import Tkinter -import tkFileDialog - -def ask_directory(title, root=None): - created = False - if not root: - root = Tkinter.Tk() - root.withdraw() - created = True - dir_ = tkFileDialog.askdirectory( title=title, mustexist=False ) - if created: - root.destroy() - return dir_ - - -def __create_logger(): - logger = logging.getLogger('install') - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter( logging.Formatter( os.linesep + '%(message)s' ) ) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - return logger - -logger = __create_logger() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 21:34:24
|
Revision: 838 http://svn.sourceforge.net/pygccxml/?rev=838&view=rev Author: roman_yakovenko Date: 2007-01-02 13:34:25 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Modified Paths: -------------- pygccxml_dev/docs/download.rest Modified: pygccxml_dev/docs/download.rest =================================================================== --- pygccxml_dev/docs/download.rest 2007-01-02 21:34:10 UTC (rev 837) +++ pygccxml_dev/docs/download.rest 2007-01-02 21:34:25 UTC (rev 838) @@ -31,12 +31,33 @@ Installation ------------ +GCC-XML +------- +There are few different ways to install GCC-XML on your system: + +1. If you use Linux, than I am almost sure your system has "gccxml" package. + Consider to install it using "native"(rpm, deb, portage) packaging system. + +2. Install from source code. See `instructions`_ provided by Brad King, the author + of `GCC-XML`_. + +.. _`instructions` : http://gccxml.org/HTML/Install.html + +3. You can use `GCC-XML`_ installer created by me. Go to download page and get + "gccxml_xxx_installer.zip" file. "xxx" is a name of your OS: Windows or Linux. + You will find installation instructions within the file. The setup is basically + small Python script, which installs `GCC-XML`_ to the specified directory. + It works pretty well for me. You don't have to download CMake build system + or something else. + +pygccxml +-------- In command prompt or shell change current directory to be "pygccxml-X.Y.Z". -"X.Y.Z" is version of `pygccxml`_. Type next command: +"X.Y.Z" is version of `pygccxml`_. Type next command: | ``python setup.py install`` -After this command complete, you should have installed `pygccxml`_ package. +After this command complete, you should have installed `pygccxml`_ package. ------------ Dependencies This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 21:34:10
|
Revision: 837 http://svn.sourceforge.net/pygccxml/?rev=837&view=rev Author: roman_yakovenko Date: 2007-01-02 13:34:10 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Added Paths: ----------- installers/install_gccxml.py Removed Paths: ------------- installers/install_gccxml.1.py Deleted: installers/install_gccxml.1.py =================================================================== --- installers/install_gccxml.1.py 2007-01-02 21:33:29 UTC (rev 836) +++ installers/install_gccxml.1.py 2007-01-02 21:34:10 UTC (rev 837) @@ -1,99 +0,0 @@ -#step 1 - extract cmake -import os -import re -import sys -import utils -import config -import shutil -import tempfile - -def build_gccxml(working_dir): - utils.logger.info( 'create environment for building GCC_XML' ) - gccxml_src_dir = os.path.join( working_dir, os.path.splitext( config.archives.gccxml )[0] ) - build_dir = gccxml_src_dir + '-build' - - if not os.path.exists( build_dir ): - utils.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) - os.makedirs( build_dir ) - utils.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) - else: - utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) - - if os.path.exists( config.gccxml_install_dir ): - utils.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) - shutil.rmtree( config.gccxml_install_dir ) - utils.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) - else: - utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) - - os.chdir( build_dir ) - - cmake = os.path.join( working_dir - , os.path.splitext( config.archives.cmake )[0] - , 'bin' - , 'cmake' ) - - utils.execute( cmake - , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir - , '-DCMAKE_BUILD_TYPE=release' - , '-G "%s"' % config.cmake.generator - , gccxml_src_dir ) - - utils.execute( config.cmake.native_build ) - if 'win32' == sys.platform: - #On windows GCC_XML does not support installation, so this setup will - #do it. - gccxml_config_file = os.path.join( build_dir, 'bin', 'gccxml_config' ) - gccxml_config = file( gccxml_config_file ).read() - gccxml_config = gccxml_config.replace( 'GCCXML_COMPILER="cl"' - , 'GCCXML_COMPILER="%s"' % config.cmake.compiler ) - - gccxml_root_re = re.compile( r'GCCXML_ROOT=\".*?\"' ) - found = gccxml_root_re.search( gccxml_config ) - gccxml_new_root = 'GCCXML_ROOT="%s"' % config.gccxml_install_dir - gccxml_new_root = gccxml_new_root.replace( '\\', '/' ) - gccxml_config = gccxml_config[:found.start()] + gccxml_new_root + gccxml_config[found.end():] - tmp = file( gccxml_config_file, 'w+' ) - tmp.write( gccxml_config ) - tmp.close() - utils.logger.info( 'copying GCC_XML files to the install directory' ) - shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) - utils.logger.info( 'copying GCC_XML files to the install directory - done' ) - else: - utils.execute( config.cmake.native_build, 'install' ) - utils.logger.info( 'removing GCC_XML build directory' ) - shutil.rmtree( build_dir, True ) - utils.logger.info( 'removing GCC_XML build directory - done' ) - -if __name__ == "__main__": - if 2 == len(sys.argv): - config.gccxml_install_dir = sys.argv[1] - else: - config.gccxml_install_dir = utils.ask_directory( "Select directory GCC_XML will be installed in" ) - if not config.gccxml_install_dir: - utils.logger.info( 'If you want to install GCC_XML you have to provide a directory it will be installed in.' ) - sys.exit(1) - else: - utils.logger.info( 'GCC_XML will be installed in "%s" directory.' % config.gccxml_install_dir) - - utils.logger.info( 'creating temporal directory ...') - working_dir = tempfile.mkdtemp( dir=tempfile.gettempdir() ) - utils.logger.info( 'creating temporal directory - done( "%s" )' % working_dir) - - try: - #decompressing all archives - for arch in config.archives.all: - utils.logger.info( 'extracting "%s"' % arch ) - utils.tar_extract_all( arch, working_dir ) - utils.logger.info( 'extracting "%s" - done' % arch ) - - build_gccxml(working_dir) - - finally: - utils.logger.info( 'removing temporal directory "%s"' % working_dir ) - shutil.rmtree( working_dir ) - utils.logger.info( 'removing temporal directory "%s" - done' % working_dir ) - - utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) - utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) - Copied: installers/install_gccxml.py (from rev 835, installers/install_gccxml.1.py) =================================================================== --- installers/install_gccxml.py (rev 0) +++ installers/install_gccxml.py 2007-01-02 21:34:10 UTC (rev 837) @@ -0,0 +1,99 @@ +#step 1 - extract cmake +import os +import re +import sys +import utils +import config +import shutil +import tempfile + +def build_gccxml(working_dir): + utils.logger.info( 'create environment for building GCC_XML' ) + gccxml_src_dir = os.path.join( working_dir, os.path.splitext( config.archives.gccxml )[0] ) + build_dir = gccxml_src_dir + '-build' + + if not os.path.exists( build_dir ): + utils.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) + os.makedirs( build_dir ) + utils.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) + else: + utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) + + if os.path.exists( config.gccxml_install_dir ): + utils.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) + shutil.rmtree( config.gccxml_install_dir ) + utils.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) + else: + utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) + + os.chdir( build_dir ) + + cmake = os.path.join( working_dir + , os.path.splitext( config.archives.cmake )[0] + , 'bin' + , 'cmake' ) + + utils.execute( cmake + , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir + , '-DCMAKE_BUILD_TYPE=release' + , '-G "%s"' % config.cmake.generator + , gccxml_src_dir ) + + utils.execute( config.cmake.native_build ) + if 'win32' == sys.platform: + #On windows GCC_XML does not support installation, so this setup will + #do it. + gccxml_config_file = os.path.join( build_dir, 'bin', 'gccxml_config' ) + gccxml_config = file( gccxml_config_file ).read() + gccxml_config = gccxml_config.replace( 'GCCXML_COMPILER="cl"' + , 'GCCXML_COMPILER="%s"' % config.cmake.compiler ) + + gccxml_root_re = re.compile( r'GCCXML_ROOT=\".*?\"' ) + found = gccxml_root_re.search( gccxml_config ) + gccxml_new_root = 'GCCXML_ROOT="%s"' % config.gccxml_install_dir + gccxml_new_root = gccxml_new_root.replace( '\\', '/' ) + gccxml_config = gccxml_config[:found.start()] + gccxml_new_root + gccxml_config[found.end():] + tmp = file( gccxml_config_file, 'w+' ) + tmp.write( gccxml_config ) + tmp.close() + utils.logger.info( 'copying GCC_XML files to the install directory' ) + shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) + utils.logger.info( 'copying GCC_XML files to the install directory - done' ) + else: + utils.execute( config.cmake.native_build, 'install' ) + utils.logger.info( 'removing GCC_XML build directory' ) + shutil.rmtree( build_dir, True ) + utils.logger.info( 'removing GCC_XML build directory - done' ) + +if __name__ == "__main__": + if 2 == len(sys.argv): + config.gccxml_install_dir = sys.argv[1] + else: + config.gccxml_install_dir = utils.ask_directory( "Select directory GCC_XML will be installed in" ) + if not config.gccxml_install_dir: + utils.logger.info( 'If you want to install GCC_XML you have to provide a directory it will be installed in.' ) + sys.exit(1) + else: + utils.logger.info( 'GCC_XML will be installed in "%s" directory.' % config.gccxml_install_dir) + + utils.logger.info( 'creating temporal directory ...') + working_dir = tempfile.mkdtemp( dir=tempfile.gettempdir() ) + utils.logger.info( 'creating temporal directory - done( "%s" )' % working_dir) + + try: + #decompressing all archives + for arch in config.archives.all: + utils.logger.info( 'extracting "%s"' % arch ) + utils.tar_extract_all( arch, working_dir ) + utils.logger.info( 'extracting "%s" - done' % arch ) + + build_gccxml(working_dir) + + finally: + utils.logger.info( 'removing temporal directory "%s"' % working_dir ) + shutil.rmtree( working_dir ) + utils.logger.info( 'removing temporal directory "%s" - done' % working_dir ) + + utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) + utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 21:33:33
|
Revision: 836 http://svn.sourceforge.net/pygccxml/?rev=836&view=rev Author: roman_yakovenko Date: 2007-01-02 13:33:29 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Removed Paths: ------------- installers/install_gccxml.py Deleted: installers/install_gccxml.py =================================================================== --- installers/install_gccxml.py 2007-01-02 21:32:53 UTC (rev 835) +++ installers/install_gccxml.py 2007-01-02 21:33:29 UTC (rev 836) @@ -1,115 +0,0 @@ -#step 1 - extract cmake -import os -import re -import sys -import utils -import config -import shutil -import tarfile -import tkFileDialog - -def execute( command, *args, **keywd): - cmd_line = [ command ] - for key, value in keywd.items(): - cmd_line.append( '--%s=%s' % ( key, value ) ) - cmd_line.extend( args ) - cmd = ' '.join( cmd_line ) - utils.logger.info( 'executing command: %s' % cmd ) - input, output = os.popen4( cmd ) - input.close() - reports = [] - while True: - data = output.readline() - utils.logger.info( data ) - if not data: - break - exit_status = output.close() - if None is exit_status: - exit_status = 0 - else: - utils.logger.info( 'executing command: %s - done(%d)' %( cmd, exit_status ) ) - return exit_status - -def build_gccxml(): - utils.logger.info( 'create environment for building GCC_XML' ) - gccxml_src_dir = os.path.join( config.working_dir - , os.path.splitext( config.archives.gccxml )[0] ) - build_dir = gccxml_src_dir + '-build' - - if not os.path.exists( build_dir ): - utils.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) - os.makedirs( build_dir ) - utils.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) - else: - utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) - - if os.path.exists( config.gccxml_install_dir ): - utils.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) - shutil.rmtree( config.gccxml_install_dir ) - utils.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) - else: - utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) - - os.chdir( build_dir ) - - cmake = os.path.join( - config.working_dir - , os.path.splitext( config.archives.cmake )[0] - , 'bin' - , 'cmake' ) - - execute( cmake - , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir - , '-DCMAKE_BUILD_TYPE=release' - , '-G "%s"' % config.cmake.generator - , gccxml_src_dir ) - - execute( config.cmake.native_build ) - if 'win32' == sys.platform: - #On windows GCC_XML does not support installation, so this setup will - #do it. - gccxml_config_file = os.path.join( build_dir, 'bin', 'gccxml_config' ) - gccxml_config = file( gccxml_config_file ).read() - gccxml_config = gccxml_config.replace( 'GCCXML_COMPILER="cl"' - , 'GCCXML_COMPILER="%s"' % config.cmake.compiler ) - - gccxml_root_re = re.compile( r'GCCXML_ROOT=\".*?\"' ) - found = gccxml_root_re.search( gccxml_config ) - gccxml_new_root = 'GCCXML_ROOT="%s"' % config.gccxml_install_dir - gccxml_new_root = gccxml_new_root.replace( '\\', '/' ) - gccxml_config = gccxml_config[:found.start()] + gccxml_new_root + gccxml_config[found.end():] - tmp = file( gccxml_config_file, 'w+' ) - tmp.write( gccxml_config ) - tmp.close() - utils.logger.info( 'copying GCC_XML files to the install directory' ) - shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) - utils.logger.info( 'copying GCC_XML files to the install directory - done' ) - else: - execute( config.cmake.native_build, 'install' ) - utils.logger.info( 'removing GCC_XML build directory' ) - shutil.rmtree( build_dir, True ) - utils.logger.info( 'removing GCC_XML build directory - done' ) - -if __name__ == "__main__": - config.gccxml_install_dir = utils.ask_directory( "Select directory GCC_XML will be installed in" ) - if not config.gccxml_install_dir: - utils.logger.info( 'If you want to install GCC_XML you have to provide a directory it will be installed in.' ) - sys.exit(1) - else: - utils.logger.info( 'GCC_XML will be installed in "%s" directory.' % config.gccxml_install_dir) - #decompressing all archives - for arch in config.archives.all: - utils.logger.info( 'extracting "%s"' % arch ) - tarfile.TarFile( arch, "r" ).extractall( config.working_dir ) - utils.logger.info( 'extracting "%s" - done' % arch ) - build_gccxml() - - for arch in config.archives.all: - x_dir = os.path.join( config.working_dir, os.path.splitext( arch )[0] ) - utils.logger.info( 'removing "%s" directory' % x_dir ) - shutil.rmtree( x_dir ) - utils.logger.info( 'removing "%s" directory - done' % x_dir ) - - utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) - utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 21:32:53
|
Revision: 835 http://svn.sourceforge.net/pygccxml/?rev=835&view=rev Author: roman_yakovenko Date: 2007-01-02 13:32:53 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Added Paths: ----------- installers/install_gccxml.1.py Added: installers/install_gccxml.1.py =================================================================== --- installers/install_gccxml.1.py (rev 0) +++ installers/install_gccxml.1.py 2007-01-02 21:32:53 UTC (rev 835) @@ -0,0 +1,99 @@ +#step 1 - extract cmake +import os +import re +import sys +import utils +import config +import shutil +import tempfile + +def build_gccxml(working_dir): + utils.logger.info( 'create environment for building GCC_XML' ) + gccxml_src_dir = os.path.join( working_dir, os.path.splitext( config.archives.gccxml )[0] ) + build_dir = gccxml_src_dir + '-build' + + if not os.path.exists( build_dir ): + utils.logger.info( 'creating GCC_XML build directory "%s"' % build_dir ) + os.makedirs( build_dir ) + utils.logger.info( 'creating GCC_XML build directory "%s" - done' % build_dir ) + else: + utils.logger.info( 'GCC_XML build directory "%s" already exists' % build_dir ) + + if os.path.exists( config.gccxml_install_dir ): + utils.logger.info( 'creating GCC_XML install directory "%s"' % config.gccxml_install_dir) + shutil.rmtree( config.gccxml_install_dir ) + utils.logger.info( 'creating GCC_XML install directory "%s"- done' % config.gccxml_install_dir ) + else: + utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir) + + os.chdir( build_dir ) + + cmake = os.path.join( working_dir + , os.path.splitext( config.archives.cmake )[0] + , 'bin' + , 'cmake' ) + + utils.execute( cmake + , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir + , '-DCMAKE_BUILD_TYPE=release' + , '-G "%s"' % config.cmake.generator + , gccxml_src_dir ) + + utils.execute( config.cmake.native_build ) + if 'win32' == sys.platform: + #On windows GCC_XML does not support installation, so this setup will + #do it. + gccxml_config_file = os.path.join( build_dir, 'bin', 'gccxml_config' ) + gccxml_config = file( gccxml_config_file ).read() + gccxml_config = gccxml_config.replace( 'GCCXML_COMPILER="cl"' + , 'GCCXML_COMPILER="%s"' % config.cmake.compiler ) + + gccxml_root_re = re.compile( r'GCCXML_ROOT=\".*?\"' ) + found = gccxml_root_re.search( gccxml_config ) + gccxml_new_root = 'GCCXML_ROOT="%s"' % config.gccxml_install_dir + gccxml_new_root = gccxml_new_root.replace( '\\', '/' ) + gccxml_config = gccxml_config[:found.start()] + gccxml_new_root + gccxml_config[found.end():] + tmp = file( gccxml_config_file, 'w+' ) + tmp.write( gccxml_config ) + tmp.close() + utils.logger.info( 'copying GCC_XML files to the install directory' ) + shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir ) + utils.logger.info( 'copying GCC_XML files to the install directory - done' ) + else: + utils.execute( config.cmake.native_build, 'install' ) + utils.logger.info( 'removing GCC_XML build directory' ) + shutil.rmtree( build_dir, True ) + utils.logger.info( 'removing GCC_XML build directory - done' ) + +if __name__ == "__main__": + if 2 == len(sys.argv): + config.gccxml_install_dir = sys.argv[1] + else: + config.gccxml_install_dir = utils.ask_directory( "Select directory GCC_XML will be installed in" ) + if not config.gccxml_install_dir: + utils.logger.info( 'If you want to install GCC_XML you have to provide a directory it will be installed in.' ) + sys.exit(1) + else: + utils.logger.info( 'GCC_XML will be installed in "%s" directory.' % config.gccxml_install_dir) + + utils.logger.info( 'creating temporal directory ...') + working_dir = tempfile.mkdtemp( dir=tempfile.gettempdir() ) + utils.logger.info( 'creating temporal directory - done( "%s" )' % working_dir) + + try: + #decompressing all archives + for arch in config.archives.all: + utils.logger.info( 'extracting "%s"' % arch ) + utils.tar_extract_all( arch, working_dir ) + utils.logger.info( 'extracting "%s" - done' % arch ) + + build_gccxml(working_dir) + + finally: + utils.logger.info( 'removing temporal directory "%s"' % working_dir ) + shutil.rmtree( working_dir ) + utils.logger.info( 'removing temporal directory "%s" - done' % working_dir ) + + utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir ) + utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' ) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-01-02 21:27:48
|
Revision: 834 http://svn.sourceforge.net/pygccxml/?rev=834&view=rev Author: roman_yakovenko Date: 2007-01-02 13:27:47 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Added Paths: ----------- installers/install_gccxml.readme.txt Added: installers/install_gccxml.readme.txt =================================================================== --- installers/install_gccxml.readme.txt (rev 0) +++ installers/install_gccxml.readme.txt 2007-01-02 21:27:47 UTC (rev 834) @@ -0,0 +1,48 @@ +============= +What is this? +============= + install_gccxml.py is platform independent (Windows, Linux) Python script that +will install GCC_XML on your system in a few minutes. No additional software is +needed, except Python 2.4 or higher. + +================= +How does it work? +================= + The directory contains binaries of CMake ( 2.4.5 ) for Linux and Windows. +CMake homepage: http://cmake.org/HTML/Index.html . + + It also contains source code of GCC and GCC_XML. +GCC homepage: http://gcc.gnu.org/ +GCC_XML homepage: http://www.gccxml.org + +I am NOT the author of CMake, GCC and GCC_XML. + +The install script extracts platform dependent archive of CMake. It also extracts +GCC_XML sources. All files are extracted to a temporal directory that is removed +at the end of the install process. When all files are extracted the script +follows instructions published on GCC_XML web site( http://gccxml.org/HTML/Install.html ): + 1. It asks you where you want to install GCC_XML. + 2. It creates GCC_XML build directory + 3. It run CMake to generate native build files. + 4. It calls native build system to create GCC_XML executable. + 5. It installs them into desired directory + +============== +How to run it? +============== + +If you are using Windows, than double click on the "install_gccxml.py" file. +If you are using Linux, than from a shell write: + +python install_gccxml.py + +Optionaly you can pass additional argument GCC_XML install directory. If you +don't do this, the script will ask you to specify the directory. + +========= +Uninstall +========= + All you need to uninstall GCC_XML is to delete the directory you installed +the binaries in. That's all. + +Please report any problem you find with the script to rom...@gm... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |