how to get SIP ABI version PyQt is built with?
Kovid Goyal
kovid at kovidgoyal.net
Thu May 13 04:22:04 BST 2021
Some Linux distros, for instance, Arch Linux, have PyQt packages built
with a version of SIP different from the version of SIP they ship. This
is a distro bug, but given it is so easy to do, its likely to crop up in
the future as well.
When building third party extension modules for PyQt on such a distro,
the resulting modules are not importable since the SIP ABI version
mismatches. I currently workaround this in the calibre build system
by getting the sip-abi-version PyQt was built against and adding that to
pyproject.toml (which is dynamically generated by the calibre build
system). See this commit: https://github.com/kovidgoyal/calibre/commit/73a312dd648143006184ed71a0aab7336dc03cc1
However the code to get the sip-abi-version is pretty fragile. It tries
to find the QtCore.toml file on the filesystem and get it from there.
It would be nice if there was some more well defined/robust way to do
this, either by having it as a constant like PYQT_VERSION_STR on QtCore,
or some other mechanism. Maybe there is already such a mechanism, but I
cant find it.
For instance have the this information in a txt or toml file in
the PyQt5 root directory, then it can be queried using
importlib.resources.get_text.
Failing that is there at least some "official" way to query the path
to the bindings directory?
--
_____________________________________
Dr. Kovid Goyal
https://www.kovidgoyal.net
https://calibre-ebook.com
_____________________________________
More information about the PyQt
mailing list