From 7866b382bc7e1adc93925076f0b9719d78886e40 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 22 Aug 2024 11:59:53 +0200 Subject: [PATCH] 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 Signed-off-by: Thomas Petazzoni --- package/python-can/Config.in | 10 ++++++++++ package/python-can/python-can.mk | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/package/python-can/Config.in b/package/python-can/Config.in index 61955a2b00..34ba35bad2 100644 --- a/package/python-can/Config.in +++ b/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 diff --git a/package/python-can/python-can.mk b/package/python-can/python-can.mk index b6547a4d3f..bc67be4f8c 100644 --- a/package/python-can/python-can.mk +++ b/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))