[PyQt] Platforms directive or tags, or both?

Larry Shaffer larrys at dakotacarto.com
Thu Oct 18 23:01:53 BST 2012


Hi,

On Thu, Oct 18, 2012 at 3:16 PM, 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?

No problem here. I think ctypes is include in Python 2.5+, but can be
installed on 2.3+ via pip or source.
http://pypi.python.org/pypi/ctypes

Larry

>                           Best regards, Jens
> --
>   \   Jens Thoms Toerring  ________      jt at toerring.de
>    \_______________________________      http://toerring.de


More information about the PyQt mailing list