pygccxml-commit Mailing List for C++ Python language bindings (Page 33)
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-06-13 08:25:35
|
Revision: 1058
http://svn.sourceforge.net/pygccxml/?rev=1058&view=rev
Author: roman_yakovenko
Date: 2007-06-13 01:25:38 -0700 (Wed, 13 Jun 2007)
Log Message:
-----------
making the tester to work
Modified Paths:
--------------
pyplusplus_dev/unittests/transfer_ownership_tester.py
Modified: pyplusplus_dev/unittests/transfer_ownership_tester.py
===================================================================
--- pyplusplus_dev/unittests/transfer_ownership_tester.py 2007-06-13 07:41:59 UTC (rev 1057)
+++ pyplusplus_dev/unittests/transfer_ownership_tester.py 2007-06-13 08:25:38 UTC (rev 1058)
@@ -13,20 +13,20 @@
decref_code = \
"""
-virtual ~%(cls)s(){
- if (this->m_pyobj) {
- //Py_DECREF(this->m_pyobj);
- this->m_pyobj = 0;
+ virtual ~%(cls)s(){
+ if (this->m_pyobj) {
+ //Py_DECREF(this->m_pyobj);
+ this->m_pyobj = 0;
+ }
}
-}
"""
incref_code = \
"""
-if( !this->m_pyobj) {
- this->m_pyobj = boost::python::detail::wrapper_base_::get_owner(*this);
- Py_INCREF(this->m_pyobj);
-}
+ if( !this->m_pyobj) {
+ this->m_pyobj = boost::python::detail::wrapper_base_::get_owner(*this);
+ Py_INCREF(this->m_pyobj);
+ }
"""
impl_conv_code = \
@@ -70,6 +70,9 @@
schedule = mb.mem_fun( 'schedule' )
schedule.add_transformation( ft.transfer_ownership(0), alias='schedule' )
+ simulator = mb.class_( 'simulator_t' )
+ simulator.mem_fun( 'get_event' ).call_policies \
+ = call_policies.return_internal_reference()
def run_tests( self, module):
class py_event_t( module.event_t ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-06-13 07:41:57
|
Revision: 1057
http://svn.sourceforge.net/pygccxml/?rev=1057&view=rev
Author: roman_yakovenko
Date: 2007-06-13 00:41:59 -0700 (Wed, 13 Jun 2007)
Log Message:
-----------
updating documentation
Modified Paths:
--------------
pygccxml_dev/docs/history/history.rest
pyplusplus_dev/docs/history/history.rest
Modified: pygccxml_dev/docs/history/history.rest
===================================================================
--- pygccxml_dev/docs/history/history.rest 2007-06-13 07:34:59 UTC (rev 1056)
+++ pygccxml_dev/docs/history/history.rest 2007-06-13 07:41:59 UTC (rev 1057)
@@ -20,7 +20,13 @@
* Gaetan Lehmann
* Martin Preisler
+-----------
+SVN Version
+-----------
+1. Class ``free_operator_t`` is now able to provide references to the class declarations
+ instances it works on.
+
-------------
Version 0.9.0
-------------
Modified: pyplusplus_dev/docs/history/history.rest
===================================================================
--- pyplusplus_dev/docs/history/history.rest 2007-06-13 07:34:59 UTC (rev 1056)
+++ pyplusplus_dev/docs/history/history.rest 2007-06-13 07:41:59 UTC (rev 1057)
@@ -19,7 +19,7 @@
* Gottfried Ganssauge
* Andy Miller
* Martin Preisler
-
+* Meghana Haridev
------------
Project name
------------
@@ -33,7 +33,16 @@
3. Users always changed the name of the projects. I saw at least 6 different names.
+-----------
+SVN Version
+-----------
+1. Bug fixes:
+
+ * Py++ will not expose free operators, if at least one of the classes, it works
+ on, is not exposed.
+ Many thanks to Meghana Haridev for reporting the bug.
+
-------------
Version 0.9.0
-------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-06-13 07:34:58
|
Revision: 1056
http://svn.sourceforge.net/pygccxml/?rev=1056&view=rev
Author: roman_yakovenko
Date: 2007-06-13 00:34:59 -0700 (Wed, 13 Jun 2007)
Log Message:
-----------
fixing bug caused by user, when he excludes class but not free operators related to the class
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/__init__.py
pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
pyplusplus_dev/pyplusplus/messages/warnings_.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp
pyplusplus_dev/unittests/free_operators_tester.py
Modified: pyplusplus_dev/pyplusplus/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/__init__.py 2007-06-13 07:31:24 UTC (rev 1055)
+++ pyplusplus_dev/pyplusplus/__init__.py 2007-06-13 07:34:59 UTC (rev 1056)
@@ -36,6 +36,13 @@
__version__ = '0.9.0'
+import pygccxml
+if not hasattr( pygccxml, '__revision__' ) or pygccxml.__revision__ < 1053:
+ msg = 'This revision of Py++ requieres pygccxml revision to be ' \
+ 'greater or equal to %d. ' \
+ 'Please install right pygccxml version.'
+ raise AssertionError( msg % pygccxml.__revision__ )
+
#Known issues:
#3.
#~ > > 2. An other difference: when Py++ creates bindings for a set of
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-06-13 07:31:24 UTC (rev 1055)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-06-13 07:34:59 UTC (rev 1056)
@@ -369,6 +369,13 @@
return ''
if not operators_helper.is_supported( oper ):
return messages.W1014 % oper.name
+ if isinstance( oper, declarations.free_operator_t ):
+ #Py++ should find out whether the relevant class is exposed to Python
+ #and if not, than this operator should not be exposed too
+ included = filter( lambda decl: decl.ignore == False, oper.class_types )
+ if not included:
+ return messages.W1052 % str(oper)
+
return ''
class member_operator_t( declarations.member_operator_t, calldef_t ):
Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py
===================================================================
--- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-06-13 07:31:24 UTC (rev 1055)
+++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-06-13 07:34:59 UTC (rev 1056)
@@ -205,10 +205,13 @@
'Be sure to take a look on Py++ defined call policies: '
'http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies' )
-W1051 = warning( 'The function takes as argument (name=%s, pos=%d) "%s" type. '
- 'You have to specify a call policies or to use "Function Transformation" '
- 'functionality.' )
+W1051 = warning(
+ 'The function takes as argument (name=%s, pos=%d) "%s" type. '
+ 'You have to specify a call policies or to use "Function Transformation" '
+ 'functionality.' )
+W1052 = warning(
+ 'Py++ will not expose free operator "%s" - all classes, this operator works on, are excluded.' )
warnings = globals()
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-06-13 07:31:24 UTC (rev 1055)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-06-13 07:34:59 UTC (rev 1056)
@@ -175,16 +175,15 @@
, self.__extmodule.body.creators )
adopt_operator_impl( operator, found )
else:
- arg_type = declarations.base_type( operator.arguments[0].type )
- if isinstance( arg_type, declarations.fundamental_t ):
- arg_type = declarations.base_type( operator.arguments[1].type )
- elif isinstance( arg_type, declarations.declarated_t ) and arg_type.declaration.ignore:
- arg_type = declarations.base_type( operator.arguments[1].type )
- else:
- pass
- assert isinstance( arg_type, declarations.declarated_t )
- found = find( lambda decl: arg_type.declaration is decl
- , self.__extmodule.body.creators )
+ #select all to be exposed declarations
+ included = filter( lambda decl: decl.ignore == False, operator.class_types )
+ if not included:
+ msg = 'Py++ bug found!' \
+ ' For some reason Py++ decided to expose free operator "%s", when all class types related to the operator definition are excluded.' \
+ ' Please report this bug. Thanks! '
+ raise RuntimeError( msg % str( operator ) )
+
+ found = find( lambda decl: included[0] is decl, self.__extmodule.body.creators )
adopt_operator_impl( operator, found )
def _is_registered_smart_pointer_creator( self, creator, db ):
Modified: pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp 2007-06-13 07:31:24 UTC (rev 1055)
+++ pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp 2007-06-13 07:34:59 UTC (rev 1056)
@@ -17,13 +17,16 @@
}
};
+struct rational{
+ int x, y;
+};
+
number operator+( const number& x, int y ){
number z;
z.i = x.i + y;
return z;
}
-
bool operator!( const number& x ){
return !x.i;
}
@@ -38,8 +41,17 @@
return n2;
}
+rational operator*( int i, const rational& r ){
+ rational rr = { r.x * i, r.y };
+ return rr;
+}
+bool operator!( const rational& x ){
+ return !x.x;
}
+
+
+}
#endif//__free_operators_to_be_exported_hpp__
Modified: pyplusplus_dev/unittests/free_operators_tester.py
===================================================================
--- pyplusplus_dev/unittests/free_operators_tester.py 2007-06-13 07:31:24 UTC (rev 1055)
+++ pyplusplus_dev/unittests/free_operators_tester.py 2007-06-13 07:34:59 UTC (rev 1056)
@@ -17,6 +17,9 @@
, tester_t.EXTENSION_NAME
, *args )
+ def customize( self, mb ):
+ mb.class_( 'rational' ).exclude()
+
def run_tests(self, module):
n = module.number()
self.failUnless( not n )
@@ -33,4 +36,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-06-13 07:31:22
|
Revision: 1055
http://svn.sourceforge.net/pygccxml/?rev=1055&view=rev
Author: roman_yakovenko
Date: 2007-06-13 00:31:24 -0700 (Wed, 13 Jun 2007)
Log Message:
-----------
setting right revision
Modified Paths:
--------------
pygccxml_dev/pygccxml/__init__.py
Modified: pygccxml_dev/pygccxml/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/__init__.py 2007-06-13 07:29:13 UTC (rev 1054)
+++ pygccxml_dev/pygccxml/__init__.py 2007-06-13 07:31:24 UTC (rev 1055)
@@ -39,4 +39,4 @@
__version__ = '0.9.0'
-__revision__ = 1053
+__revision__ = 1054
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-06-13 07:29:10
|
Revision: 1054
http://svn.sourceforge.net/pygccxml/?rev=1054&view=rev
Author: roman_yakovenko
Date: 2007-06-13 00:29:13 -0700 (Wed, 13 Jun 2007)
Log Message:
-----------
change revision type to int
Modified Paths:
--------------
pygccxml_dev/pygccxml/__init__.py
Modified: pygccxml_dev/pygccxml/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/__init__.py 2007-06-13 05:44:31 UTC (rev 1053)
+++ pygccxml_dev/pygccxml/__init__.py 2007-06-13 07:29:13 UTC (rev 1054)
@@ -39,4 +39,4 @@
__version__ = '0.9.0'
-__revision__ = '1053'
+__revision__ = 1053
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-06-13 05:44:33
|
Revision: 1053
http://svn.sourceforge.net/pygccxml/?rev=1053&view=rev
Author: roman_yakovenko
Date: 2007-06-12 22:44:31 -0700 (Tue, 12 Jun 2007)
Log Message:
-----------
adding SVN revision number to interface
Modified Paths:
--------------
pygccxml_dev/pygccxml/__init__.py
Modified: pygccxml_dev/pygccxml/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/__init__.py 2007-06-13 05:42:40 UTC (rev 1052)
+++ pygccxml_dev/pygccxml/__init__.py 2007-06-13 05:44:31 UTC (rev 1053)
@@ -38,3 +38,5 @@
# 2. Add "explicit" property for constructors
__version__ = '0.9.0'
+
+__revision__ = '1053'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-06-13 05:42:41
|
Revision: 1052
http://svn.sourceforge.net/pygccxml/?rev=1052&view=rev
Author: roman_yakovenko
Date: 2007-06-12 22:42:40 -0700 (Tue, 12 Jun 2007)
Log Message:
-----------
adding new functionality to free operators - now they are able to report class types, they work on
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/calldef.py
pygccxml_dev/unittests/test_all.py
Added Paths:
-----------
pygccxml_dev/unittests/data/free_operators.hpp
pygccxml_dev/unittests/free_operators_tester.py
Modified: pygccxml_dev/pygccxml/declarations/calldef.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/calldef.py 2007-06-10 19:30:09 UTC (rev 1051)
+++ pygccxml_dev/pygccxml/declarations/calldef.py 2007-06-13 05:42:40 UTC (rev 1052)
@@ -427,10 +427,10 @@
def __init__(self):
object.__init__(self)
- def _get_symbol(self):
+ @property
+ def symbol(self):
+ "operator's symbol. For example: operator+, symbol is equal to '+'"
return self.name[operator_t.OPERATOR_WORD_LEN:].strip()
- symbol = property( _get_symbol,
- doc="returns symbol of operator. For example: operator+, symbol is equal to '+'")
#Third level in hierarchy of calldef
class member_function_t( member_calldef_t ):
@@ -438,7 +438,6 @@
def __init__( self, *args, **keywords ):
member_calldef_t.__init__( self, *args, **keywords )
-
class constructor_t( member_calldef_t ):
"""describes constructor declaration"""
def __init__( self, *args, **keywords ):
@@ -485,6 +484,7 @@
def __init__( self, *args, **keywords ):
member_calldef_t.__init__( self, *args, **keywords )
operator_t.__init__( self, *args, **keywords )
+ self.__class_types = None
class casting_operator_t( member_calldef_t, operator_t ):
"""describes casting operator declaration"""
@@ -502,3 +502,22 @@
def __init__( self, *args, **keywords ):
free_calldef_t.__init__( self, *args, **keywords )
operator_t.__init__( self, *args, **keywords )
+ self.__class_types = None
+
+ @property
+ def class_types( self ):
+ """list of class/class declaration types, extracted from the operator arguments"""
+ if None is self.__class_types:
+ self.__class_types = []
+ for type_ in self.argument_types:
+ decl = None
+ type_ = type_traits.remove_reference( type_ )
+ if type_traits.is_class( type_ ):
+ decl = type_traits.class_traits.get_declaration( type_ )
+ elif type_traits.is_class_declaration( type_ ):
+ decl = type_traits.class_declaration_traits.get_declaration( type_ )
+ else:
+ pass
+ if decl:
+ self.__class_types.append( decl )
+ return self.__class_types
Added: pygccxml_dev/unittests/data/free_operators.hpp
===================================================================
--- pygccxml_dev/unittests/data/free_operators.hpp (rev 0)
+++ pygccxml_dev/unittests/data/free_operators.hpp 2007-06-13 05:42:40 UTC (rev 1052)
@@ -0,0 +1,57 @@
+// 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 __free_operators_to_be_exported_hpp__
+#define __free_operators_to_be_exported_hpp__
+
+namespace free_operators{
+
+struct number{
+ int i;
+
+ number operator*( int ii ) const {
+ number n2 = { i * ii };
+ return n2;
+ }
+};
+
+struct rational{
+ int x, y;
+};
+
+number operator+( const number& x, int y ){
+ number z;
+ z.i = x.i + y;
+ return z;
+}
+
+bool operator!( const number& x ){
+ return !x.i;
+}
+
+number operator*( const number& n, double i ){
+ number n2 = { n.i * i };
+ return n2;
+}
+
+number operator*( double i, const number& n ){
+ number n2 = { n.i * i };
+ return n2;
+}
+
+rational operator*( int i, const rational& r ){
+ rational rr = { r.x * i, r.y };
+ return rr;
+}
+
+bool operator!( const rational& x ){
+ return !x.x;
+}
+
+
+}
+
+
+#endif//__free_operators_to_be_exported_hpp__
Added: pygccxml_dev/unittests/free_operators_tester.py
===================================================================
--- pygccxml_dev/unittests/free_operators_tester.py (rev 0)
+++ pygccxml_dev/unittests/free_operators_tester.py 2007-06-13 05:42:40 UTC (rev 1052)
@@ -0,0 +1,46 @@
+# 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 unittest
+import autoconfig
+import parser_test_case
+
+from pygccxml import utils
+from pygccxml import parser
+from pygccxml import declarations
+
+class tester_t( parser_test_case.parser_test_case_t ):
+ def __init__(self, *args ):
+ parser_test_case.parser_test_case_t.__init__( self, *args )
+ self.header = 'free_operators.hpp'
+ self.global_ns = None
+
+ def setUp(self):
+ reader = parser.source_reader_t( self.config )
+ decls = reader.read_file( self.header )
+ self.global_ns = declarations.get_global_namespace( decls )
+
+ def test( self ):
+ fo = self.global_ns.namespace( 'free_operators' )
+ number = fo.class_( 'number' )
+ rational = fo.class_( 'rational' )
+ for oper in fo.free_operators():
+ if number.name in str( oper ):
+ self.failUnless( number in oper.class_types )
+ if rational.name in str( oper ):
+ self.failUnless( rational in oper.class_types )
+
+
+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: pygccxml_dev/unittests/test_all.py
===================================================================
--- pygccxml_dev/unittests/test_all.py 2007-06-10 19:30:09 UTC (rev 1051)
+++ pygccxml_dev/unittests/test_all.py 2007-06-13 05:42:40 UTC (rev 1052)
@@ -40,6 +40,7 @@
import has_binary_operator_traits_tester
import algorithms_cache_tester
import dependencies_tester
+import free_operators_tester
def create_suite():
testers = [
@@ -79,6 +80,7 @@
, has_binary_operator_traits_tester
, algorithms_cache_tester
, dependencies_tester
+ , free_operators_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-06-10 19:30:07
|
Revision: 1051
http://svn.sourceforge.net/pygccxml/?rev=1051&view=rev
Author: roman_yakovenko
Date: 2007-06-10 12:30:09 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
adding few new test cases
Modified Paths:
--------------
pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp
Modified: pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp 2007-06-03 13:29:46 UTC (rev 1050)
+++ pyplusplus_dev/unittests/data/free_operators_to_be_exported.hpp 2007-06-10 19:30:09 UTC (rev 1051)
@@ -1,29 +1,45 @@
-// 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 __free_operators_to_be_exported_hpp__
-#define __free_operators_to_be_exported_hpp__
-
-namespace free_operators{
-
-struct number{
- int i;
-};
-
-number operator+( const number& x, int y ){
- number z;
- z.i = x.i + y;
- return z;
-}
-
-
-bool operator!( const number& x ){
- return !x.i;
-}
-
-}
-
-
-#endif//__free_operators_to_be_exported_hpp__
+// 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 __free_operators_to_be_exported_hpp__
+#define __free_operators_to_be_exported_hpp__
+
+namespace free_operators{
+
+struct number{
+ int i;
+
+ number operator*( int ii ) const {
+ number n2 = { i * ii };
+ return n2;
+ }
+};
+
+number operator+( const number& x, int y ){
+ number z;
+ z.i = x.i + y;
+ return z;
+}
+
+
+bool operator!( const number& x ){
+ return !x.i;
+}
+
+number operator*( const number& n, double i ){
+ number n2 = { n.i * i };
+ return n2;
+}
+
+number operator*( double i, const number& n ){
+ number n2 = { n.i * i };
+ return n2;
+}
+
+
+}
+
+
+#endif//__free_operators_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-06-03 13:29:58
|
Revision: 1050
http://svn.sourceforge.net/pygccxml/?rev=1050&view=rev
Author: roman_yakovenko
Date: 2007-06-03 06:29:46 -0700 (Sun, 03 Jun 2007)
Log Message:
-----------
adding ability to select compiler
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/config.py
pygccxml_dev/pygccxml/parser/source_reader.py
pygccxml_dev/unittests/autoconfig.py
Modified: pygccxml_dev/pygccxml/parser/config.py
===================================================================
--- pygccxml_dev/pygccxml/parser/config.py 2007-06-03 07:40:11 UTC (rev 1049)
+++ pygccxml_dev/pygccxml/parser/config.py 2007-06-03 13:29:46 UTC (rev 1050)
@@ -29,7 +29,8 @@
, include_paths=None
, define_symbols=None
, undefine_symbols=None
- , cflags=""):
+ , cflags=""
+ , compiler=None):
"""Constructor.
"""
object.__init__( self )
@@ -49,6 +50,8 @@
self.__cflags = cflags
+ self.__compiler = compiler
+
def clone(self):
raise NotImplementedError( self.__class__.__name__ )
@@ -58,23 +61,32 @@
self.__working_directory=working_dir
working_directory = property( __get_working_directory, __set_working_directory )
- def __get_include_paths(self):
+ @property
+ def include_paths(self):
+ """list of include paths to look for header files"""
return self.__include_paths
- include_paths = property( __get_include_paths )
- def __get_define_symbols(self):
+ @property
+ def define_symbols(self):
+ """list of "define" directives """
return self.__define_symbols
- define_symbols = property( __get_define_symbols )
- def __get_undefine_symbols(self):
+ @property
+ def undefine_symbols(self):
+ """list of "undefine" directives """
return self.__undefine_symbols
- undefine_symbols = property( __get_undefine_symbols )
-
+
+ @property
+ def compiler(self):
+ """compiler name to simulate"""
+ return self.__compiler
+
def __get_cflags(self):
return self.__cflags
def __set_cflags(self, val):
self.__cflags = val
- cflags = property( __get_cflags, __set_cflags )
+ cflags = property( __get_cflags, __set_cflags
+ , doc="additional flags to pass to compiler" )
def __ensure_dir_exists( self, dir_path, meaning ):
if os.path.isdir( dir_path ):
@@ -87,6 +99,7 @@
def raise_on_wrong_settings( self ):
+ """validates the configuration settings and raises RuntimeError on error"""
self.__ensure_dir_exists( self.working_directory, 'working directory' )
map( lambda idir: self.__ensure_dir_exists( idir, 'include directory' )
, self.include_paths )
@@ -106,7 +119,8 @@
, undefine_symbols=None
, start_with_declarations=None
, ignore_gccxml_output=False
- , cflags=""):
+ , cflags=""
+ , compiler=None):
"""Constructor.
"""
parser_configuration_t.__init__( self
@@ -114,7 +128,9 @@
, include_paths=include_paths
, define_symbols=define_symbols
, undefine_symbols=undefine_symbols
- , cflags=cflags)
+ , cflags=cflags
+ , compiler=compiler)
+
self.__gccxml_path = gccxml_path
if not start_with_declarations:
@@ -130,17 +146,20 @@
return self.__gccxml_path
def __set_gccxml_path(self, new_path ):
self.__gccxml_path = new_path
- gccxml_path = property( __get_gccxml_path, __set_gccxml_path )
+ gccxml_path = property( __get_gccxml_path, __set_gccxml_path
+ , doc="gccxml binary location" )
- def __get_start_with_declarations(self):
+ @property
+ def start_with_declarations(self):
+ """list of declarations gccxml should start with, when it dumps declaration tree"""
return self.__start_with_declarations
- start_with_declarations = property( __get_start_with_declarations )
def __get_ignore_gccxml_output(self):
return self.__ignore_gccxml_output
def __set_ignore_gccxml_output(self, val=True):
self.__ignore_gccxml_output = val
- ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output )
+ ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output
+ , doc="set this property to True, if you want pygccxml to ignore any error\\warning that comes from gccxml" )
def raise_on_wrong_settings( self ):
@@ -182,7 +201,8 @@
, include_paths=None
, define_symbols=None
, undefine_symbols=None
- , cflags=""):
+ , cflags=""
+ , compiler=None):
"""Constructor.
"""
parser_configuration_t.__init__( self
@@ -190,7 +210,8 @@
, include_paths=include_paths
, define_symbols=define_symbols
, undefine_symbols=undefine_symbols
- , cflags=cflags)
+ , cflags=cflags
+ , compiler=compiler)
def clone(self):
return copy.deepcopy( self )
Modified: pygccxml_dev/pygccxml/parser/source_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/source_reader.py 2007-06-03 07:40:11 UTC (rev 1049)
+++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-06-03 13:29:46 UTC (rev 1050)
@@ -99,6 +99,7 @@
cmd.append( '"%s"' % os.path.normpath( self.__config.gccxml_path ) )
else:
cmd.append( '%s' % os.path.normpath( self.__config.gccxml_path ) )
+
# Add all cflags passed
if self.__config.cflags != "":
cmd.append(" %s "%self.__config.cflags)
@@ -113,7 +114,9 @@
cmd.append( '-fxml="%s"' % xmlfile )
if self.__config.start_with_declarations:
cmd.append( '-fxml-start="%s"' % ','.join( self.__config.start_with_declarations ) )
-
+ # Specify compiler if asked to
+ if self.__config.compiler:
+ cmd.append( " --gccxml-compiler %s" % self.__config.compiler )
cmd_line = ' '.join(cmd)
if 'win32' in sys.platform :
cmd_line = '"%s"' % cmd_line
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2007-06-03 07:40:11 UTC (rev 1049)
+++ pygccxml_dev/unittests/autoconfig.py 2007-06-03 13:29:46 UTC (rev 1050)
@@ -10,12 +10,14 @@
#__pychecker__ = 'limit=1000'
#import pychecker.checker
+compiler = None
gccxml_path = ''
data_directory = os.path.abspath( os.path.join( os.curdir, 'data' ) )
build_dir = os.path.abspath( os.path.join( os.curdir, 'temp' ) )
if 'roman' in getpass.getuser():
if sys.platform == 'win32':
+ compiler = 'msvc71'
gccxml_path = r'd:/dev/gccxml_cvs/gccxml-bin/bin/release/gccxml.exe'
else:
gccxml_path = '/home/roman/gccxml/bin/gccxml'
@@ -32,7 +34,8 @@
class cxx_parsers_cfg:
gccxml = pygccxml.parser.gccxml_configuration_t( gccxml_path=gccxml_path
- , working_directory=data_directory )
+ , working_directory=data_directory
+ , compiler=compiler )
synopsis = pygccxml.parser.synopsis_configuration_t( working_directory=data_directory )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-06-03 07:40:12
|
Revision: 1049
http://svn.sourceforge.net/pygccxml/?rev=1049&view=rev
Author: roman_yakovenko
Date: 2007-06-03 00:40:11 -0700 (Sun, 03 Jun 2007)
Log Message:
-----------
the overridden virtual function bug fix
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/overriden_virtual_functions_bug_to_be_exported.hpp
pyplusplus_dev/unittests/overriden_virtual_functions_bug_tester.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2007-05-28 15:02:03 UTC (rev 1048)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2007-06-03 07:40:11 UTC (rev 1049)
@@ -469,6 +469,10 @@
#should test whether this function has been added or not
for f_impl in not_reimplemented_funcs:
if is_same_function( f, f_impl ):
+ if declarations.is_base_and_derived( f_impl.parent, f.parent ):
+ #add function from the most derived class
+ not_reimplemented_funcs.remove( f_impl )
+ not_reimplemented_funcs.add( f )
break
else:
#should test whether this function is implemented in base class
Added: pyplusplus_dev/unittests/data/overriden_virtual_functions_bug_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/overriden_virtual_functions_bug_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/overriden_virtual_functions_bug_to_be_exported.hpp 2007-06-03 07:40:11 UTC (rev 1049)
@@ -0,0 +1,26 @@
+// 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 __overriden_virtual_functions_bug_to_be_exported_hpp__
+#define __overriden_virtual_functions_bug_to_be_exported_hpp__
+
+namespace vector3{
+
+struct window_t{
+protected:
+ virtual void on_mouse_leaves( int ){};
+};
+
+struct button_based_t : public window_t{
+protected:
+ virtual void on_mouse_leaves( int ){};
+};
+
+struct checkbox_t : public button_based_t{
+};
+
+}
+
+#endif//__overriden_virtual_functions_bug_to_be_exported_hpp__
Added: pyplusplus_dev/unittests/overriden_virtual_functions_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/overriden_virtual_functions_bug_tester.py (rev 0)
+++ pyplusplus_dev/unittests/overriden_virtual_functions_bug_tester.py 2007-06-03 07:40:11 UTC (rev 1049)
@@ -0,0 +1,40 @@
+# 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
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'overriden_virtual_functions_bug'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , *args )
+
+ def customize(self, mb):
+ checkbox = mb.class_('checkbox_t')
+ button_based = mb.class_( 'button_based_t')
+
+ redefined = checkbox.redefined_funcs()
+ self.failUnless( 1 == len(redefined) )
+ self.failUnless( redefined[0].parent is button_based )
+
+ def run_tests(self, module):
+ 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()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-28 15:02:04
|
Revision: 1048
http://svn.sourceforge.net/pygccxml/?rev=1048&view=rev
Author: roman_yakovenko
Date: 2007-05-28 08:02:03 -0700 (Mon, 28 May 2007)
Log Message:
-----------
committing initial implementation of "exclude erronious declarations"
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
pyplusplus_dev/pyplusplus/decl_wrappers/scopedef_wrapper.py
pyplusplus_dev/pyplusplus/messages/warnings_.py
pyplusplus_dev/unittests/algorithms_tester.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-05-27 20:25:17 UTC (rev 1047)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-05-28 15:02:03 UTC (rev 1048)
@@ -11,7 +11,7 @@
from pyplusplus import messages
class decl_wrapper_t(object):
- """code generator declaration configuration base class
+ """code generator declaration configuration base class
This class contains configuration that could be applied to all declarations.
"""
@@ -105,11 +105,15 @@
return self._get_already_exposed_impl()
def _set_already_exposed( self, value ):
self._already_exposed = value
- already_exposed = property( _get_already_exposed, _set_already_exposed
+ already_exposed = property( _get_already_exposed, _set_already_exposed
, doc="boolean flag, which says whether the declaration is already exposed or not" )
- def exclude( self ):
- """exclude "self" and child declarations from being exposed."""
+ def exclude( self, compilation_errors=False ):
+ """exclude "self" and child declarations from being exposed.
+
+ If compile_time_errors is True, than only declarations, which will cause
+ compilation error will be excluded
+ """
self.ignore = True
def include( self, already_exposed=False ):
@@ -200,4 +204,4 @@
@property
def include_files( self ):
"""list of header files, to be included from the file, the generated code will be placed-in"""
- return self._include_files
\ No newline at end of file
+ return self._include_files
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/scopedef_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/scopedef_wrapper.py 2007-05-27 20:25:17 UTC (rev 1047)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/scopedef_wrapper.py 2007-05-28 15:02:03 UTC (rev 1048)
@@ -6,6 +6,7 @@
"""defines base class for L{decl_wrappers.class_t} and L{decl_wrappers.namespace_t} classes"""
import decl_wrapper
+from pyplusplus import messages
class scopedef_t(decl_wrapper.decl_wrapper_t):
"""base class for L{decl_wrappers.class_t} and L{decl_wrappers.namespace_t} classes
@@ -17,10 +18,23 @@
def __init__(self):
decl_wrapper.decl_wrapper_t.__init__( self )
- def exclude( self ):
- """Exclude "self" and child declarations from being exposed."""
- self.ignore = True
- map( lambda decl: decl.exclude(), self.declarations )
+ def exclude( self, compilation_errors=False ):
+ """exclude "self" and child declarations from being exposed.
+
+ If compile_time_errors is True, than only declarations, which will cause
+ compilation error will be excluded
+ """
+ if False == compilation_errors:
+ #exclude all unconditionaly
+ self.ignore = True
+ map( lambda decl: decl.exclude(), self.declarations )
+ else:
+ if filter( lambda msg: isinstance( msg, messages.compilation_error )
+ , self.readme() ):
+ self.exclude()
+ else:
+ map( lambda decl: decl.exclude(compilation_errors=True)
+ , self.declarations )
def include( self, already_exposed=False ):
"""Include "self" and child declarations to be exposed."""
Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py
===================================================================
--- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-05-27 20:25:17 UTC (rev 1047)
+++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-05-28 15:02:03 UTC (rev 1048)
@@ -9,10 +9,10 @@
class message_type(str):
"""implementation details"""
- def __new__(self, value, identifier):
+ def __new__(self, value, identifier=None):
return str.__new__(self, value )
- def __init__(self, value, identifier ):
+ def __init__(self, value, identifier=None):
self.__identifier = identifier
@property
@@ -21,161 +21,195 @@
def __mod__( self, values ):
str_value = super( message_type, self ).__str__()
- return message_type( str_value % values, self.identifier )
+ return self.__class__( str_value % values, self.identifier )
-W0000 = '%s' #general message, usefull in few cases
+class warning( message_type ):
+ prefix = 'warning'
-W1000 = 'Py++, by default, does not expose internal compilers declarations. '\
- 'Names of those declarations usually start with "__".'
+class compilation_error( message_type ):
+ prefix = 'compilation error'
-W1001 = 'Py++, by default, does not expose internal declarations. ' \
- 'GCC-XML reports that these declaration belong to "<internal>" header.'
+class execution_error( message_type ):
+ prefix = 'execution error'
-W1002 = 'Py++, by default, does not expose compiler generated declarations.'
+W0000 = warning( '%s' ) #general message, usefull in few cases
-W1003 = 'Virtual functions that returns const reference cannot be overridden from Python. ' \
- 'Reason: boost::python::override::operator()(...) saves the result of the marshaling ' \
- '(from Python to C++) on the stack. Thus operator() returns reference ' \
- 'to a temporary variable. Consider to use "Function Transformation" functionality ' \
- 'to solve the problem.'
+W1000 = compilation_error(
+ 'Py++, by default, does not expose internal compilers declarations. '
+ 'Names of those declarations usually start with "__".' )
-W1004 = 'Boost.Python library can not expose function, which takes as argument/returns ' \
- 'pointer to function. ' \
- ' See http://www.boost.org/libs/python/doc/v2/faq.html#funcptr for more information.'
+W1001 = compilation_error(
+ 'Py++, by default, does not expose internal declarations. '
+ 'GCC-XML reports that these declaration belong to "<internal>" header.' )
-W1005 = 'Py++ cannot expose function that takes as argument/returns instance of non-public class. ' \
- 'Generated code will not compile.'
+W1002 = compilation_error(
+ 'Py++, by default, does not expose compiler generated declarations.' )
-W1006 = 'Py++ need your help to expose function that takes as argument/returns C++ arrays. ' \
- 'Take a look on "Function Transformation" functionality and define the transformation.'
+W1003 = warning(
+ 'Virtual functions that returns const reference cannot be overridden from Python. '
+ 'Reason: boost::python::override::operator()(...) saves the result of the marshaling '
+ '(from Python to C++) on the stack. Thus operator() returns reference '
+ 'to a temporary variable. Consider to use "Function Transformation" functionality '
+ 'to solve the problem.' )
-W1007 = 'The function has more than %d arguments ( %d ). ' \
- 'You should adjust BOOST_PYTHON_MAX_ARITY macro. ' \
- 'For more information see: http://www.boost.org/libs/python/doc/v2/configuration.html'
+W1004 = compilation_error(
+ 'Boost.Python library can not expose function, which takes as argument/returns '
+ 'pointer to function. '
+ ' See http://www.boost.org/libs/python/doc/v2/faq.html#funcptr for more information.' )
-W1008 = 'The function returns non-const reference to "Python immutable" type. ' \
- 'The value cannot be modified from Python. '
+W1005 = compilation_error(
+ 'Py++ cannot expose function that takes as argument/returns instance of non-public class. '
+ 'Generated code will not compile.' )
-W1009 = 'The function takes as argument (name=%s, pos=%d) non-const reference ' \
- 'to Python immutable type - function could not be called from Python. ' \
- 'Take a look on "Function Transformation" functionality and define the transformation.'
+W1006 = compilation_error(
+ 'Py++ need your help to expose function that takes as argument/returns C++ arrays. '
+ 'Take a look on "Function Transformation" functionality and define the transformation.' )
-W1010 = 'The function introduces registration order problem. ' \
- 'For more information about the problem read next document: ' \
- 'http://language-binding.net/pyplusplus/documentation/functions/registration_order.html ' \
- 'Problematic functions list: %s'
+W1007 = warning(
+ 'The function has more than %d arguments ( %d ). '
+ 'You should adjust BOOST_PYTHON_MAX_ARITY macro. '
+ 'For more information see: http://www.boost.org/libs/python/doc/v2/configuration.html' )
-W1011 = "Py++ doesn't export private not virtual functions."
+W1008 = warning(
+ 'The function returns non-const reference to "Python immutable" type. '
+ 'The value cannot be modified from Python. ' )
-W1012 = 'Py++ does not exports compiler generated constructors.'
+W1009 = execution_error(
+ 'The function takes as argument (name=%s, pos=%d) non-const reference '
+ 'to Python immutable type - function could not be called from Python. '
+ 'Take a look on "Function Transformation" functionality and define the transformation.' )
-W1013 = "Py++ doesn't export private constructor."
+W1010 = execution_error(
+ 'The function introduces registration order problem. '
+ 'For more information about the problem read next document: '
+ 'http://language-binding.net/pyplusplus/documentation/functions/registration_order.html '
+ 'Problematic functions list: %s' )
-W1014 = '"%s" is not supported. ' \
- 'See Boost.Python documentation: http://www.boost.org/libs/python/doc/v2/operators.html#introduction.'
+W1011 = warning( "Py++ doesn't export private not virtual functions." )
-W1015 = "Py++ doesn't export private operators."
+W1012 = compilation_error( 'Py++ does not exports compiler generated constructors.' )
-W1016 = 'Py++ does not exports non-const casting operators with user defined type as return value. ' \
- 'This could be change in future.'
+W1013 = compilation_error( "Py++ doesn't export private constructor." )
-W1017 = "Py++ doesn't export non-public casting operators."
+W1014 = compilation_error(
+ '"%s" is not supported. '
+ 'See Boost.Python documentation: http://www.boost.org/libs/python/doc/v2/operators.html#introduction.' )
-W1018 = 'Py++ can not expose unnamed classes.'
+W1015 = compilation_error( "Py++ doesn't export private operators." )
-W1019 = 'Py++ can not expose private class.'
+W1016 = warning(
+ 'Py++ does not exports non-const casting operators with user defined type as return value. '
+ 'This could be change in future.' )
-W1020 = "Py++ will generate class wrapper - hand written code should be added to the wrapper class"
+W1017 = compilation_error( "Py++ doesn't export non-public casting operators." )
-W1021 = "Py++ will generate class wrapper - hand written code should be added to the wrapper class null constructor body"
+W1018 = compilation_error( 'Py++ can not expose unnamed classes.' )
-W1022 = "Py++ will generate class wrapper - hand written code should be added to the wrapper class copy constructor body"
+W1019 = compilation_error( 'Py++ can not expose private class.' )
-W1023 = "Py++ will generate class wrapper - there are few functions that should be redefined in class wrapper. " \
- "The functions are: %s."
+W1020 = warning( "Py++ will generate class wrapper - hand written code should be added to the wrapper class" )
-W1024 = 'Py++ will generate class wrapper - class contains "%s" - bit field member variable'
+W1021 = warning( "Py++ will generate class wrapper - hand written code should be added to the wrapper class null constructor body" )
-W1025 = 'Py++ will generate class wrapper - class contains "%s" - T* member variable'
+W1022 = warning( "Py++ will generate class wrapper - hand written code should be added to the wrapper class copy constructor body" )
-W1026 = 'Py++ will generate class wrapper - class contains "%s" - T& member variable'
+W1023 = warning(
+ "Py++ will generate class wrapper - there are few functions that should be redefined in class wrapper. "
+ "The functions are: %s." )
-W1027 = 'Py++ will generate class wrapper - class contains "%s" - array member variable'
+W1024 = warning( 'Py++ will generate class wrapper - class contains "%s" - bit field member variable' )
-W1028 = 'Py++ will generate class wrapper - class contains definition of nested class "%s", which requires wrapper class'
+W1025 = warning( 'Py++ will generate class wrapper - class contains "%s" - T* member variable' )
-W1029 = "Py++ will generate class wrapper - hand written code should be added to the wrapper class constructor body"
+W1026 = warning( 'Py++ will generate class wrapper - class contains "%s" - T& member variable' )
-W1030 = 'Py++ will generate class wrapper - class contains "%s" - [pure] virtual member function'
+W1027 = warning( 'Py++ will generate class wrapper - class contains "%s" - array member variable' )
-W1031 = 'Py++ will generate class wrapper - user asked to expose non - public member function "%s"'
+W1028 = warning( 'Py++ will generate class wrapper - class contains definition of nested class "%s", which requires wrapper class' )
-W1032 = "Boost.Python library does not support enums with duplicate values. " \
- "You can read more about this here: " \
- "http://boost.org/libs/python/todo.html#support-for-enums-with-duplicate-values . " \
- "The quick work around is to add new class variable to the exported enum, from Python. "
+W1029 = warning( "Py++ will generate class wrapper - hand written code should be added to the wrapper class constructor body" )
-W1033 = "Py++ can not expose unnamed variables"
+W1030 = warning( 'Py++ will generate class wrapper - class contains "%s" - [pure] virtual member function' )
-W1034 = "Py++ can not expose alignment bit."
+W1031 = warning( 'Py++ will generate class wrapper - user asked to expose non - public member function "%s"' )
-W1035 = "Py++ can not expose static pointer member variables. This could be changed in future."
+W1032 = execution_error(
+ "Boost.Python library does not support enums with duplicate values. "
+ "You can read more about this here: "
+ "http://boost.org/libs/python/todo.html#support-for-enums-with-duplicate-values . "
+ "The quick work around is to add new class variable to the exported enum, from Python. " )
-W1036 = "Py++ can not expose pointer to Python immutable member variables. This could be changed in future."
+W1033 = compilation_error( "Py++ can not expose unnamed variables" )
-W1037 = "Boost.Python library can not expose variables, which are pointer to function." \
- " See http://www.boost.org/libs/python/doc/v2/faq.html#funcptr for more information."
+W1034 = compilation_error( "Py++ can not expose alignment bit." )
-W1038 = "Py++ can not expose variables of with unnamed type."
+W1035 = compilation_error( "Py++ can not expose static pointer member variables. This could be changed in future." )
-W1039 = "Py++ doesn't expose private or protected member variables."
+W1036 = compilation_error( "Py++ can not expose pointer to Python immutable member variables. This could be changed in future." )
-W1040 = 'The declaration is unexposed, but there are other declarations, which refer to it. ' \
- 'This could cause "no to_python converter found" run time error. ' \
- 'Declarations: %s'
+W1037 = compilation_error(
+ "Boost.Python library can not expose variables, which are pointer to function."
+ " See http://www.boost.org/libs/python/doc/v2/faq.html#funcptr for more information." )
-W1041 = 'Property "%s" could not be created. There is another exposed declaration with the same name( alias )." ' \
- 'The property will make it inaccessible.'
+W1038 = compilation_error( "Py++ can not expose variables of with unnamed type." )
-W1042 = 'Py++ can not find out container value_type( mapped_type ). ' \
- 'The container class is template instantiation declaration and not definition. ' \
- 'This container class will be exported, but there is a possibility, that ' \
- 'generated code will not compile or will lack some functionality. ' \
- 'The solution to the problem is to create a variable of the class.'
+W1039 = compilation_error( "Py++ doesn't expose private or protected member variables." )
-W1043 = 'Py++ created an ugly alias ("%s") for template instantiated class.'
+W1040 = execution_error(
+ 'The declaration is unexposed, but there are other declarations, which refer to it. '
+ 'This could cause "no to_python converter found" run time error. '
+ 'Declarations: %s' )
-W1044 = 'Py++ created an ugly alias ("%s") for function wrapper.'
+W1041 = warning(
+ 'Property "%s" could not be created. There is another exposed declaration with the same name( alias )." '
+ 'The property will make it inaccessible.' )
-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.'
+W1042 = warning(
+ 'Py++ can not find out container value_type( mapped_type ). '
+ 'The container class is template instantiation declaration and not definition. '
+ 'This container class will be exported, but there is a possibility, that '
+ 'generated code will not compile or will lack some functionality. '
+ 'The solution to the problem is to create a variable of the class.' )
-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! '
+W1043 = warning( 'Py++ created an ugly alias ("%s") for template instantiated class.' )
-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'
+W1044 = warning( 'Py++ created an ugly alias ("%s") for function wrapper.' )
-W1048 = 'There are two or more aliases within "pyplusplus::aliases" namespace for ' \
- 'the class. Py++ selected "%s" as class alias. Other aliases: %s'
+W1045 = compilation_error(
+ '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.' )
-W1049 = 'This method could not be overriden in Python - method returns reference ' \
- 'to local variable!'
+W1046 = warning(
+ '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! ' )
-W1050 = 'The function returns "%s" type. You have to specify a call policies.' \
- 'Be sure to take a look on Py++ defined call policies: ' \
- 'http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies'
+W1047 = warning(
+ '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' )
-W1051 = 'The function takes as argument (name=%s, pos=%d) "%s" type. ' \
- 'You have to specify a call policies or to use "Function Transformation" ' \
- 'functionality.'
+W1048 = warning(
+ 'There are two or more aliases within "pyplusplus::aliases" namespace for '
+ 'the class. Py++ selected "%s" as class alias. Other aliases: %s' )
+W1049 = warning(
+ 'This method could not be overriden in Python - method returns reference '
+ 'to local variable!' )
+W1050 = compilation_error(
+ 'The function returns "%s" type. You have to specify a call policies.'
+ 'Be sure to take a look on Py++ defined call policies: '
+ 'http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies' )
+
+W1051 = warning( 'The function takes as argument (name=%s, pos=%d) "%s" type. '
+ 'You have to specify a call policies or to use "Function Transformation" '
+ 'functionality.' )
+
+
warnings = globals()
for identifier, explanation in warnings.items():
@@ -186,9 +220,9 @@
try:
int( identifier[1:] )
except:
- continue
- msg = '%s %s: %s' % ( 'warning', identifier, explanation)
- globals()[ identifier ] = message_type( msg, identifier )
+ continue
+ msg = '%s %s: %s' % ( explanation.__class__.prefix, identifier, str(explanation) )
+ globals()[ identifier ] = explanation.__class__( msg, identifier )
del warnings
del identifier
@@ -197,7 +231,8 @@
if __name__ == '__main__':
x = W1051 % ( 'xxxxxxxx', 122, 'yyyyyyyyyy' )
- print x, x.__class__.__name__
+ print x
+ print x.__class__.__name__
print '\n\n\n'
Modified: pyplusplus_dev/unittests/algorithms_tester.py
===================================================================
--- pyplusplus_dev/unittests/algorithms_tester.py 2007-05-27 20:25:17 UTC (rev 1047)
+++ pyplusplus_dev/unittests/algorithms_tester.py 2007-05-28 15:02:03 UTC (rev 1048)
@@ -202,6 +202,34 @@
escaped_doc = module_builder.doc_extractor_i.escape_doc('Hello "Py++"')
self.failUnless( escaped_doc == '"Hello \\"Py++\\""' )
+class exclude_erronious_tester_t( unittest.TestCase ):
+ def test(self):
+
+ code = """
+ namespace xyz{
+
+ struct good{};
+
+ typedef void (*ff1)( int, int );
+
+ void f_bad( ff1 );
+
+ }
+ """
+
+ mb = module_builder.module_builder_t(
+ [ module_builder.create_text_fc( code ) ]
+ , gccxml_path=autoconfig.gccxml.executable )
+
+ xyz = mb.namespace( name='xyz' )
+ xyz.include()
+
+ xyz.exclude(compilation_errors=True)
+
+ self.failUnless( xyz.ignore == False )
+ self.failUnless( xyz.class_( 'good' ).ignore == False )
+ self.failUnless( xyz.free_fun( 'f_bad' ).ignore == True )
+
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(doc_extractor_tester_t))
@@ -213,8 +241,7 @@
suite.addTest( unittest.makeSuite(class_multiple_files_tester_t))
suite.addTest( unittest.makeSuite(readme_tester_t))
suite.addTest( unittest.makeSuite(split_sequence_tester_t))
-
-
+ suite.addTest( unittest.makeSuite(exclude_erronious_tester_t))
return suite
def run_suite():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 20:25:15
|
Revision: 1047
http://svn.sourceforge.net/pygccxml/?rev=1047&view=rev
Author: roman_yakovenko
Date: 2007-05-27 13:25:17 -0700 (Sun, 27 May 2007)
Log Message:
-----------
changing the default value of use_files_sum_repository from False to True.
This should give to users 5-10% of performance boost
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/module_builder/builder.py
Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/builder.py 2007-05-27 20:21:17 UTC (rev 1046)
+++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2007-05-27 20:25:17 UTC (rev 1047)
@@ -307,7 +307,7 @@
, dir_name
, huge_classes=None
, on_unused_file_found=os.remove
- , use_files_sum_repository=False):
+ , use_files_sum_repository=True):
"""
Writes module to multiple files
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 20:21:21
|
Revision: 1046
http://svn.sourceforge.net/pygccxml/?rev=1046&view=rev
Author: roman_yakovenko
Date: 2007-05-27 13:21:17 -0700 (Sun, 27 May 2007)
Log Message:
-----------
adding sceleton of synopsis parser
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/__init__.py
pygccxml_dev/pygccxml/parser/source_reader.py
Added Paths:
-----------
pygccxml_dev/pygccxml/parser/synopsis_reader.py
pygccxml_dev/pygccxml/parser/synopsis_scanner.py
Modified: pygccxml_dev/pygccxml/parser/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/parser/__init__.py 2007-05-27 19:16:22 UTC (rev 1045)
+++ pygccxml_dev/pygccxml/parser/__init__.py 2007-05-27 20:21:17 UTC (rev 1046)
@@ -7,6 +7,10 @@
"""
from config import config_t
+from config import gccxml_configuration_t
+from config import synopsis_configuration_t
+
+
from project_reader import COMPILATION_MODE
from project_reader import project_reader_t
from project_reader import file_configuration_t
@@ -56,4 +60,4 @@
def parse_xml_file( content, config=None ):
parser = source_reader_t( config )
- return parser.read_xml_file( content )
\ No newline at end of file
+ return parser.read_xml_file( content )
Modified: pygccxml_dev/pygccxml/parser/source_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/source_reader.py 2007-05-27 19:16:22 UTC (rev 1045)
+++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-05-27 20:21:17 UTC (rev 1046)
@@ -5,9 +5,10 @@
import os
import sys
+import linker
import config
+import patcher
import pygccxml.utils
-import linker
try: #select faster xml parser
from etree_scanner import etree_scanner_t as scanner_t
@@ -15,9 +16,8 @@
from scanner import scanner_t
import declarations_cache
-import patcher
-from pygccxml.declarations import *
from pygccxml import utils
+from pygccxml.declarations import *
class gccxml_runtime_error_t( RuntimeError ):
def __init__( self, msg ):
@@ -77,7 +77,7 @@
@param decl_factory: declarations factory, if not given default
declarations factory L{decl_factory_t} will be used
"""
- self.logger = utils.loggers.gccxml
+ self.logger = utils.loggers.cxx_parser
self.__search_directories = []
self.__config = config
self.__search_directories.append( config.working_directory )
@@ -85,44 +85,11 @@
if not cache:
cache = declarations_cache.dummy_cache_t()
self.__dcache = cache
- self.__raise_on_wrong_settings()
+ self.__config.raise_on_wrong_settings()
self.__decl_factory = decl_factory
if not decl_factory:
self.__decl_factory = decl_factory_t()
- def __raise_on_wrong_settings(self):
- if not os.path.isfile( self.__config.gccxml_path ):
- if sys.platform == 'win32':
- gccxml_name = 'gccxml' + '.exe'
- environment_var_delimiter = ';'
- elif sys.platform == 'linux2' or sys.platform == 'darwin':
- gccxml_name = 'gccxml'
- environment_var_delimiter = ':'
- else:
- raise RuntimeError( 'unable to find out location of gccxml' )
- may_be_gccxml = os.path.join( self.__config.gccxml_path, gccxml_name )
- if os.path.isfile( may_be_gccxml ):
- self.__config.gccxml_path = may_be_gccxml
- else:
- for path in os.environ['PATH'].split( environment_var_delimiter ):
- gccxml_path = os.path.join( path, gccxml_name )
- if os.path.isfile( gccxml_path ):
- self.__config.gccxml_path = gccxml_path
- break
- else:
- msg = 'gccxml_path("%s") should exists or to be a valid file name.' \
- % self.__config.gccxml_path
- raise RuntimeError( msg )
- if not os.path.isdir( self.__config.working_directory ):
- msg = 'working_directory("%s") should exists or to be a valid directory name.' \
- % self.__config.working_directory
- raise RuntimeError( msg )
- for include_path in self.__config.include_paths:
- if not os.path.isdir( include_path ):
- msg = 'include path "%s" should exists or to be a valid directory name.' \
- % include_path
- raise RuntimeError( msg )
-
def __create_command_line(self, file, xmlfile):
assert isinstance( self.__config, config.config_t )
#returns
@@ -222,8 +189,14 @@
finally:
pygccxml.utils.remove_file_no_raise( header_file )
return gccxml_file
-
- def read_file(self, source_file):
+
+ def read_file( self, source_file ):
+ if isinstance( self.__config, config.gccxml_configuration_t ):
+ return self.read_gccxml_file( source_file )
+ else:
+ return self.read_synopsis_file( source_file )
+
+ def read_gccxml_file(self, source_file):
"""
Reads C++ source file and returns declarations tree
@@ -342,4 +315,28 @@
decls = filter( lambda inst: isinstance( inst, namespace_t ) and not inst.parent
, decls.itervalues() )
return ( decls, files.values() )
+
+ def read_synopsis_file( self, source_file ):
+ import synopsis_scanner
+ from Synopsis import AST
+ from Synopsis.Parsers import Cxx
+ ffname = self.__file_full_name(source_file)
+
+ cppflags = []
+ map( lambda dpath: cppflags.append( '-I %s' % dpath )
+ , self.__config.include_paths )
+ map( lambda define: cppflags.append( '-D %s' % define )
+ , self.__config.define_symbols )
+ map( lambda define: cppflags.append( '-U %s' % define )
+ , self.__config.undefine_symbols )
+
+ cxx = Cxx.Parser( preprocess=True, cppflags=cppflags )
+ ast = AST.AST()
+ cxx.process( ast, input=[source_file] )
+ scanner = synopsis_scanner.scanner_t( ast, self.__decl_factory )
+ scanner.visitAST( ast )
+ declarations = [scanner.global_ns]
+ self.__dcache.update( ffname, self.__config, declarations, [] )
+ return declarations
+
Added: pygccxml_dev/pygccxml/parser/synopsis_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/synopsis_reader.py (rev 0)
+++ pygccxml_dev/pygccxml/parser/synopsis_reader.py 2007-05-27 20:21:17 UTC (rev 1046)
@@ -0,0 +1,36 @@
+import os
+import sys
+
+from Synopsis import AST
+from Synopsis.Parsers import Cxx
+
+headers_dir = '/home/roman/language-binding/sources/pygccxml_dev/unittests/data'
+
+offset = 0
+def print_decls( d ):
+ global offset
+ print offset * ' ', d.name(), d.__class__.__name__
+ if hasattr( d, 'declarations' ):
+ offset += 1
+ for d1 in d.declarations():
+ print_decls( d1 )
+ offset -= 1
+
+def parse( f ):
+ global offset, headers_dir
+ print 'file ', f
+ cxx = Cxx.Parser(
+ preprocess=True
+ , cppflags=['-I %s' % headers_dir ] )
+
+ ast = AST.AST()
+ cxx.process( ast, input=[os.path.join(headers_dir, f )] )
+
+ offset = 0
+ for d in ast.declarations():
+ print_decls( d )
+
+parse( 'declarations_enums.hpp' )
+#for x in os.listdir( headers_dir ):
+ #if x.endswith( 'hpp' ):
+ #parse( x )
Added: pygccxml_dev/pygccxml/parser/synopsis_scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/synopsis_scanner.py (rev 0)
+++ pygccxml_dev/pygccxml/parser/synopsis_scanner.py 2007-05-27 20:21:17 UTC (rev 1046)
@@ -0,0 +1,46 @@
+# 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 types
+import pprint
+import warnings
+from Synopsis import AST
+from pygccxml import utils
+from pygccxml.declarations import *
+
+class scanner_t( AST.Visitor, object ):
+ def __init__(self, ast, decl_factory ):
+ self.logger = utils.loggers.cxx_parser
+ self.ast = ast
+
+ assert isinstance( decl_factory, decl_factory_t )
+ self.__decl_factory = decl_factory
+
+ #mapping from id -> decl
+ self.__decl = self.__decl_factory.create_namespace( name='::' )
+ self.global_ns = self.__decl
+
+
+ def read_deaclaration( self, node, decl ):
+ #this function should not be called for namespace
+ decl.name = node.name()
+ decl.location = location_t( file_name=node.file(), line=node.line() )
+
+ def visitModule( self, node ):
+ ns = self.__decl_factory.create_namespace( name=node.name() )
+ self.__decl.adopt_declaration( ns )
+ self.__decl = ns
+ super( scanner_t, self ).visitModule( node )
+
+ def visitEnum( self, node ):
+ values = []
+ for enumerator in node.enumerators():
+ print enumerator.name(), ':', enumerator.value()
+ values.append( ( enumerator.name(), enumerator.value() ) )
+ enum = self.__decl_factory.create_enumeration( values=values )
+ self.read_deaclaration( node, enum )
+ self.__decl.adopt_declaration( enum )
+ super( scanner_t, self ).visitEnum( node )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 19:16:20
|
Revision: 1045
http://svn.sourceforge.net/pygccxml/?rev=1045&view=rev
Author: roman_yakovenko
Date: 2007-05-27 12:16:22 -0700 (Sun, 27 May 2007)
Log Message:
-----------
adjusting declarations cache to use right( gccxml ) configuration
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/declarations_cache.py
Modified: pygccxml_dev/pygccxml/parser/declarations_cache.py
===================================================================
--- pygccxml_dev/pygccxml/parser/declarations_cache.py 2007-05-27 19:14:12 UTC (rev 1044)
+++ pygccxml_dev/pygccxml/parser/declarations_cache.py 2007-05-27 19:16:22 UTC (rev 1045)
@@ -9,8 +9,8 @@
import time
import cPickle
from pygccxml import utils
+import config as cxx_parsers_cfg
-
def file_signature( filename ):
if not os.path.isfile( filename ):
return None
@@ -33,9 +33,11 @@
to be different between runs.
"""
sig = md5.new()
- sig.update(str(config.gccxml_path))
+ if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ):
+ sig.update(str(config.gccxml_path))
sig.update(str(config.working_directory))
- sig.update(str(config.cflags))
+ if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ):
+ sig.update(str(config.cflags))
for p in config.include_paths:
sig.update(str(p))
for s in config.define_symbols:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 19:14:10
|
Revision: 1044
http://svn.sourceforge.net/pygccxml/?rev=1044&view=rev
Author: roman_yakovenko
Date: 2007-05-27 12:14:12 -0700 (Sun, 27 May 2007)
Log Message:
-----------
small refactoring, which adds Synopsis parser configuration
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/config.py
Modified: pygccxml_dev/pygccxml/parser/config.py
===================================================================
--- pygccxml_dev/pygccxml/parser/config.py 2007-05-27 19:04:20 UTC (rev 1043)
+++ pygccxml_dev/pygccxml/parser/config.py 2007-05-27 19:14:12 UTC (rev 1044)
@@ -6,11 +6,15 @@
"""This module contains the implementation of the L{config_t} class.
"""
-class config_t(object):
- """Configuration object to collect parameters for invoking gccxml.
+import os
+import sys
+import copy
- This class serves as a container for the parameters that can be used
- to customize the call to gccxml. This class also allows users to work with
+class parser_configuration_t(object):
+ """Configuration object to collect parameters for invoking C++ parser
+
+ This class serves as a base class for the parameters that can be used
+ to customize the call to C++ parser. This class also allows users to work with
relative files paths. In this case files are searched in the following order:
1. current directory
@@ -21,18 +25,14 @@
"""
def __init__( self
- , gccxml_path=''
, working_directory='.'
, include_paths=None
, define_symbols=None
, undefine_symbols=None
- , start_with_declarations=None
- , ignore_gccxml_output=False
, cflags=""):
"""Constructor.
"""
object.__init__( self )
- self.__gccxml_path = gccxml_path
self.__working_directory = working_directory
if not include_paths:
@@ -47,29 +47,11 @@
undefine_symbols = []
self.__undefine_symbols = undefine_symbols
- if not start_with_declarations:
- start_with_declarations = []
- self.__start_with_declarations = start_with_declarations
-
- self.__ignore_gccxml_output = ignore_gccxml_output
self.__cflags = cflags
def clone(self):
- return config_t( gccxml_path=self.__gccxml_path
- , working_directory=self.__working_directory
- , include_paths=self.__include_paths[:]
- , define_symbols=self.__define_symbols[:]
- , undefine_symbols=self.__undefine_symbols[:]
- , start_with_declarations=self.__start_with_declarations[:]
- , ignore_gccxml_output=self.ignore_gccxml_output
- , cflags=self.cflags)
-
- def __get_gccxml_path(self):
- return self.__gccxml_path
- def __set_gccxml_path(self, new_path ):
- self.__gccxml_path = new_path
- gccxml_path = property( __get_gccxml_path, __set_gccxml_path )
-
+ raise NotImplementedError( self.__class__.__name__ )
+
def __get_working_directory(self):
return self.__working_directory
def __set_working_directory(self, working_dir):
@@ -87,7 +69,69 @@
def __get_undefine_symbols(self):
return self.__undefine_symbols
undefine_symbols = property( __get_undefine_symbols )
+
+ def __get_cflags(self):
+ return self.__cflags
+ def __set_cflags(self, val):
+ self.__cflags = val
+ cflags = property( __get_cflags, __set_cflags )
+ def __ensure_dir_exists( self, dir_path, meaning ):
+ if os.path.isdir( dir_path ):
+ return
+ msg = None
+ if os.path.exists( self.working_directory ):
+ raise RuntimeError( '%s("%s") does not exist!' % ( meaning, dir_path ) )
+ else:
+ raise RuntimeError( '%s("%s") should be "directory", not a file.' % ( meaning, dir_path ) )
+
+
+ def raise_on_wrong_settings( self ):
+ self.__ensure_dir_exists( self.working_directory, 'working directory' )
+ map( lambda idir: self.__ensure_dir_exists( idir, 'include directory' )
+ , self.include_paths )
+
+
+class gccxml_configuration_t(parser_configuration_t):
+ """Configuration object to collect parameters for invoking gccxml.
+
+ This class serves as a container for the parameters that can be used
+ to customize the call to gccxml.
+ """
+ def __init__( self
+ , gccxml_path=''
+ , working_directory='.'
+ , include_paths=None
+ , define_symbols=None
+ , undefine_symbols=None
+ , start_with_declarations=None
+ , ignore_gccxml_output=False
+ , cflags=""):
+ """Constructor.
+ """
+ parser_configuration_t.__init__( self
+ , working_directory=working_directory
+ , include_paths=include_paths
+ , define_symbols=define_symbols
+ , undefine_symbols=undefine_symbols
+ , cflags=cflags)
+ self.__gccxml_path = gccxml_path
+
+ if not start_with_declarations:
+ start_with_declarations = []
+ self.__start_with_declarations = start_with_declarations
+
+ self.__ignore_gccxml_output = ignore_gccxml_output
+
+ def clone(self):
+ return copy.deepcopy( self )
+
+ def __get_gccxml_path(self):
+ return self.__gccxml_path
+ def __set_gccxml_path(self, new_path ):
+ self.__gccxml_path = new_path
+ gccxml_path = property( __get_gccxml_path, __set_gccxml_path )
+
def __get_start_with_declarations(self):
return self.__start_with_declarations
start_with_declarations = property( __get_start_with_declarations )
@@ -97,9 +141,56 @@
def __set_ignore_gccxml_output(self, val=True):
self.__ignore_gccxml_output = val
ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output )
+
- def __get_cflags(self):
- return self.__cflags
- def __set_cflags(self, val):
- self.__cflags = val
- cflags = property( __get_cflags, __set_cflags )
\ No newline at end of file
+ def raise_on_wrong_settings( self ):
+ super( gccxml_configuration_t, self ).raise_on_wrong_settings()
+ if os.path.isfile( self.gccxml_path ):
+ return
+ if sys.platform == 'win32':
+ gccxml_name = 'gccxml' + '.exe'
+ environment_var_delimiter = ';'
+ elif sys.platform == 'linux2' or sys.platform == 'darwin':
+ gccxml_name = 'gccxml'
+ environment_var_delimiter = ':'
+ else:
+ raise RuntimeError( 'unable to find out location of gccxml' )
+ may_be_gccxml = os.path.join( self.gccxml_path, gccxml_name )
+ if os.path.isfile( may_be_gccxml ):
+ self.gccxml_path = may_be_gccxml
+ else:
+ for path in os.environ['PATH'].split( environment_var_delimiter ):
+ gccxml_path = os.path.join( path, gccxml_name )
+ if os.path.isfile( gccxml_path ):
+ self.gccxml_path = gccxml_path
+ break
+ else:
+ msg = 'gccxml_path("%s") should exists or to be a valid file name.' \
+ % self.gccxml_path
+ raise RuntimeError( msg )
+
+config_t = gccxml_configuration_t #backward computability
+
+class synopsis_configuration_t(parser_configuration_t):
+ """Configuration object to collect parameters for invoking gccxml.
+
+ This class serves as a container for the parameters that can be used
+ to customize the call to synopsis.
+ """
+ def __init__( self
+ , working_directory='.'
+ , include_paths=None
+ , define_symbols=None
+ , undefine_symbols=None
+ , cflags=""):
+ """Constructor.
+ """
+ parser_configuration_t.__init__( self
+ , working_directory=working_directory
+ , include_paths=include_paths
+ , define_symbols=define_symbols
+ , undefine_symbols=undefine_symbols
+ , cflags=cflags)
+
+ def clone(self):
+ return copy.deepcopy( self )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 19:04:19
|
Revision: 1043
http://svn.sourceforge.net/pygccxml/?rev=1043&view=rev
Author: roman_yakovenko
Date: 2007-05-27 12:04:20 -0700 (Sun, 27 May 2007)
Log Message:
-----------
integrating synopsis parser with unit tests
Modified Paths:
--------------
pygccxml_dev/unittests/autoconfig.py
pygccxml_dev/unittests/cache_enums_tester.py
pygccxml_dev/unittests/parser_test_case.py
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2007-05-27 18:49:41 UTC (rev 1042)
+++ pygccxml_dev/unittests/autoconfig.py 2007-05-27 19:04:20 UTC (rev 1043)
@@ -30,6 +30,13 @@
pygccxml.declarations.class_t.USE_DEMANGLED_AS_NAME = True
+class cxx_parsers_cfg:
+ gccxml = pygccxml.parser.gccxml_configuration_t( gccxml_path=gccxml_path
+ , working_directory=data_directory )
+
+ synopsis = pygccxml.parser.synopsis_configuration_t( working_directory=data_directory )
+
+
#~ try:
#~ import pydsc
#~ pydsc.include( r'D:\pygccxml_sources\sources\pygccxml_dev' )
Modified: pygccxml_dev/unittests/cache_enums_tester.py
===================================================================
--- pygccxml_dev/unittests/cache_enums_tester.py 2007-05-27 18:49:41 UTC (rev 1042)
+++ pygccxml_dev/unittests/cache_enums_tester.py 2007-05-27 19:04:20 UTC (rev 1043)
@@ -13,7 +13,7 @@
from pygccxml import parser
from pygccxml import declarations
-class tester_t( parser_test_case.parser_test_case_t ):
+class tester_impl_t( parser_test_case.parser_test_case_t ):
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
@@ -38,13 +38,21 @@
color2 = declarations.matcher.get_single( enum_matcher, decls2 )
self.failUnless( color1.values == color2.values )
+class synopsis_tester_t( tester_impl_t ):
+ CXX_PARSER_CFG = autoconfig.cxx_parsers_cfg.synopsis
+
+class gccxml_tester_t( tester_impl_t ):
+ CXX_PARSER_CFG = autoconfig.cxx_parsers_cfg.gccxml
+
+
def create_suite():
suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(tester_t))
+ suite.addTest( unittest.makeSuite(synopsis_tester_t))
+ suite.addTest( unittest.makeSuite(gccxml_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
+ run_suite()
Modified: pygccxml_dev/unittests/parser_test_case.py
===================================================================
--- pygccxml_dev/unittests/parser_test_case.py 2007-05-27 18:49:41 UTC (rev 1042)
+++ pygccxml_dev/unittests/parser_test_case.py 2007-05-27 19:04:20 UTC (rev 1043)
@@ -3,20 +3,26 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
+import pprint
import unittest
import autoconfig
-import pprint
+
import pygccxml
from pygccxml.utils import *
from pygccxml.parser import *
from pygccxml.declarations import *
class parser_test_case_t( unittest.TestCase ):
+
+ CXX_PARSER_CFG = None
+
def __init__(self, *args):
unittest.TestCase.__init__(self, *args)
- self.config = config.config_t( gccxml_path=autoconfig.gccxml_path
- , working_directory=autoconfig.data_directory )
+ if self.CXX_PARSER_CFG:
+ self.config = self.CXX_PARSER_CFG.clone()
+ else:
+ self.config = autoconfig.cxx_parsers_cfg.gccxml.clone()
def _test_type_composition( self, type, expected_compound, expected_base ):
self.failUnless( isinstance( type, expected_compound)
@@ -60,4 +66,4 @@
, "the function's '%s' expected exceptions are '%s' and in reality it is different('%s')" \
% ( calldef.name
, pprint.pformat( [delc.name for delc in exception_decls] )
- , pprint.pformat( [delc.name for delc in exceptions_indeed] ) ) )
\ No newline at end of file
+ , pprint.pformat( [delc.name for delc in exceptions_indeed] ) ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 18:49:39
|
Revision: 1042
http://svn.sourceforge.net/pygccxml/?rev=1042&view=rev
Author: roman_yakovenko
Date: 2007-05-27 11:49:41 -0700 (Sun, 27 May 2007)
Log Message:
-----------
rename loggers.gccxml to loggers.cxx_parser
gccxml name is still available for backward compatability
Modified Paths:
--------------
pygccxml_dev/pygccxml/utils/__init__.py
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2007-05-27 09:30:39 UTC (rev 1041)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2007-05-27 18:49:41 UTC (rev 1042)
@@ -25,13 +25,15 @@
class loggers:
"""class-namespace, defines few loggers classes, used in the project"""
- gccxml = _create_logger_( 'pygccxml.gccxml' )
- """logger for gccxml functionality
+ cxx_parser = _create_logger_( 'pygccxml.cxx_parser' )
+ """logger for C++ parser functionality
If you set this logger level to DEBUG, you will be able to see the exact
command line, used to invoke GCC-XML and errors that occures during XML parsing
"""
+ gccxml = cxx_parser #backward compatability
+
queries_engine = _create_logger_( 'pygccxml.queries_engine' )
"""logger for query engine functionality.
@@ -51,7 +53,7 @@
root = logging.getLogger( 'pygccxml' )
"""root logger exists for your convinience only"""
- all = [ root, gccxml, queries_engine, declarations_cache ]
+ all = [ root, cxx_parser, queries_engine, declarations_cache ]
"""contains all logger classes, defined by the class"""
def remove_file_no_raise(file_name ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 09:30:38
|
Revision: 1041
http://svn.sourceforge.net/pygccxml/?rev=1041&view=rev
Author: roman_yakovenko
Date: 2007-05-27 02:30:39 -0700 (Sun, 27 May 2007)
Log Message:
-----------
fixing bug in generated code for transformed virtual functions
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py 2007-05-27 09:20:13 UTC (rev 1040)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py 2007-05-27 09:30:39 UTC (rev 1041)
@@ -392,7 +392,7 @@
tmpl_values['py_arg_expressions'] = ''
if cntrl.py_arg_expressions:
tmpl_values['py_arg_expressions'] \
- = ', ' + declarations.call_invocation.join( '', cntrl.py_arg_expressions )
+ = ', ' + self.PARAM_SEPARATOR.join( cntrl.py_arg_expressions )
tmpl_values['save_py_result'] = "bpl::object %s = " % cntrl.py_result_variable.name
tmpl_values['py_return'] = ''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 09:20:11
|
Revision: 1040
http://svn.sourceforge.net/pygccxml/?rev=1040&view=rev
Author: roman_yakovenko
Date: 2007-05-27 02:20:13 -0700 (Sun, 27 May 2007)
Log Message:
-----------
starting to use new type traits: is_calldef_pointer
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2007-05-27 09:18:09 UTC (rev 1039)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2007-05-27 09:20:13 UTC (rev 1040)
@@ -136,8 +136,7 @@
if 1 != len( calldef.required_args ):
return []
arg_type = calldef.arguments[0].type
- if declarations.is_pointer( arg_type ) \
- and isinstance( arg_type.base, declarations.calldef_type_t ):
+ if declarations.is_calldef_pointer( arg_type ):
return []
problematics = []
for f in calldef.overloads:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-27 09:18:08
|
Revision: 1039
http://svn.sourceforge.net/pygccxml/?rev=1039&view=rev
Author: roman_yakovenko
Date: 2007-05-27 02:18:09 -0700 (Sun, 27 May 2007)
Log Message:
-----------
adding is_calldef_pointer type traits
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/__init__.py
pygccxml_dev/pygccxml/declarations/type_traits.py
pygccxml_dev/unittests/data/type_traits.hpp
pygccxml_dev/unittests/type_traits_tester.py
Modified: pygccxml_dev/pygccxml/declarations/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/__init__.py 2007-05-24 09:57:22 UTC (rev 1038)
+++ pygccxml_dev/pygccxml/declarations/__init__.py 2007-05-27 09:18:09 UTC (rev 1039)
@@ -136,6 +136,7 @@
from type_traits import is_std_wstring
from type_traits import is_std_ostream
from type_traits import is_std_wostream
+from type_traits import is_calldef_pointer
from type_traits import is_unary_operator
from type_traits import is_binary_operator
Modified: pygccxml_dev/pygccxml/declarations/type_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/type_traits.py 2007-05-24 09:57:22 UTC (rev 1038)
+++ pygccxml_dev/pygccxml/declarations/type_traits.py 2007-05-27 09:18:09 UTC (rev 1039)
@@ -154,6 +154,16 @@
, cpptypes.pointer_t
, (cpptypes.const_t, cpptypes.volatile_t) )
+def is_calldef_pointer(type):
+ """returns True, if type represents pointer to free/member function, False otherwise"""
+ if not is_pointer(type):
+ return False
+ nake_type = remove_alias( type )
+ nake_type = remove_const( nake_type )
+ nake_type = remove_volatile( nake_type )
+ return isinstance( nake_type, cpptypes.compound_t ) \
+ and isinstance( nake_type.base, cpptypes.calldef_type_t )
+
def remove_pointer(type):
"""removes pointer from the type definition
Modified: pygccxml_dev/unittests/data/type_traits.hpp
===================================================================
--- pygccxml_dev/unittests/data/type_traits.hpp 2007-05-24 09:57:22 UTC (rev 1038)
+++ pygccxml_dev/unittests/data/type_traits.hpp 2007-05-27 09:18:09 UTC (rev 1039)
@@ -10,9 +10,10 @@
#include <iostream>
#define TYPE_PERMUTATION( BASE, NAME ) \
- typedef BASE NAME##_t; \
- typedef BASE const NAME##_const_t; \
- typedef BASE volatile NAME##_volatile_t;
+ typedef BASE NAME##_t; \
+ typedef BASE const NAME##_const_t; \
+ typedef BASE volatile NAME##_volatile_t; \
+ typedef BASE const volatile NAME##_const_volatile_t;
struct some_struct_t{
void do_smth();
@@ -85,6 +86,31 @@
}
}
+
+
+namespace is_calldef_pointer{
+
+namespace details{
+struct X{
+ void do_smth( int ) const;
+};
+
+}
+
+namespace yes{
+ typedef void (*ff1)( int, int );
+ typedef void ( details::X::*mf1)( int ) const;
+
+ TYPE_PERMUTATION( ff1, ff1_type );
+ TYPE_PERMUTATION( mf1, mf1_type );
+}
+
+namespace no{
+ typedef int int_;
+}
+
+}
+
namespace is_integral{
namespace yes{
Modified: pygccxml_dev/unittests/type_traits_tester.py
===================================================================
--- pygccxml_dev/unittests/type_traits_tester.py 2007-05-24 09:57:22 UTC (rev 1038)
+++ pygccxml_dev/unittests/type_traits_tester.py 2007-05-27 09:18:09 UTC (rev 1039)
@@ -111,6 +111,9 @@
def test_is_std_wostream(self):
self.__test_type_category( 'is_std_wostream', declarations.is_std_wostream )
+ def test_is_calldef_pointer(self):
+ self.__test_type_category( 'is_calldef_pointer', declarations.is_calldef_pointer )
+
def test_has_trivial_constructor(self):
self.__test_type_category( 'has_trivial_constructor', declarations.has_trivial_constructor )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-24 09:57:21
|
Revision: 1038
http://svn.sourceforge.net/pygccxml/?rev=1038&view=rev
Author: roman_yakovenko
Date: 2007-05-24 02:57:22 -0700 (Thu, 24 May 2007)
Log Message:
-----------
fixing infinite recursion bug
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2007-05-20 09:19:30 UTC (rev 1037)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2007-05-24 09:57:22 UTC (rev 1038)
@@ -129,18 +129,22 @@
else:
pass
return None
-
+
@staticmethod
def select_problematics( calldef ):
"""Return list of problematic functions for function "calldef" """
if 1 != len( calldef.required_args ):
return []
+ arg_type = calldef.arguments[0].type
+ if declarations.is_pointer( arg_type ) \
+ and isinstance( arg_type.base, declarations.calldef_type_t ):
+ return []
problematics = []
for f in calldef.overloads:
if 1 != len( f.required_args ):
continue
+ if f.ignore:
+ continue
if None != registration_order.is_related( calldef.arguments[0].type, f.arguments[0].type ):
problematics.append( f )
return problematics
-
-
\ 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-05-20 09:19:32
|
Revision: 1037
http://svn.sourceforge.net/pygccxml/?rev=1037&view=rev
Author: roman_yakovenko
Date: 2007-05-20 02:19:30 -0700 (Sun, 20 May 2007)
Log Message:
-----------
removing "false" user
Modified Paths:
--------------
pyplusplus_dev/docs/quotes.rest
Modified: pyplusplus_dev/docs/quotes.rest
===================================================================
--- pyplusplus_dev/docs/quotes.rest 2007-05-13 05:24:52 UTC (rev 1036)
+++ pyplusplus_dev/docs/quotes.rest 2007-05-20 09:19:30 UTC (rev 1037)
@@ -80,12 +80,6 @@
.. _`OIS` : http://www.wreckedgames.com/wiki/index.php/WreckedLibs:OIS
-* Nicolas Tessore is using `Py++`_ to create Python bindings for `NifTools`_
- project. You can read in his `blog`_ what he thinks about `Py++`_.
-
- .. _`NifTools` : http://www.niftools.org/wiki/index.php/NIF_File_Format_Library_and_Tools
- .. _`blog` : http://ni-te.de/blog/?p=10
-
* I am :-). I created Python bindings for next libraries:
* `Boost.Date_Time`_
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-13 05:24:50
|
Revision: 1036
http://svn.sourceforge.net/pygccxml/?rev=1036&view=rev
Author: roman_yakovenko
Date: 2007-05-12 22:24:52 -0700 (Sat, 12 May 2007)
Log Message:
-----------
adding mangling for functions, that doesn't have "mangled" reported by gccxml
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py
Modified: pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2007-05-06 09:00:57 UTC (rev 1035)
+++ pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2007-05-13 05:24:52 UTC (rev 1036)
@@ -32,8 +32,13 @@
def unique_name( self ):
if None is self.__unique_name:
obj = md5.new()
- obj.update( self.__function.mangled )
- self.__unique_name = self.__function.name + '_' + obj.hexdigest()
+ if self.__function.mangled: # free functions don't have a mangled value
+ obj.update( self.__function.mangled )
+ else:
+ obj.update( self.__function.decl_string )
+ obj.update( self.__function.location.file_name )
+ obj.update( str( self.__function.location.line ) )
+ self.__unique_name = self.__function.name + '_' + obj.hexdigest ()
return self.__unique_name
@property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-06 09:00:57
|
Revision: 1035
http://svn.sourceforge.net/pygccxml/?rev=1035&view=rev
Author: roman_yakovenko
Date: 2007-05-06 02:00:57 -0700 (Sun, 06 May 2007)
Log Message:
-----------
Modified Paths:
--------------
installers/install_gccxml.py
Modified: installers/install_gccxml.py
===================================================================
--- installers/install_gccxml.py 2007-05-06 09:00:20 UTC (rev 1034)
+++ installers/install_gccxml.py 2007-05-06 09:00:57 UTC (rev 1035)
@@ -37,7 +37,7 @@
build_gccxml_cmd = utils.create_cmd( cmake
, '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir
, '-DCMAKE_BUILD_TYPE=release'
- #, '-G "%s"' % config.cmake.generator
+ , '-G "%s"' % config.cmake.generator
, gccxml_src_dir )
install_gccxml_cmd = utils.create_cmd( config.cmake.native_build, 'install' )
utils.execute( build_gccxml_cmd )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-05-06 09:00:22
|
Revision: 1034
http://svn.sourceforge.net/pygccxml/?rev=1034&view=rev
Author: roman_yakovenko
Date: 2007-05-06 02:00:20 -0700 (Sun, 06 May 2007)
Log Message:
-----------
Modified Paths:
--------------
installers/config.py
installers/install_gccxml.py
installers/utils.py
Modified: installers/config.py
===================================================================
--- installers/config.py 2007-05-05 19:19:11 UTC (rev 1033)
+++ installers/config.py 2007-05-06 09:00:20 UTC (rev 1034)
@@ -36,6 +36,7 @@
compiler = None
generator = None
native_build = None
+ configure_environment_script = None
if 'win32' == sys.platform:
from distutils import msvccompiler
@@ -45,6 +46,9 @@
cc.initialize()
generator = 'NMake Makefiles'
native_build = '"%s" /A all' % cc.find_exe( 'nmake.exe' )
+ configure_environment_script = cc.find_exe( 'vsvars32.bat' )
+ if not configure_environment_script:
+ configure_environment_script = cc.find_exe( 'vcvars32.bat' )
cl_mapping = { 6.0 : "msvc6", 7.0 : "msvc7", 7.1 : "msvc71", 8.0 : "msvc8" }
compiler = cl_mapping[ msvccompiler.get_build_version() ]
else:
@@ -53,3 +57,13 @@
compiler="gcc"
generator = 'Unix Makefiles'
native_build = 'make'
+
+ @staticmethod
+ def prepare():
+ if 'win32' == sys.platform:
+ from distutils import msvccompiler
+ from distutils import ccompiler
+
+ cc = msvccompiler.MSVCCompiler()
+ cc.initialize()
+ cc.find_exe( 'vcvars32.bat' )
Modified: installers/install_gccxml.py
===================================================================
--- installers/install_gccxml.py 2007-05-05 19:19:11 UTC (rev 1033)
+++ installers/install_gccxml.py 2007-05-06 09:00:20 UTC (rev 1034)
@@ -29,53 +29,32 @@
utils.logger.info( 'GCC_XML install directory "%s" already exists' % config.gccxml_install_dir)
os.chdir( build_dir )
-
cmake = os.path.join( working_dir
, os.path.splitext( config.archives.cmake )[0]
, 'bin'
, 'cmake' )
- utils.execute( cmake
- , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir
- , '-DCMAKE_BUILD_TYPE=release'
- , '-G "%s"' % config.cmake.generator
- , gccxml_src_dir )
-
+ build_gccxml_cmd = utils.create_cmd( cmake
+ , '-DCMAKE_INSTALL_PREFIX:PATH=' + config.gccxml_install_dir
+ , '-DCMAKE_BUILD_TYPE=release'
+ #, '-G "%s"' % config.cmake.generator
+ , gccxml_src_dir )
+ install_gccxml_cmd = utils.create_cmd( config.cmake.native_build, 'install' )
+ utils.execute( build_gccxml_cmd )
utils.execute( config.cmake.native_build )
- if 'win32' == sys.platform:
- #On windows GCC_XML does not support installation, so this setup will
- #do it.
- gccxml_config_file = os.path.join( build_dir, 'bin', 'gccxml_config' )
- gccxml_config = file( gccxml_config_file ).read()
- gccxml_config = gccxml_config.replace( 'GCCXML_COMPILER="cl"'
- , 'GCCXML_COMPILER="%s"' % config.cmake.compiler )
-
- gccxml_root_re = re.compile( r'GCCXML_ROOT=\".*?\"' )
- found = gccxml_root_re.search( gccxml_config )
- gccxml_new_root = 'GCCXML_ROOT="%s"' % config.gccxml_install_dir
- gccxml_new_root = gccxml_new_root.replace( '\\', '/' )
- gccxml_config = gccxml_config[:found.start()] + gccxml_new_root + gccxml_config[found.end():]
- tmp = file( gccxml_config_file, 'w+' )
- tmp.write( gccxml_config )
- tmp.close()
- utils.logger.info( 'copying GCC_XML files to the install directory' )
- shutil.copytree( os.path.join( build_dir, 'bin' ), config.gccxml_install_dir )
- utils.logger.info( 'copying GCC_XML files to the install directory - done' )
- else:
- utils.execute( config.cmake.native_build )
- utils.execute( config.cmake.native_build, 'install' )
- #for some reason not always next files are copied to the right place
- bin_dir = os.path.join( config.gccxml_install_dir, 'bin' )
- share_dir = os.path.join( config.gccxml_install_dir, 'share', 'gccxml-0.7' )
- for f in ( 'gccxml_config', 'gccxml_find_flags' ):
- ff_bin = os.path.join( bin_dir, f )
- ff_shared = os.path.join( share_dir, f )
- if not os.path.exists( ff_bin ):
- shutil.copyfile( ff_shared, ff_bin )
+ utils.execute( install_gccxml_cmd )
+
+ bin_dir = os.path.join( config.gccxml_install_dir, 'bin' )
+ share_dir = os.path.join( config.gccxml_install_dir, 'share', 'gccxml-0.7' )
+ for f in ( 'gccxml_config', 'gccxml_find_flags' ):
+ ff_bin = os.path.join( bin_dir, f )
+ ff_shared = os.path.join( share_dir, f )
+ if not os.path.exists( ff_bin ) and os.path.exists( ff_shared ):
+ shutil.copyfile( ff_shared, ff_bin )
- utils.rmtree_safe( build_dir )
+ #utils.rmtree_safe( build_dir )
-def install():
+def install_gccxml():
if 2 == len(sys.argv):
config.gccxml_install_dir = sys.argv[1]
else:
@@ -100,12 +79,13 @@
build_gccxml(working_dir)
finally:
- utils.rmtree_safe( working_dir )
+ pass
+ #utils.rmtree_safe( working_dir )
utils.logger.info( 'GCC_XML was successfully installed in "%s" directory' % config.gccxml_install_dir )
utils.logger.info( 'Uninstall instruction - delete GCC_XML install directory.' )
-def create_dist_package():
+def create_setup():
working_dir = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__) )
gccxml_cvs_dir_name = os.path.splitext( config.archives.gccxml )[0]
@@ -183,9 +163,9 @@
os.remove( cmake_tar_file )
os.remove( gccxml_tar_file )
-if __name__ == "__main__":
+if __name__ == "__main__":
if 2 == len( sys.argv ) and sys.argv[1] == '--build-setup':
- create_dist_package()
+ create_setup()
else:
- install()
+ install_gccxml()
#
Modified: installers/utils.py
===================================================================
--- installers/utils.py 2007-05-05 19:19:11 UTC (rev 1033)
+++ installers/utils.py 2007-05-06 09:00:20 UTC (rev 1034)
@@ -39,13 +39,17 @@
else:
tar.extract(tarinfo, destination_dir)
-def execute( command, *args, **keywd):
- global logger
+def create_cmd( command, *args, **keywd):
cmd_line = [ command ]
for key, value in keywd.items():
cmd_line.append( '--%s=%s' % ( key, value ) )
cmd_line.extend( args )
cmd = ' '.join( cmd_line )
+ return cmd
+
+def execute( command, *args, **keywd):
+ global logger
+ cmd = create_cmd( command, *args, **keywd )
logger.info( 'executing command: %s' % cmd )
input, output = os.popen4( cmd )
input.close()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|