[PyQt] How to avoid duplication in SIP?

Phil Thompson phil at riverbankcomputing.com
Sun Apr 9 22:24:22 BST 2017


On 9 Apr 2017, at 4:05 pm, Shaheed Haque <srhaque at theiet.org> wrote:
> 
> A recurring problem with my SIP generator efforts is the need to deal
> with duplicate SIP code. So far, I've been able to use the SIP concept
> of a "feature" to deal with various manifestations of this, but I have
> now hit one that has me stumped:
> 
> - Module A has a mapped type MTA (e.g. QPair<init, int>)
> - Module B imports A, but also needs a mapped type for QPair<int, int>.
> 
> when the generator runs for module B, it is not aware of MTA, so it
> ends up emitting MTB for its QPair<init, int>. Of course, when I run
> SIP on B, MTA and MTB collide.
> 
> Is there something already in SIP I could use to say "this duplicate
> is fine"? If not, would it be possible to add support for the SIP
> equivalent of a define guard, along the lines "#define
> feature"/"#ifdef feature"?
> 
> I realise that by generating the SIP code, I'm in a minority of SIP
> users, but such a feature would also significantly simplify certain
> other scenarios that affect me too.

Why not fix your generator so that B knows the mapped type is defined elswhere?

Phil


More information about the PyQt mailing list