git: 3d1012dcdaa0 - main - converters/py-tlv8: encoder of arbitrary data

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Sat, 17 Aug 2024 20:45:04 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3d1012dcdaa06d237178d18b48917c678335541e

commit 3d1012dcdaa06d237178d18b48917c678335541e
Author:     Shapovalov Alexey <aishapoval@mts.ru>
AuthorDate: 2024-07-02 18:36:38 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-08-17 20:44:41 +0000

    converters/py-tlv8: encoder of arbitrary data
    
    Sponsored by:   Serenity Cybersecurity, LLC
    Co-authored-by: Gleb Popov <arrowd@FreeBSD.org>
---
 comms/Makefile               |  1 +
 comms/py-nkdfu/Makefile      | 31 +++++++++++++++++++++++++++++++
 comms/py-nkdfu/distinfo      |  3 +++
 comms/py-nkdfu/pkg-descr     |  3 +++
 converters/Makefile          |  1 +
 converters/py-tlv8/Makefile  | 22 ++++++++++++++++++++++
 converters/py-tlv8/distinfo  |  3 +++
 converters/py-tlv8/pkg-descr |  4 ++++
 8 files changed, 68 insertions(+)

diff --git a/comms/Makefile b/comms/Makefile
index 506f6ae1b662..4e99ca4066c8 100644
--- a/comms/Makefile
+++ b/comms/Makefile
@@ -137,6 +137,7 @@
     SUBDIR += py-libimobiledevice
     SUBDIR += py-libscrc
     SUBDIR += py-libusbsio
+    SUBDIR += py-nkdfu
     SUBDIR += py-pylink-square
     SUBDIR += py-pymodbus
     SUBDIR += py-pyocd
diff --git a/comms/py-nkdfu/Makefile b/comms/py-nkdfu/Makefile
new file mode 100644
index 000000000000..c9668b2f1026
--- /dev/null
+++ b/comms/py-nkdfu/Makefile
@@ -0,0 +1,31 @@
+PORTNAME=	nkdfu
+PORTVERSION=	0.2
+CATEGORIES=	comms python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	aishapoval@mts.ru
+COMMENT=	Python DFU tool for updating Nitrokeys' firmware (Nitrokey Pro only)
+WWW=		https://github.com/Nitrokey/nkdfu
+
+LICENSE=	GPLv2
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}fire>=0:devel/py-fire@${PY_FLAVOR}  \
+		${PYTHON_PKGNAMEPREFIX}tqdm>=0:misc/py-tqdm@${PY_FLAVOR}  \
+		${PYTHON_PKGNAMEPREFIX}intelhex>=2.3.0:devel/py-intelhex@${PY_FLAVOR}  \
+		${PYTHON_PKGNAMEPREFIX}libusb1>=1.9.3:devel/py-libusb1@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}fire>=0:devel/py-fire@${PY_FLAVOR}  \
+		${PYTHON_PKGNAMEPREFIX}tqdm>=0:misc/py-tqdm@${PY_FLAVOR}  \
+		${PYTHON_PKGNAMEPREFIX}intelhex>=2.3.0:devel/py-intelhex@${PY_FLAVOR}  \
+		${PYTHON_PKGNAMEPREFIX}libusb1>=1.9.3:devel/py-libusb1@${PY_FLAVOR}
+
+PEP517_BUILD_CMD=	${PYTHON_CMD} -m flit_core.wheel
+PEP517_BUILD_DEPEND=	${PYTHON_PKGNAMEPREFIX}flit-core>=3.2.0<4:devel/py-flit-core@${PY_FLAVOR}
+
+USES=		python shebangfix
+USE_PYTHON=	autoplist pep517
+
+SHEBANG_FILES=  nkdfu/dfu_flash.py
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/comms/py-nkdfu/distinfo b/comms/py-nkdfu/distinfo
new file mode 100644
index 000000000000..9d7d21669844
--- /dev/null
+++ b/comms/py-nkdfu/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1706027633
+SHA256 (nkdfu-0.2.tar.gz) = f25f75ddd382c47285b6943cde9f51577b1496ed284f93d58b5e054ae609f5f8
+SIZE (nkdfu-0.2.tar.gz) = 16700
diff --git a/comms/py-nkdfu/pkg-descr b/comms/py-nkdfu/pkg-descr
new file mode 100644
index 000000000000..1cc8a061fe12
--- /dev/null
+++ b/comms/py-nkdfu/pkg-descr
@@ -0,0 +1,3 @@
+nkdfu is a Python DFU tool for updating Nitrokeys' firmware. Currently
+supports Nitrokey Pro only. Based on python-dfu project, which brings
+implementation of USB DFU 1.1 spec
diff --git a/converters/Makefile b/converters/Makefile
index 18455e6a3744..589fff718538 100644
--- a/converters/Makefile
+++ b/converters/Makefile
@@ -155,6 +155,7 @@
     SUBDIR += py-rencode
     SUBDIR += py-svglib
     SUBDIR += py-text-unidecode
+    SUBDIR += py-tlv8
     SUBDIR += py-unidecode
     SUBDIR += py-webencodings
     SUBDIR += py-zfec
diff --git a/converters/py-tlv8/Makefile b/converters/py-tlv8/Makefile
new file mode 100644
index 000000000000..7a9145ed3980
--- /dev/null
+++ b/converters/py-tlv8/Makefile
@@ -0,0 +1,22 @@
+PORTNAME=	tlv8
+PORTVERSION=	0.10.0
+CATEGORIES=	converters python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	awoonyaa@gmail.com
+COMMENT=	Python module to handle type-length-value encoded data 8-bit type
+WWW=		https://pypi.org/project/tlv8/
+
+LICENSE=	APACHE20
+
+BUILD_DEPENDS=	${PY_SETUPTOOLS} \
+		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}setuptools-scm>0:devel/py-setuptools-scm@${PY_FLAVOR}
+
+USES=		python
+USE_PYTHON=	autoplist concurrent pep517
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/converters/py-tlv8/distinfo b/converters/py-tlv8/distinfo
new file mode 100644
index 000000000000..a34d281b47bf
--- /dev/null
+++ b/converters/py-tlv8/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1706036438
+SHA256 (tlv8-0.10.0.tar.gz) = 7930a590267b809952272ac2a27ee81b99ec5191fa2eba08050e0daee4262684
+SIZE (tlv8-0.10.0.tar.gz) = 16054
diff --git a/converters/py-tlv8/pkg-descr b/converters/py-tlv8/pkg-descr
new file mode 100644
index 000000000000..c4758204e715
--- /dev/null
+++ b/converters/py-tlv8/pkg-descr
@@ -0,0 +1,4 @@
+Type-Length-Value (TLV) are used to encode arbitrary data. In this case the type
+and length are represented by 1 byte each. Hence the name TLV8.
+
+This Python library implements encoding and decoding of TLV8 data.