[C++-sig] pyplusplus howto?

Roman Yakovenko roman.yakovenko at gmail.com
Sun Feb 12 07:12:08 CET 2006

On 2/12/06, Allen Bierbaum <abierbaum at gmail.com> wrote:
> Roman (and other pyplusplus users):
> I have found the thread [Re: [C++-sig] pyplusplus tutorials & GUI
> wizard] extremely helpful.  I was running into many of the same
> problems that Matthias was and this answered many questions that the
> documentation currently does not.
> It got me thinking that what may be very helpful for people trying to
> understand pyplusplus is a howto or faq page on the website.  This may
> prove to be more helpful then tutorials because I don't think you are
> ever going to be able to make tutorials/examples of everything that
> everyone may want to do.
> What do you think, could you add a howto section to your webpage?  (if
> it allowed user contributions like a wiki or user editable faq that
> would be even better :) .

I already thought to take that thread and to create how-to and\or faqs.
It will take some time. Next week I am will be on vacation. After this
I want to make new release of the projects. And only after this I will try to
create release with documentation.

> To help kick it off here are a couple of new questions I have.
> - With pyste it is possible to cache the output of gccxml in a local
> directory so it does not need to be re-run every invocation.  Is there
> some way to do with with pyplusplus?  (this is a major issue for me
> because running gccxml on the headers for the library I am wrapping
> takes multiple hours to run completely.  note: this is on a very fast
> dual athlon system with fast local disks)

You are the boss of your self. pygccxml.parser package has
2 classes that can help you:

Using source_reader_t you can generate XML files and to save them on disk.
See create_xml_file.
Using project_reader_t you can to read all declarations from those files.
As input project_reader_t.read_files functions takes a list of
instances. It should save you a lot of time. Take a look on code generated by
pyplusplus GUI. Hint: press generate advanced pyplusplus code.

> - It looks like pyplusplus is designed to run over all header files
> for a library at the same time.  Is it possible to split this up so I
> can run an individual build operation for each header file that will
> then output it's corresponding part of the full binding?  (similar to
> the multiple files option with Pyste).  (I need this because of the
> performance issues mentioned above and because of the next item).

First of all, if I understand you right, you mix 3 things here:
1. To run code generator for every header
2. To create full binding
3. To create multiple C++ source files.

First of all this is possible. There is major problem with 1 and 2
items: declarations
registration order. You will have to manage it by your self. It is manageable,
but I would not go this way. pyplusplus is able to split code to
multiple files and it
does this pretty good.May be you can test current functionality of pyplusplus.
If you see that there are problems, I will help you to resolve them.

> - I use an SCons based build with my existing pyste base wrapping.  I
> have setup SCons so it can detect when the dependencies for an
> individual pyste file change (normally used for just wrapping one
> class) and this then triggers regeneration of that portion of the
> wrappers.  This works out very nicely but I can't see yet how to do
> this with pyplusplus.  To help clarify this point, this is what the
> pyste dependencies look like at a high-level:
> ClassA.h --> ClassA.pyste --> ClassABindings.cpp
> ClassB.h --> ClassB.pyste --> ClassBBindings.cpp
> ClassC.h --> ClassC.pyste --> ClassCBindings.cpp
> Class[A,B,C].h --> Class[A,B,C].pyste --> mainBindings.cpp
> This type of setup allow an individual "build" chain for each part of
> the bindings and this is only rebuilt as needed.  Is there some way to
> do this with pyplusplus?

The answer to this question is not simple. The quick and honest answer is that
pyplusplus right now does not support such behaviour. There are few
reasons for this.
The long answer is that it is possible to implement such behaviour
with pyplusplus.
I need to think a little about your use case.

> -Allen
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig


Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list