From 4c0b9957be895163ceb5594b873cb759e785c13a Mon Sep 17 00:00:00 2001
From: j1nx
Date: Wed, 5 May 2021 11:09:27 +0200
Subject: [PATCH] Add python-smbus2 package
---
buildroot-external/Config.in | 1 +
buildroot-external/configs/rpi4_64-gui_defconfig | 1 +
buildroot-external/package/python-smbus2/Config.in | 7 +++++++
.../package/python-smbus2/python-smbus2.hash | 5 +++++
.../package/python-smbus2/python-smbus2.mk | 14 ++++++++++++++
5 files changed, 28 insertions(+)
create mode 100644 buildroot-external/package/python-smbus2/Config.in
create mode 100644 buildroot-external/package/python-smbus2/python-smbus2.hash
create mode 100644 buildroot-external/package/python-smbus2/python-smbus2.mk
diff --git a/buildroot-external/Config.in b/buildroot-external/Config.in
index 864b13b8..47c6042e 100644
--- a/buildroot-external/Config.in
+++ b/buildroot-external/Config.in
@@ -162,6 +162,7 @@ menu "Additional external python modules"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-requests-futures/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-rsa/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-sgmllib3k/Config.in"
+ source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-smbus2/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-smmap/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-source/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-speech2text/Config.in"
diff --git a/buildroot-external/configs/rpi4_64-gui_defconfig b/buildroot-external/configs/rpi4_64-gui_defconfig
index 6bdfbec4..7d4f578c 100644
--- a/buildroot-external/configs/rpi4_64-gui_defconfig
+++ b/buildroot-external/configs/rpi4_64-gui_defconfig
@@ -585,6 +585,7 @@ BR2_PACKAGE_PYTHON_RAPIDFUZZ=y
BR2_PACKAGE_PYTHON_REQUESTS_CACHE=y
BR2_PACKAGE_PYTHON_REQUESTS_FUTURES=y
BR2_PACKAGE_PYTHON_SGMLLIB3K=y
+BR2_PACKAGE_PYTHON_SMBUS2=y
BR2_PACKAGE_PYTHON_SMMAP=y
BR2_PACKAGE_PYTHON_SOURCE=y
BR2_PACKAGE_PYTHON_TZLOCAL=y
diff --git a/buildroot-external/package/python-smbus2/Config.in b/buildroot-external/package/python-smbus2/Config.in
new file mode 100644
index 00000000..fdacae6d
--- /dev/null
+++ b/buildroot-external/package/python-smbus2/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_SMBUS2
+ bool "python-smbus2"
+ help
+ smbus2 is a drop-in replacement for smbus-cffi/smbus-python
+ in pure Python.
+
+ https://github.com/kplindegaard/smbus2
diff --git a/buildroot-external/package/python-smbus2/python-smbus2.hash b/buildroot-external/package/python-smbus2/python-smbus2.hash
new file mode 100644
index 00000000..5aac6b56
--- /dev/null
+++ b/buildroot-external/package/python-smbus2/python-smbus2.hash
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/smbus2/json
+md5 ea4bba25b43863aecd6ec33b2252fdae smbus2-0.4.1.tar.gz
+sha256 6276eb599b76c4e74372f2582d2282f03b4398f0da16bc996608e4f21557ca9b smbus2-0.4.1.tar.gz
+# Locally computed sha256 checksums
+sha256 6ee9cf18c3a75dd76fb549a4b607ae34eedc31a796c48157895e2ad28d66ce79 LICENSE
diff --git a/buildroot-external/package/python-smbus2/python-smbus2.mk b/buildroot-external/package/python-smbus2/python-smbus2.mk
new file mode 100644
index 00000000..2200b554
--- /dev/null
+++ b/buildroot-external/package/python-smbus2/python-smbus2.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-smbus2
+#
+################################################################################
+
+PYTHON_SMBUS2_VERSION = 0.4.1
+PYTHON_SMBUS2_SOURCE = smbus2-$(PYTHON_SMBUS2_VERSION).tar.gz
+PYTHON_SMBUS2_SITE = https://files.pythonhosted.org/packages/d9/33/787448c69603eec96af07d36f7ae3a7e3fce4020632eddb55152dc903233
+PYTHON_SMBUS2_SETUP_TYPE = setuptools
+PYTHON_SMBUS2_LICENSE = MIT
+PYTHON_SMBUS2_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))