[Buildroot] [PATCH 2/2] python-qt5: add PyQt5.sip module

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sun Dec 17 22:07:04 UTC 2023


Hello Ralf,

On Tue, 12 Dec 2023 17:01:12 +0100
Ralf Dragon <hypnotoad at lindra.de> wrote:

> This fixes the following runtime error when importing PyQt5 in python:
> 
> from PyQt5.QtCore import *
> ModuleNotFoundError: No module named 'PyQt5.sip'

So it means that python-pyqt5 requires this new python-pyqt5-sip
package? How come has python-pyqt5 ever worked?

> diff --git a/package/python-pyqt5-sip/Config.in b/package/python-pyqt5-sip/Config.in
> new file mode 100644
> index 0000000000..6f26271f70
> --- /dev/null
> +++ b/package/python-pyqt5-sip/Config.in
> @@ -0,0 +1,6 @@
> +config BR2_PACKAGE_PYTHON_PYQT5_SIP
> +	bool "python-pyqt5-sip"
> +	depends on BR2_PACKAGE_PYTHON_PYQT5
> +	depends on BR2_PACKAGE_PYTHON_SIP

But, but, according to what you described above, it seems like
python-pyqt5 needs python-pyqt5-sip, but here you have a
python-pyqt5-sip -> python-pyqt5 dependency.

So with your patch applied, it's still possible to enable only
python-pyqt5, so we would still have the failure you're mentioning in
your commit log.

Could you clarify?

Also, it would very, very good to add a runtime test case in
support/testing/ for this, as such Python issues are only visible at
runtime. I have added Julien Olivain in Cc, who can probably help with
this, as he is our resident expert in writing support/testing tests :-)

> diff --git a/package/python-pyqt5-sip/python-pyqt5-sip.hash b/package/python-pyqt5-sip/python-pyqt5-sip.hash
> new file mode 100644
> index 0000000000..8039cdafd9
> --- /dev/null
> +++ b/package/python-pyqt5-sip/python-pyqt5-sip.hash
> @@ -0,0 +1,4 @@
> +# from https://pypi.org/project/PyQt5-sip/12.12.1
> +

Empty line not needed.

> +sha256  8fdc6e0148abd12d977a1d3828e7b79aae958e83c6cb5adae614916d888a6b10  PyQt5_sip-12.12.1.tar.gz
> +md5  c2117da3b4c0e081c1c5a9088b8a4d55  PyQt5_sip-12.12.1.tar.gz
> diff --git a/package/python-pyqt5-sip/python-pyqt5-sip.mk b/package/python-pyqt5-sip/python-pyqt5-sip.mk
> new file mode 100644
> index 0000000000..3f689b9d47
> --- /dev/null
> +++ b/package/python-pyqt5-sip/python-pyqt5-sip.mk
> @@ -0,0 +1,15 @@
> +################################################################################
> +#
> +# python-SIP-QT5

Should be all lower-case.

> +#
> +################################################################################
> +
> +PYTHON_PYQT5_SIP_VERSION = 12.12.1
> +PYTHON_PYQT5_SIP_SITE = https://files.pythonhosted.org/packages/c1/61/4055e7a0f36339964956ff415e36f4abf82561904cc49c021da32949fc55
> +PYTHON_PYQT5_SIP_SOURCE = PyQt5_sip-$(PYTHON_PYQT5_SIP_VERSION).tar.gz
> +PYTHON_PYQT5_SIP_LICENSE = MIT
> +PYTHON_PYQT5_SIP_LICENSE_FILES = LICENSE
> +PYTHON_PYQT5_SIP_SETUP_TYPE = setuptools
> +PYTHON_PYQT5_SIP_DEPENDENCIES += python-sip

No +=, just =.

> +
> +$(eval $(python-package))
> diff --git a/package/python-pyqt5/Config.in b/package/python-pyqt5/Config.in
> index 9fa7676f98..c2a1976950 100644
> --- a/package/python-pyqt5/Config.in
> +++ b/package/python-pyqt5/Config.in
> @@ -5,6 +5,7 @@ config BR2_PACKAGE_PYTHON_PYQT5
>  	bool "python-pyqt5"
>  	depends on BR2_PACKAGE_QT5
>  	select BR2_PACKAGE_PYTHON_SIP
> +	select BR2_PACKAGE_PYTHON_PYQT5_SIP

Ah, so python-pyqt5 now selects python-pyqt5-sip, and python-pyqt5-sip
also selects python-pyqt5. This sounds like a circular dependency.

Could you perhaps give a bit more background, so that we can provide
some better guidance on how to resolve this issue properly?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com



More information about the buildroot mailing list