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>
This commit is contained in:
Marcus Hoffmann 2024-08-22 11:59:53 +02:00 committed by Thomas Petazzoni
parent 33b9374d22
commit 7866b382bc
2 changed files with 17 additions and 0 deletions

View File

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

View File

@ -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))