Răsfoiți Sursa

package/python-can: add option to install the viewer tool

Enabling the option correctly select the python-curses module dependency
of the viewer tool.

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Marcus Hoffmann 11 luni în urmă
părinte
comite
7866b382bc
2 a modificat fișierele cu 17 adăugiri și 0 ștergeri
  1. 10 0
      package/python-can/Config.in
  2. 7 0
      package/python-can/python-can.mk

+ 10 - 0
package/python-can/Config.in

@@ -11,3 +11,13 @@ config BR2_PACKAGE_PYTHON_CAN
 	  Python.
 
 	  https://github.com/hardbyte/python-can
+
+if BR2_PACKAGE_PYTHON_CAN
+
+config BR2_PACKAGE_PYTHON_CAN_VIEWER
+	bool "python-can-viewer"
+	select BR2_PACKAGE_PYTHON3_CURSES # runtime
+	help
+	  Also install the viewer tool (requires ncurses).
+
+endif

+ 7 - 0
package/python-can/python-can.mk

@@ -11,4 +11,11 @@ PYTHON_CAN_SETUP_TYPE = setuptools
 PYTHON_CAN_LICENSE = LGPL-3.0
 PYTHON_CAN_LICENSE_FILES = LICENSE.txt
 
+ifneq ($(BR2_PACKAGE_PYTHON_CAN_VIEWER),y)
+define PYTHON_CAN_REMOVE_VIEWER
+	rm -f $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/can/viewer.py
+endef
+PYTHON_CAN_POST_INSTALL_TARGET_HOOKS += PYTHON_CAN_REMOVE_VIEWER
+endif
+
 $(eval $(python-package))