2009/4/13 Michał Nowotka <mmm...@gmail.com>: > Ok, but now I want to run all test included.
Okey. > First of all I can't do it because of an error: > > Traceback (most recent call last): > File "/home/mnowotka/pygccxml/pyplusplus_dev/unittests/test_all.py", > line 113, in <module> > import indexing_suites_v2_bug_tester > File > "/home/mnowotka/pygccxml/pyplusplus_dev/unittests/indexing_suites_v2_bug_tester.py", > line 14, in <module> > import dl > ImportError: No module named dl > As far I know, this was a bug in python on x86_64 enviroments. Is > there any way around this dependency? I guess so. Python-Ogre project, was built and used in such environment and it doesn't have such problem. > Secondly, when I exclude indexing_suites_v2_bug test I can see that > not all the other tests were completed successfully: > > ! test (custom_smart_ptr_classes_tester.tester_t) - FAIL This one should fail. I need to free some time to investigate it. > ! test (deepcopy_tester.tester_t) - FAIL I would like to see the error. Basically that test checks that exception is raised in "copy.deepcopy" function. > ! test (virtual_inheritance_tester.tester_t) - ERROR The test is very simple, it checks that Py++ generates the right code. It is interesting to see the error. > Does it mean smart pointers and virtual inheritance is not supported > under linux? Are there any workarounds? No, it doesn't. The only conclusion you can do right now: Py++ tests are broken on your platform and need some investigation. > And finally another use case. Consider following code: > > #include <utility> //here is std::pair defined > > class I > { > public: > I(int a, int b) > { > pair_.first = a; > pair_.second = b; > } > std::pair<int, int> pair_; > > int compute(){return pair_.first + pair_.second;} > }; > > After parsing it Py++ produces warning: > > WARNING: std::pair<int, int> [struct] >> execution error 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: I::pair_ [variable] > > I don't understand it because indexing suite v2 can handle vectors, > sets, deques etc. so why pair is here an exception? Well, code generation process is about "special case" treatment. Please open ticket on SourceForge, so I could add this functionality before next release. > There is pair.hpp > file in indexing_suite directory so I guess this package can work with > std::pair. Even if I add following lines > (IMO completely useless in this case): > > namespace pyplusplus{ > > namespace aliases{ > > > typedef std::pair< std::string, int > PairOfStringInt; > void instantiate( PairOfStringInt psi){} > typedef std::pair< std::string, double > PairOfStringDouble; > void instantiate( PairOfStringDouble psd){} > > > > } > } > > or: > > int a = sizeof(std::pair< std::string, int >); > int b = sizeof(std::pair< std::string, double >); > > I still get this warning. > > I also read this discussion: > http://sourceforge.net/tracker/index.php?func=detail&aid=1991168&group_id=118209&atid=684318 > > but adding these lines: > mb.class_('PairOfStringInt').include() > mb.class_('PairOfStringDouble').include() > > or: > mb.class_('std::pair< std::string, int >').include() > mb.class_('std::pair< std::string, double >').include() > > doesn't solve the problem and generate error: > > pygccxml.declarations.matcher.declaration_not_found_t: Unable to find > declaration. matcher: [(decl type==class_t) and (name==std::pair< > std::string, double >)] > > so how should I modify the code to get std::pair exposed? I committed new test: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml?view=rev Basically, I suggest you to read the following article: http://language-binding.net/pygccxml/query_interface.html The short version: if you cant select the desired class, than check it name first and than use it: mb = module_builder_t( ... ) pair = mb.classes( lambda cls: cls.name.startswith( 'pair' ) ) for p in pair: print p.name HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig