[PyQt] Detecting which Python version is used by SIP and PyQt

Baz Walter bazwal at ftml.net
Sat Oct 23 17:12:54 BST 2010


On 23/10/10 01:54, Xavion wrote:
> Arch Linux has recently switched its 'python' package to the Python v3
> branch.  SIP and PyQt still require the 'python2' package, probably because
> the unpatched D-Bus Python bindings currently won't work with Python v3.

there's never a dull moment with arch :)

> I'm guessing that some other Linux distributions will continue using Python
> v2 for a while yet.  Due to this uncertainty, I'm thinking that the
> Makefiles of my applications should detect whether PyQt is attached to
> Python v2 or v3.

at some point, both python2 and python3 will have a pyqt package 
available, and there will continue to be pyqt programs around that 
target either one of them. so pyqt could be "attached" to either, both 
or neither :)

> Doing so will save me from having to hard-code something like
> "#!/usr/bin/env python2" into the main executable file, only to be
> disappointed after finding out that some Linux distributions have already
> built PyQt on Python v3.
>
> I realise that I could just search for the "/site-packages/PyQt4/"
> directory, but I want a much cleaner solution that won't slow down the
> installation processes.  So, how should my Makefiles determine this
> necessary information?

are you targeting python2, python3, or both? what, exactly, is your 
installation process? does it use python at any point?


More information about the PyQt mailing list