[PyQt] How to compile with PyQt5?

Scott Kitterman debian at kitterman.com
Sun Aug 3 06:38:52 BST 2014


On Sunday, August 03, 2014 08:35:15 Kovid Goyal wrote:
> Incidentally, the logic in QSintilla's build system to detect
> pyqt_sip_dir is broken on some linux distros. For example, on Arch,
> /usr/share/sip contains separate sip bindings for python 2.x and python
> 3.x.
> 
> 
> /usr/share/sip/Py2-PyQt5  /usr/share/sip/PyQt4  /usr/share/sip/PyQt5
> 
> As best as I can tell, configure.py just does sys.prefix +
> '/share/sip/PyQt5' regardless of version.
> 
> I suggest that the best way to make this robust is to write this path
> in QtCore.PYQT_CONFIGURATION at PyQt install time.
> 
> I have calibre currently doing:
> 
> def get_sip_dir(q):
>     # Every distro has its own bright ideas about where to put the PyQt
> bindings. for x in ('', 'Py2-PyQt5', 'PyQt5', 'sip/PyQt5'):
>         base = os.path.join(q, x)
>         if os.path.exists(os.path.join(base, 'QtWidgets')):
>             return base
>     return q
> pyqt['pyqt_sip_dir'] = get_sip_dir(sys.prefix if iswindows else
> os.path.join(sys.prefix, 'share', 'sip'))

For Debian/Ubuntu they are in /usr/share/sip/PyQt5.  That's based on the 
default py_sip_dir in Python/configure.py.  

We made the decision only to package PyQt5 and PyQt5.QSci for Python3 (it 
simplifies the packaging work and we made the assumption that any new code 
being ported to Qt5 would also be ported to Python3.  Is that going to be a 
problem?

The biggest challenge I had with packaging Qscintilla2 for Qt4 and Qt5 was 
making libraries co-installable.  We build libqscintilla2 as libqt5scintilla2 
for Qt5 so both the Qt4 and Qt5 versions can be co-installed.  Assuming I did 
it right though, it shouldn't matter for any upstream developers.  Packagers 
just need to know the name of the right -dev packages.

Scott K


More information about the PyQt mailing list