diff mbox series

[v2,1/1] add package/python-pyqtchart

Message ID 20220518213933.2475-1-adamg@esdemc.com
State Changes Requested
Headers show
Series [v2,1/1] add package/python-pyqtchart | expand

Commit Message

Adam Gausmann May 18, 2022, 9:39 p.m. UTC
Signed-off-by: Adam Gausmann <adamg@esdemc.com>
---
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

Comments

Arnout Vandecappelle Feb. 7, 2023, 10:55 a.m. UTC | #1
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

On 18/05/2022 23:39, Adam Gausmann via buildroot wrote:
> Signed-off-by: Adam Gausmann <adamg@esdemc.com>

[snip]

> diff --git a/package/python-pyqt5/0005-configure-emit-sip-flags.patch b/package/python-pyqt5/0005-configure-emit-sip-flags.patch
> new file mode 100644
> index 0000000000..ad524f1e53
> --- /dev/null
> +++ b/package/python-pyqt5/0005-configure-emit-sip-flags.patch
> @@ -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 <adamg@esdemc.com>

  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.

> +
> +--- 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)
> diff --git a/package/python-pyqt5/python-pyqt5.mk b/package/python-pyqt5/python-pyqt5.mk
> index af32f63796..2698a1e0ad 100644
> --- a/package/python-pyqt5/python-pyqt5.mk
> +++ b/package/python-pyqt5/python-pyqt5.mk
> @@ -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))
> diff --git a/package/python-pyqtchart/Config.in b/package/python-pyqtchart/Config.in
> new file mode 100644
> index 0000000000..a985927db7
> --- /dev/null
> +++ b/package/python-pyqtchart/Config.in
> @@ -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.

> +	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/


> diff --git a/package/python-pyqtchart/python-pyqtchart.hash b/package/python-pyqtchart/python-pyqtchart.hash
> new file mode 100644
> index 0000000000..79852741da
> --- /dev/null
> +++ b/package/python-pyqtchart/python-pyqtchart.hash
> @@ -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


> +sha256	91c9c6857e8c8891faa3875e3714392150016f365a63cdff8bfd40b6c33ea277  PyQtChart_gpl-5.7.tar.gz
> +
> +# Hash for license file
> +sha256	8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  LICENSE
> diff --git a/package/python-pyqtchart/python-pyqtchart.mk b/package/python-pyqtchart/python-pyqtchart.mk
> new file mode 100644
> index 0000000000..56bbc5d643
> --- /dev/null
> +++ b/package/python-pyqtchart/python-pyqtchart.mk
> @@ -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.

> +#
> +################################################################################
> +
> +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!

> +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

> +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

> +
> +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))
yegorslists--- via buildroot Feb. 23, 2023, 7:27 p.m. UTC | #2
(Apologies to Arnout; I forgot to click reply-all)

Hi Arnout, thanks for the review;

On Tue, Feb 7, 2023 at 4:55 AM Arnout Vandecappelle <arnout@mind.be> wrote:
> > +#
> > +################################################################################
> > +
> > +PYTHON_PYQTCHART_VERSION = 5.7
>
>   Why this ancient version released 7 years ago?

> > +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)
>
>   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.

>   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
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index ffb55dee8e..af8f9e42a9 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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 <adamg@esdemc.com>
+F:	package/python-pyqtchart/
+
 N:	Adam Heinrich <adam@adamh.cz>
 F:	package/jack1/
 
diff --git a/package/Config.in b/package/Config.in
index 8892134133..b21b3dc5c1 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/python-pyqt5/0005-configure-emit-sip-flags.patch b/package/python-pyqt5/0005-configure-emit-sip-flags.patch
new file mode 100644
index 0000000000..ad524f1e53
--- /dev/null
+++ b/package/python-pyqt5/0005-configure-emit-sip-flags.patch
@@ -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 <adamg@esdemc.com>
+
+--- 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)
diff --git a/package/python-pyqt5/python-pyqt5.mk b/package/python-pyqt5/python-pyqt5.mk
index af32f63796..2698a1e0ad 100644
--- a/package/python-pyqt5/python-pyqt5.mk
+++ b/package/python-pyqt5/python-pyqt5.mk
@@ -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))
diff --git a/package/python-pyqtchart/Config.in b/package/python-pyqtchart/Config.in
new file mode 100644
index 0000000000..a985927db7
--- /dev/null
+++ b/package/python-pyqtchart/Config.in
@@ -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/
diff --git a/package/python-pyqtchart/python-pyqtchart.hash b/package/python-pyqtchart/python-pyqtchart.hash
new file mode 100644
index 0000000000..79852741da
--- /dev/null
+++ b/package/python-pyqtchart/python-pyqtchart.hash
@@ -0,0 +1,5 @@ 
+# Locally-computed:
+sha256	91c9c6857e8c8891faa3875e3714392150016f365a63cdff8bfd40b6c33ea277  PyQtChart_gpl-5.7.tar.gz
+
+# Hash for license file
+sha256	8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  LICENSE
diff --git a/package/python-pyqtchart/python-pyqtchart.mk b/package/python-pyqtchart/python-pyqtchart.mk
new file mode 100644
index 0000000000..56bbc5d643
--- /dev/null
+++ b/package/python-pyqtchart/python-pyqtchart.mk
@@ -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))