[PyKDE] SIP issues

Phil Thompson phil at riverbankcomputing.co.uk
Fri Dec 24 18:00:55 GMT 2004


On Wednesday 22 December 2004 11:08 am, Gerard Vermeulen wrote:
> (1) The code generated for an 'abstract' __call__ slot is correct, but the
> code for a virtual __call__ slot does not compile (I suspect that this is
> also the case for other virtual operators). Even when a C++ subclass
> redefines an abstract operator() as virtual, I have to make the __call__
> slot in the .sip file abstract, else the generated code won't compile.

Should be fixed in tonight's snapshot.

> (2) I persist in thinking that an __iter__ slot is useful.  It does not
> look difficult to implement (I think even I can do it) and point out that
> Boost-Python and SWIG have support for iterators. See for instance:
>    
> http://cvs.sourceforge.net/viewcvs.py/swig/SWIG/Lib/python/std_map.i?view=m
>arkup

I'm not disagreeing that it is useful - it's just not sufficiently useful for 
it to be high on my list of priorities at the moment.

> (3) The SIP snapshots do not use moc anymore and moc has disappeared from
> the SIP-build-files and Makefiles. My problem is that I offer the option to
> link and compile Qt-based libraries into my SIP-generated modules by adding
> extra targets to the sip build file. Something like:
>
> def fix_build_file(name, extra_sources, extra_headers, extra_moc_headers):
>     """Extend the targets of a SIP build file with extra files
>     """
>
>     keys = ('target', 'sources', 'headers', 'moc_headers')
>     sbf = {}
>     for key in keys:
>         sbf[key] = []
>
>     # Parse,
>     nr = 0
>     for line in open(name, 'r'):
>         nr += 1
>         if line[0] != '#':
>             eq = line.find('=')
>             if eq == -1:
>                 raise SystemExit, (
>                     '"%s\" line %d: Line must be in the form '
>                     '"key = value value...."' % (name, nr)
>                     )
>         key = line[:eq].strip()
>         value = line[eq+1:].strip()
>         if key in keys:
>             sbf[key].append(value)
>
>     # extend,
>     sbf['sources'].extend(extra_sources)
>     sbf['headers'].extend(extra_headers)
>     sbf['moc_headers'].extend(extra_moc_headers)
>
>     # and write.
>     output = open(name, 'w')
>     for key in keys:
>         if sbf[key]:
>             print >> output, '%s = %s' % (key, ' '.join(sbf[key]))
>
> # fix_build_file()
>
>    Can I persuade you to put the support for moc back into the build system
> (SIP-3 still needs it!)? If not, I have to find another solution (let my
> configure.py script run moc, for instance).

This was me having a mad moment - the old behaviour should be restored. 
However the moc support isn't documented (and never has been) because it's 
only there for SIP v3 - eventually it will be dropped, but not for the 
foreseeable future.

Phil




More information about the PyQt mailing list