Thread: [pygccxml-development] Problems with long filename
Brought to you by:
mbaas,
roman_yakovenko
From: Birgir S. <Bir...@ro...> - 2007-03-08 22:18:32
|
Hei , I am using Py++ to expose the following. class AbstractLoader : private boost::noncopyable { public: =0D AbstractLoader(); virtual ~AbstractLoader(); std::vector < std::string > extensions() const; =0D private: virtual std::vector < std::string > extensions_impl() const =3D 0; }; I want to use the module_builder_t.split_module but I am getting the following error message. IOError: [Errno 36] File name too long:= u'splitted/vector_less_std_scope_basic_string_less_char_comma__std_scope_c= har_traits_less_char_grate__comma__std_scope_allocator_less_char_grate___gr= ate__comma_std_scope_allocator_less_std_scope_basic_string_less_char_comma_= _std_scope_char_traits_less_char_grate__comma__std_scope_allocator_less_cha= r_grate___grate___grate___grate_.pypp.hpp' How can I tell Py++ not to autogenerate so long names? Best regards, Birgir Sigurjonsson. DISCLAIMER: This message contains information that may be privileged or confidential= and is the property of the Roxar Group. It is intended only for the person= to whom it is addressed. If you are not the intended recipient, you are= not authorised to read, print, retain, copy, disseminate, distribute, or= use this message or any part thereof. If you receive this message in= error, please notify the sender immediately and delete all copies of this= message.=0D |
From: Roman Y. <rom...@gm...> - 2007-03-09 09:20:59
|
On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: > Hei , I am using Py++ to expose the following. > > class AbstractLoader : private boost::noncopyable { > public: > > AbstractLoader(); > virtual ~AbstractLoader(); > > std::vector < std::string > extensions() const; > > private: > virtual std::vector < std::string > extensions_impl() const = 0; > }; > > I want to use the module_builder_t.split_module > but I am getting the following error message. > > IOError: [Errno 36] File name too long: u'splitted/vector_less_std_scope_basic_string_less_char_comma__std_scope_char_traits_less_char_grate__comma__std_scope_allocator_less_char_grate___grate__comma_std_scope_allocator_less_std_scope_basic_string_less_char_comma__std_scope_char_traits_less_char_grate__comma__std_scope_allocator_less_char_grate___grate___grate___grate_.pypp.hpp' > > How can I tell Py++ not to autogenerate so long names? Take a look on this "how to": http://language-binding.net/pyplusplus/documentation/how_to.html#py-generated-file-name-is-too-long After it you I think you would like to read this: http://language-binding.net/pyplusplus/documentation/hints.html Does it help? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Birgir S. <Bir...@ro...> - 2007-03-09 13:34:16
|
Hei, I cannot get any of those to work, as it seems to me that they are based on the fact that I have declared the classes. I added this holder =3D mb.class_( 'std::vector < std::string >') holder.rename( 'StringVector' ) and got this error pygccxml.declarations.matcher.declaration_not_found_t: Unable to find= declaration. matcher: [(decl type=3D=3Dclass_t) and (name=3D= =3Dstd::vector < std::string >) In my case it is the return type (stl container) that is beeing auto converted to a class_ by Py++ Is there any other way? Birgir -----Original Message----- From: Roman Yakovenko [mailto:rom...@gm...] Sent: Fri 3/9/2007 10:20 AM To: Birgir Sigurjonsson Cc: pyg...@li... Subject: Re: [pygccxml-development] Problems with long filename =0D On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: > Hei , I am using Py++ to expose the following. > > class AbstractLoader : private boost::noncopyable { > public: > > AbstractLoader(); > virtual ~AbstractLoader(); > > std::vector < std::string > extensions() const; > > private: > virtual std::vector < std::string > extensions_impl() const =3D 0; > }; > > I want to use the module_builder_t.split_module > but I am getting the following error message. > > IOError: [Errno 36] File name too long:= u'splitted/vector_less_std_scope_basic_string_less_char_comma__std_scope_c= har_traits_less_char_grate__comma__std_scope_allocator_less_char_grate___gr= ate__comma_std_scope_allocator_less_std_scope_basic_string_less_char_comma_= _std_scope_char_traits_less_char_grate__comma__std_scope_allocator_less_cha= r_grate___grate___grate___grate_.pypp.hpp' > > How can I tell Py++ not to autogenerate so long names? Take a look on this "how to": http://language-binding.net/pyplusplus/documentation/how_to.html#py-generat= ed-file-name-is-too-long After it you I think you would like to read this: http://language-binding.net/pyplusplus/documentation/hints.html Does it help? --=0D Roman Yakovenko C++ Python language binding http://www.language-binding.net/ DISCLAIMER: This message contains information that may be privileged or confidential= and is the property of the Roxar Group. It is intended only for the person= to whom it is addressed. If you are not the intended recipient, you are= not authorised to read, print, retain, copy, disseminate, distribute, or= use this message or any part thereof. If you receive this message in= error, please notify the sender immediately and delete all copies of this= message.=0D |
From: Roman Y. <rom...@gm...> - 2007-03-09 14:48:42
|
On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: > > Hei, I cannot get any of those to work, as it seems to me > that they are based on the fact that I have declared the > classes. Strange, I am curious to know why > > > > I added this > holder = mb.class_( 'std::vector < std::string >') > holder.rename( 'StringVector' ) > > and got this error > > pygccxml.declarations.matcher.declaration_not_found_t: Unable to find declaration. matcher: [(decl type==class_t) and (name==std::vector < std::string >) > > In my case it is the return type (stl container) that > is beeing auto converted to a class_ by Py++ this is because the name of the class is different. First of all you've got the class name first time when you get IOError Second you can find the exact name of the class in few ways: 1. for x in mb.classes( lambda cls: cls.name.startswith( 'vector<' ) ): print x.name 2. al_cls = mb.class_( 'AbstractLoader' ) extensions = al_cls.mem_fun( 'extensions' ) rtype = extensions.return_type print rtype rtype_cls = declarations.class_traits.get_declaration( rtype ) rtype.alias = 'vector_of_strings' > Is there any other way? Not really, but the solution I described should work -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Birgir S. <Bir...@ro...> - 2007-03-09 17:28:21
|
Hei, I have tried both method, but no success yet. 1. when printing out mb.classes() there is not class that starts with vector. 2. in the following example I get an error declarations. How do I define the declarations? =0D al_cls =3D mb.class_( 'AbstractLoader' ) extensions =3D al_cls.mem_fun( 'extensions' ) rtype =3D extensions.return_type print rtype rtype_cls =3D declarations.class_traits.get_declaration( rtype ) rtype.alias =3D 'vector_of_strings' Thanks for you help, Birgir. -----Original Message----- From: Roman Yakovenko [mailto:rom...@gm...] Sent: Fri 3/9/2007 3:48 PM To: Birgir Sigurjonsson Cc: pyg...@li... Subject: Re: [pygccxml-development] Problems with long filename =0D On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: > > Hei, I cannot get any of those to work, as it seems to me > that they are based on the fact that I have declared the > classes. Strange, I am curious to know why > > > > I added this > holder =3D mb.class_( 'std::vector < std::string >') > holder.rename( 'StringVector' ) > > and got this error > > pygccxml.declarations.matcher.declaration_not_found_t: Unable to find= declaration. matcher: [(decl type=3D=3Dclass_t) and (name=3D= =3Dstd::vector < std::string >) > > In my case it is the return type (stl container) that > is beeing auto converted to a class_ by Py++ this is because the name of the class is different. First of all you've got the class name first time when you get IOError Second you can find the exact name of the class in few ways: 1. for x in mb.classes( lambda cls: cls.name.startswith( 'vector<' ) ): print x.name 2. al_cls =3D mb.class_( 'AbstractLoader' ) extensions =3D al_cls.mem_fun( 'extensions' ) rtype =3D extensions.return_type print rtype rtype_cls =3D declarations.class_traits.get_declaration( rtype ) rtype.alias =3D 'vector_of_strings' > Is there any other way? Not really, but the solution I described should work --=0D Roman Yakovenko C++ Python language binding http://www.language-binding.net/ DISCLAIMER: This message contains information that may be privileged or confidential= and is the property of the Roxar Group. It is intended only for the person= to whom it is addressed. If you are not the intended recipient, you are= not authorised to read, print, retain, copy, disseminate, distribute, or= use this message or any part thereof. If you receive this message in= error, please notify the sender immediately and delete all copies of this= message.=0D |
From: Roman Y. <rom...@gm...> - 2007-03-09 17:31:57
|
On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: > > > > Hei, I have tried both method, but no success yet. > > 1. when printing out mb.classes() there is not class > that starts with vector. > > 2. in the following example I get an error declarations. > How do I define the declarations? > > al_cls = mb.class_( 'AbstractLoader' ) > extensions = al_cls.mem_fun( 'extensions' ) > rtype = extensions.return_type > print rtype > rtype_cls = declarations.class_traits.get_declaration( rtype ) > rtype.alias = 'vector_of_strings' May I see your code that reproduce the bug? Something fundamentally wrong or broken. At best the example would consist from single header file and Py++ script. Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Birgir S. <Bir...@ro...> - 2007-03-09 18:20:52
|
Hei, here is my header file. #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> #include <string> #include <vector> class AbstractLoader : private boost::noncopyable { public: =0D AbstractLoader(); virtual ~AbstractLoader(); std::vector < std::string > extensions() const; =0D private: virtual std::vector < std::string > extensions_impl() const =3D 0; }; But mb.class_() does not find the class gives the following error. pygccxml.declarations.matcher.declaration_not_found_t: Unable to find= declaration. matcher: [(decl type=3D=3Dclass_t) and (name=3D= =3Dstd::vector<std::basic_string<char, std::char_traits<char>,= std::allocator<char> >,std::allocator<std::basic_string<char,= std::char_traits<char>, std::allocator<char> > > >)] This is printed out as the return type from the extensions function. std::vector<std::basic_string<char, std::char_traits<char>,= std::allocator<char> >,std::allocator<std::basic_string<char,= std::char_traits<char>, std::allocator<char> > > > import os from pyplusplus import module_builder #Creating an instance of class that will help you to expose your= declarations mb =3D module_builder.module_builder_t(= ['/home/birgir-s/src/abstractloader.h', ] , gccxml_path=3Dr""=0D , working_directory= =3Dr"/home/birgir-s/src" , include_paths= =3D['/home/birgir-s/src'] , define_symbols=3D[] ) mb.decls( lambda decl: 'impl' in decl.name ).exclude() #mb.print_declarations() #Creating code creator. After this step you should not modify/customize= declarations. mb.build_code_creator( module_name=3D'pyplusplus' ) all=3Dmb.class_('AbstractLoader') extensions=3Dall.mem_fun('extensions') rtype=3Dextensions.return_type print 'extensions', rtype #below will fail as declarations do not exist #rtype_cls =3D declarations.class_traits.get_declaration( rtype ) #rtype.alias =3D 'vector_of_strings' #does not print out the vector class for m in mb.classes(): print m.name #this will fail because of vector does not exist as a class #holder =3D mb.class_( 'std::vector<std::basic_string<char,= std::char_traits<char>, std::allocator<char>= >,std::allocator<std::basic_string<char, std::char_traits<char>,= std::allocator<char> > > >' ) #holder.rename( 'vectof_of_strings' ) #Writing code to file. mb.write_module( './bindings.cpp')=0D #mb.split_module('splitted') Thanks, Birgir. -----Original Message----- From: Roman Yakovenko [mailto:rom...@gm...] Sent: Fri 3/9/2007 6:31 PM To: Birgir Sigurjonsson Cc: pyg...@li... Subject: Re: [pygccxml-development] Problems with long filename =0D On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: > > > > Hei, I have tried both method, but no success yet. > > 1. when printing out mb.classes() there is not class > that starts with vector. > > 2. in the following example I get an error declarations. > How do I define the declarations? > > al_cls =3D mb.class_( 'AbstractLoader' ) > extensions =3D al_cls.mem_fun( 'extensions' ) > rtype =3D extensions.return_type > print rtype > rtype_cls =3D declarations.class_traits.get_declaration( rtype ) > rtype.alias =3D 'vector_of_strings' May I see your code that reproduce the bug? Something fundamentally wrong or broken. At best the example would consist from single header file and Py++ script. Thanks --=0D Roman Yakovenko C++ Python language binding http://www.language-binding.net/ DISCLAIMER: This message contains information that may be privileged or confidential= and is the property of the Roxar Group. It is intended only for the person= to whom it is addressed. If you are not the intended recipient, you are= not authorised to read, print, retain, copy, disseminate, distribute, or= use this message or any part thereof. If you receive this message in= error, please notify the sender immediately and delete all copies of this= message.=0D |
From: Roman Y. <rom...@gm...> - 2007-03-09 18:37:19
|
On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote: import os > from pyplusplus import module_builder > In order to use type_traits functionality it is necessary to import declarations package from pygccxml from pygccxml import declarations Sorry, I forgot to write you this #Creating an instance of class that will help you to expose your > declarations > mb = module_builder.module_builder_t( > ['/home/birgir-s/src/abstractloader.h', > ] > , gccxml_path=r"" > , > working_directory=r"/home/birgir-s/src" > , > include_paths=['/home/birgir-s/src'] > , define_symbols=[] > ) > > mb.decls( lambda decl: 'impl' in decl.name ).exclude() > > #mb.print_declarations() > > #Creating code creator. After this step you should not modify/customize > declarations. > mb.build_code_creator( module_name='pyplusplus' ) > > all=mb.class_('AbstractLoader') > extensions=all.mem_fun('extensions') > rtype=extensions.return_type > print 'extensions', rtype > #below will fail as declarations do not exist > #rtype_cls = declarations.class_traits.get_declaration( rtype ) > #rtype.alias = 'vector_of_strings' > Now this will fail for another reason: std::vector< std::string > is class declaration, as opposite to class definition. So if you will wrote next 2 lines as: rtype_cls = declarations.class_declaration_traits.get_declaration( rtype ) rtype.alias = 'vector_of_strings' This will work. I also forgot to ask you what version of Py++ pygccxml you use. Because in order to enjoy from semi automatic aliasing you need latest version of py++ and pygccxml. Automatic aliasing: add next code somewhere in a file, which is passed to gccxml, in global namespace: namespace pyplusplus{ namespace aliases{ typedef std::vector < std::string > vvvvvvvv; }} Py++ will automaticly pick the name HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |