[PyQt] Platforms directive or tags, or both?

Phil Thompson phil at riverbankcomputing.com
Fri Oct 19 09:19:13 BST 2012


On Thu, 18 Oct 2012 23:16:37 +0200, Jens Thoms Toerring <jt at toerring.de>
wrote:
> Hi Larry,
> 
> On Thu, Oct 18, 2012 at 02:45:30PM -0600, Larry Shaffer wrote:
>> Interesting approach. Thank you for sharing. Since the QGIS project
>> has a minimum requirement of Python 2.3 (2.5+ recommended), I think
>> maybe the Python ctypes package could be leveraged instead of
>> generating a cpp test program. I will have to ask the other QGIS devs,
>> with more knowledge in this area, if that approach is better than the
>> current platform-sniffing, hard-coded way.
>> 
>> On my Mac (Py 2.7.1), I did this:
>> 
>> import ctypes
>> ctypes.c_size_t == ctypes.c_ulong
>> # returns True
>> ctypes.c_size_t == ctypes.c_uint
>> # returns False
>> 
>> So it looks like a variation on your script will work, since Python is
>> already used as part of the CMake finds before generating the sip
>> files for the bindings. CMake (or Python) can then be used to generate
>> the sip file from the returned typedef string. Thanks again.
> 
> That looks like a brilliant idea since it avoids all the
> potential problems with getting the test program to com-
> pile! I never had a closer look at what can be done with
> ctypes, so I missed that one. Do you mind if I steal that
> idea of yours for my own project?

FYI, ctypes isn't supported on all platforms (HP-UX for example). This is
a problem for many scientific and engineering users.

Phil


More information about the PyQt mailing list