how to get SIP ABI version PyQt is built with?
Phil Thompson
phil at riverbankcomputing.com
Thu May 13 15:04:14 BST 2021
On 13/05/2021 04:22, Kovid Goyal wrote:
> 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.
I don't see that as a bug. What matters is the version of the sip module
ABI that a project requires. The version of SIP shouldn't matter so long
as it supports that ABI version.
> 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
Why don't you just specify the minimum version of the sip ABI that you
need?
With hindsight I should have called the 'abi-version' project option
'minimum-abi-version'.
> 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?
I'm happy to add something, but I'm not sure it's necessary for this
case.
Phil
More information about the PyQt
mailing list