Skip to contentSkip to conversation

add package/python-pyqtchart

PATCH In review Adam Gausmann via buildroot 2 participants 3 messages May 18, 2022 – Feb 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 add package/python-pyqtchart

---
Changes v1 -> v2:
- python-pyqtchart/Config.in: Fix typo in package description (thanks Yegor)
- python-pyqtchart.mk: Remove unnecessary python2 compat (thanks Yegor)
- python-pyqtchart.mk: Add qt5charts as a dependency
- Add myself to DEVELOPERS

 DEVELOPERS                                    |  3 ++
 package/Config.in                             |  1 +
 .../0005-configure-emit-sip-flags.patch       | 25 ++++++++++++
 package/python-pyqt5/python-pyqt5.mk          |  2 +-
 package/python-pyqtchart/Config.in            |  8 ++++
 .../python-pyqtchart/python-pyqtchart.hash    |  5 +++
 package/python-pyqtchart/python-pyqtchart.mk  | 40 +++++++++++++++++++
 7 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 package/python-pyqt5/0005-configure-emit-sip-flags.patch
 create mode 100644 package/python-pyqtchart/Config.in
 create mode 100644 package/python-pyqtchart/python-pyqtchart.hash
 create mode 100644 package/python-pyqtchart/python-pyqtchart.mk
DEVELOPERS +3 -0
index ffb55dee8e..af8f9e42a9 100644
@@ -26,6 +26,9 @@
 #   infrastructure, and will be CC'ed on all patches that add or
 #   modify packages that use this infrastructure.
 
+N:	Adam Gausmann <[email protected]>
+F:	package/python-pyqtchart/
+
 N:	Adam Heinrich <[email protected]>
 F:	package/jack1/
 
package/Config.in +1 -0
index 8892134133..b21b3dc5c1 100644
@@ -1176,6 +1176,7 @@ menu "External python modules"
 	source "package/python-pyphen/Config.in"
 	source "package/python-pyqrcode/Config.in"
 	source "package/python-pyqt5/Config.in"
+	source "package/python-pyqtchart/Config.in"
 	source "package/python-pyratemp/Config.in"
 	source "package/python-pyroute2/Config.in"
 	source "package/python-pysendfile/Config.in"
package/python-pyqt5/0005-configure-emit-sip-flags.patch new file +25 -0
new file mode 100644
index 0000000000..ad524f1e53
@@ -0,0 +1,25 @@
+configure.py: emit sip_flags
+
+Other PyQt packages (e.g. PyQtChart) obtain their sip_flags from PyQt5. The
+default mechanism is for PyQt5 to embed it in the QtCore package and the other
+packages will try to import PyQt5.QtCore and read it; however, because this is
+not a host package, it cannot be imported during configuration.
+
+Another option is to provide those flags as a command-line option to the other
+packages' configure.py scripts. So, this patch emits the sip_flags generated by
+PyQt5 to a file which will be installed in staging dir for the other packages
+to read.
+
+Signed-off-by: Adam Gausmann <[email protected]>
+
+--- a/configure.py	2022-05-12 14:45:48.624851781 -0500
++++ b/configure.py	2022-05-12 14:44:24.704852510 -0500
+@@ -1450,6 +1450,8 @@ def generate_makefiles(target_config, ve
+ 
+     # Set the SIP platform, version and feature flags.
+     sip_flags = get_sip_flags(target_config)
++    with open('sip_flags', 'w+') as f:
++        f.write(sip_flags)
+ 
+     # Go through the modules.
+     pyqt_modules = list(target_config.pyqt_modules)
package/python-pyqt5/python-pyqt5.mk +1 -1
index af32f63796..2698a1e0ad 100644
@@ -157,7 +157,6 @@ PYTHON_PYQT5_CONF_OPTS = \
 	-w --confirm-license \
 	--no-designer-plugin \
 	--no-docstrings \
-	--no-sip-files \
 	$(foreach module,$(PYTHON_PYQT5_MODULES),--enable=$(module))
 
 define PYTHON_PYQT5_CONFIGURE_CMDS
@@ -180,6 +179,7 @@ define PYTHON_PYQT5_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) install
 	touch $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/PyQt5/__init__.py
 	$(RM) -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/PyQt5/uic/port_v2
+	install -D $(@D)/sip_flags $(STAGING_DIR)/usr/share/PyQt5/sip_flags
 endef
 
 $(eval $(generic-package))
package/python-pyqtchart/Config.in new file +8 -0
new file mode 100644
index 0000000000..a985927db7
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_PYQTCHART
+	bool "python-pyqtchart"
+	depends on BR2_PACKAGE_PYTHON_PYQT5
+	select BR2_PACKAGE_QT5CHARTS
+	help
+	  Python bindings for Qt Charts.
+
+	  http://www.riverbankcomputing.com/software/pyqt/
package/python-pyqtchart/python-pyqtchart.hash new file +5 -0
new file mode 100644
index 0000000000..79852741da
@@ -0,0 +1,5 @@
+# Locally-computed:
+sha256	91c9c6857e8c8891faa3875e3714392150016f365a63cdff8bfd40b6c33ea277  PyQtChart_gpl-5.7.tar.gz
+
+# Hash for license file
+sha256	8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  LICENSE
package/python-pyqtchart/python-pyqtchart.mk new file +40 -0
new file mode 100644
index 0000000000..56bbc5d643
@@ -0,0 +1,40 @@
+################################################################################
+#
+# python-pyqtchart
+#
+################################################################################
+
+PYTHON_PYQTCHART_VERSION = 5.7
+PYTHON_PYQTCHART_SOURCE = PyQtChart_gpl-$(PYTHON_PYQTCHART_VERSION).tar.gz
+PYTHON_PYQTCHART_SITE = http://downloads.sourceforge.net/project/pyqt/PyQtChart/PyQtChart-$(PYTHON_PYQTCHART_VERSION)
+PYTHON_PYQTCHART_LICENSE = GPL-3.0
+
+PYTHON_PYQTCHART_DEPENDENCIES = python-pyqt5 qt5charts
+
+PYTHON_PYQTCHART_CONF_OPTS = \
+	--destdir $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/PyQt5 \
+	--qmake $(HOST_DIR)/bin/qmake \
+	--sysroot $(STAGING_DIR)/usr \
+	--no-docstrings \
+	--no-sip-files \
+	--pyqt-sip-flags "$(file <$(STAGING_DIR)/usr/share/PyQt5/sip_flags)" \
+	--qtchart-version=2.0.1 \
+
+define PYTHON_PYQTCHART_CONFIGURE_CMDS
+	(cd $(@D); \
+		$(TARGET_MAKE_ENV) \
+		$(TARGET_CONFIGURE_OPTS) \
+		$(HOST_DIR)/bin/python configure.py \
+			$(PYTHON_PYQTCHART_CONF_OPTS) \
+	)
+endef
+
+define PYTHON_PYQTCHART_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
+endef
+
+define PYTHON_PYQTCHART_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) install
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Adam,

Sorry for the very late reply to your contribution. Unfortunately, there are
some issues still that I can't easily resolve by myself, see below. Therefore, the patch has been marked as Changes Requested in patchwork.

Small nitpick: the subject line should be
package/python-pyqtchart: new package

Quoted 1 line · Adam Gausmann via buildroot

[snip]

Quoted 9 lines
package/python-pyqt5/0005-configure-emit-sip-flags.patch new file +3 -0
new file mode 100644
index 0000000000..ad524f1e53
@@ -0,0 +1,25 @@
+configure.py: emit sip_flags
+
+Other PyQt packages (e.g. PyQtChart) obtain their sip_flags from PyQt5. The

package/python-pyqt5/0005-configure-emit-sip-flags.patch line 13

Quoted 10 lines
package/python-pyqt5/0005-configure-emit-sip-flags.patch new file +10 -0
+default mechanism is for PyQt5 to embed it in the QtCore package and the other
+packages will try to import PyQt5.QtCore and read it; however, because this is
+not a host package, it cannot be imported during configuration.
+
+Another option is to provide those flags as a command-line option to the other
+packages' configure.py scripts. So, this patch emits the sip_flags generated by
+PyQt5 to a file which will be installed in staging dir for the other packages
+to read.
+
+Signed-off-by: Adam Gausmann <[email protected]>

Please also send this patch upstream (to the PyQt5 mailing list), and add a
reference to the upstream submission here:

Upstream: https://www.riverbankcomputing.com/pipermail/pyqt/...

Also, this should probably be added to Buildroot as a separate commit,
because it affects python-pyqt, not python-pyqtchart.

Quoted 38 lines
package/python-pyqt5/0005-configure-emit-sip-flags.patch new file +12 -0
+
+--- a/configure.py	2022-05-12 14:45:48.624851781 -0500
++++ b/configure.py	2022-05-12 14:44:24.704852510 -0500
+@@ -1450,6 +1450,8 @@ def generate_makefiles(target_config, ve
+
+     # Set the SIP platform, version and feature flags.
+     sip_flags = get_sip_flags(target_config)
++    with open('sip_flags', 'w+') as f:
++        f.write(sip_flags)
+
+     # Go through the modules.
+     pyqt_modules = list(target_config.pyqt_modules)
package/python-pyqt5/python-pyqt5.mk +1 -1
index af32f63796..2698a1e0ad 100644
@@ -157,7 +157,6 @@ PYTHON_PYQT5_CONF_OPTS = \
  	-w --confirm-license \
  	--no-designer-plugin \
  	--no-docstrings \
-	--no-sip-files \
  	$(foreach module,$(PYTHON_PYQT5_MODULES),--enable=$(module))
 
  define PYTHON_PYQT5_CONFIGURE_CMDS
@@ -180,6 +179,7 @@ define PYTHON_PYQT5_INSTALL_TARGET_CMDS
  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) install
  	touch $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/PyQt5/__init__.py
  	$(RM) -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/PyQt5/uic/port_v2
+	install -D $(@D)/sip_flags $(STAGING_DIR)/usr/share/PyQt5/sip_flags
  endef
 
  $(eval $(generic-package))
package/python-pyqtchart/Config.in new file +0 -0
new file mode 100644
index 0000000000..a985927db7

package/python-pyqtchart/Config.in line 3

Quoted 3 lines
package/python-pyqtchart/Config.in new file +3 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_PYQTCHART
+	bool "python-pyqtchart"
+	depends on BR2_PACKAGE_PYTHON_PYQT5

Instead of depending on pyqt5, it would be beter to depend on qt5 and select
pyqt5.

package/python-pyqtchart/Config.in line 8

Quoted 5 lines
package/python-pyqtchart/Config.in new file +5 -0
+	select BR2_PACKAGE_QT5CHARTS
+	help
+	  Python bindings for Qt Charts.
+
+	  http://www.riverbankcomputing.com/software/pyqt/

The actual upstream is

https://www.riverbankcomputing.com/software/pyqtchart/

package/python-pyqtchart/python-pyqtchart.hash line 1

Quoted 7 lines
package/python-pyqtchart/python-pyqtchart.hash new file +1 -0
new file mode 100644
index 0000000000..79852741da
@@ -0,0 +1,5 @@
+# Locally-computed:

You should probably download from pypi and get the hash from there:

https://pypi.org/project/PyQtChart/#copy-hash-modal-8c261058-8981-4409-8b07-6610f35ddd52

package/python-pyqtchart/python-pyqtchart.mk line 3

Quoted 13 lines
package/python-pyqtchart/python-pyqtchart.hash new file +4 -0
+sha256	91c9c6857e8c8891faa3875e3714392150016f365a63cdff8bfd40b6c33ea277  PyQtChart_gpl-5.7.tar.gz
+
+# Hash for license file
+sha256	8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  LICENSE
package/python-pyqtchart/python-pyqtchart.mk new file +3 -0
new file mode 100644
index 0000000000..56bbc5d643
@@ -0,0 +1,40 @@
+################################################################################
+#
+# python-pyqtchart

Wouldn't it make more sense to call this python-pyqt5chart, given that there's
python-pyqt5, and that there's PyQt6-Charts? Normally we prefer to use the upstream name, which is pyqtchart (or PyQt-Charts or PyQtChart, depending on where you look), but in this case I feel OK calling it python-pyqt5chart.

package/python-pyqtchart/python-pyqtchart.mk line 7

Quoted 4 lines
package/python-pyqtchart/python-pyqtchart.mk new file +4 -0
+#
+################################################################################
+
+PYTHON_PYQTCHART_VERSION = 5.7

Why this ancient version released 7 years ago? There's a 5.15.6... I'm
surprised this ancient version even works with our current Qt version!

package/python-pyqtchart/python-pyqtchart.mk line 9

Quoted 2 lines
package/python-pyqtchart/python-pyqtchart.mk new file +2 -0
+PYTHON_PYQTCHART_SOURCE = PyQtChart_gpl-$(PYTHON_PYQTCHART_VERSION).tar.gz
+PYTHON_PYQTCHART_SITE = http://downloads.sourceforge.net/project/pyqt/PyQtChart/PyQtChart-$(PYTHON_PYQTCHART_VERSION)

As mentioned earlier, better download from pypi

package/python-pyqtchart/python-pyqtchart.mk line 21

Quoted 12 lines
package/python-pyqtchart/python-pyqtchart.mk new file +12 -0
+PYTHON_PYQTCHART_LICENSE = GPL-3.0
+
+PYTHON_PYQTCHART_DEPENDENCIES = python-pyqt5 qt5charts
+
+PYTHON_PYQTCHART_CONF_OPTS = \
+	--destdir $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/PyQt5 \
+	--qmake $(HOST_DIR)/bin/qmake \
+	--sysroot $(STAGING_DIR)/usr \
+	--no-docstrings \
+	--no-sip-files \
+	--pyqt-sip-flags "$(file <$(STAGING_DIR)/usr/share/PyQt5/sip_flags)" \
+	--qtchart-version=2.0.1 \

Where does this version number come from? Please explain in the commit message.

Regards,
Arnout

Quoted 9 lines
package/python-pyqtchart/python-pyqtchart.mk new file +9 -0
+
+define PYTHON_PYQTCHART_CONFIGURE_CMDS
+	(cd $(@D); \
+		$(TARGET_MAKE_ENV) \
+		$(TARGET_CONFIGURE_OPTS) \
+		$(HOST_DIR)/bin/python configure.py \
+			$(PYTHON_PYQTCHART_CONF_OPTS) \
+	)
+endef

package/python-pyqtchart/python-pyqtchart.mk line 40

Quoted 10 lines
package/python-pyqtchart/python-pyqtchart.mk new file +10 -0
+
+define PYTHON_PYQTCHART_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
+endef
+
+define PYTHON_PYQTCHART_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) install
+endef
+
+$(eval $(generic-package))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

(Apologies to Arnout; I forgot to click reply-all)

Hi Arnout, thanks for the review;

Quoted 9 lines · Arnout Vandecappelle

package/python-pyqtchart/python-pyqtchart.mk line 7

Quoted 4 lines
package/python-pyqtchart/python-pyqtchart.mk new file +4 -0
+#
+################################################################################
+
+PYTHON_PYQTCHART_VERSION = 5.7

Why this ancient version released 7 years ago?

Review

Quoted 2 lines
(quoted diff) +2 -0
+PYTHON_PYQTCHART_SOURCE = PyQtChart_gpl-$(PYTHON_PYQTCHART_VERSION).tar.gz
+PYTHON_PYQTCHART_SITE = http://downloads.sourceforge.net/project/pyqt/PyQtChart/PyQtChart-$(PYT

HON_PYQTCHART_VERSION)

Quoted 2 lines

As mentioned earlier, better download from pypi

Keep in mind, I wrote this almost a year ago!
This is the version and site that was used for python-pyqt5 back then. I will certainly update these in the next revision of the patch.

Quoted 4 lines

Wouldn't it make more sense to call this python-pyqt5chart, given that there's
python-pyqt5, and that there's PyQt6-Charts? Normally we prefer to use the upstream name, which is pyqtchart (or PyQt-Charts or PyQtChart, depending on where you look), but in this case I feel OK calling it python-pyqt5chart.

The PyPI packages are "PyQtChart" (The original/legacy name for the Qt5 version) and "PyQt6-Charts"; the download page refers to them as "PyQt-Charts for PyQt5" and "PyQt-Charts for PyQt6".
(https://www.riverbankcomputing.com/software/pyqtchart/download)

My suggestion is to keep it the same as the official PyPI packages; either keep the legacy name "PyQtChart" (python-pyqtchart) or if you want to include the version number, retroactively use the naming scheme from "PyQt6-Charts" to make "PyQt5-Charts" (python-pyqt5-charts).

However, I don't have a strong preference; I'll use whatever name works best for you all.

Thanks,
Adam
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot