Skip to contentSkip to conversation

package/python-crc: new package

PATCH In review Marcus Hoffmann via buildroot 1 participant 3 messages May 17, 2025 – Jul 20, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-crc: new package

---
 DEVELOPERS                         |  1 +
 package/Config.in                  |  1 +
 package/python-crc/Config.in       |  6 ++++++
 package/python-crc/python-crc.hash |  5 +++++
 package/python-crc/python-crc.mk   | 14 ++++++++++++++
 5 files changed, 27 insertions(+)
 create mode 100644 package/python-crc/Config.in
 create mode 100644 package/python-crc/python-crc.hash
 create mode 100644 package/python-crc/python-crc.mk
DEVELOPERS +1 -0
index c4df675aaf..e43d265d7a 100644
@@ -2274,6 +2274,7 @@ N:	Marcus Hoffmann <[email protected]>
 F:	package/nethogs/
 F:	package/pico-sdk/
 F:	package/picotool/
+F:	package/python-crc/
 F:	package/python-immutabledict/
 F:	package/python-jc/
 F:	package/python-pydantic/
package/Config.in +1 -0
index 33dc03a28a..2d787aebc3 100644
@@ -1073,6 +1073,7 @@ menu "External python modules"
 	source "package/python-contourpy/Config.in"
 	source "package/python-couchdb/Config.in"
 	source "package/python-crayons/Config.in"
+	source "package/python-crc/Config.in"
 	source "package/python-crc16/Config.in"
 	source "package/python-crcmod/Config.in"
 	source "package/python-crontab/Config.in"
package/python-crc/Config.in new file +6 -0
new file mode 100644
index 0000000000..7f5fb72307
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PYTHON_CRC
+	bool "python-crc"
+	help
+	  Pure Python CRC library.
+
+	  https://github.com/Nicoretti/crc
package/python-crc/python-crc.hash new file +5 -0
new file mode 100644
index 0000000000..f54044af5b
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/crc/json
+md5  cca626fb7bc30b4c468216ca67ee21c2  crc-7.1.0.tar.gz
+sha256  99dd540909a37ae4f62c65441df8ecb4e7f9af014fecaf4f331052a41d66c07d  crc-7.1.0.tar.gz
+# Locally computed sha256 checksums
+sha256  803152006c87fdfd8b30b087734fd590e7a8d871df1a6de40a8fbdd27673907f  LICENSE.txt
package/python-crc/python-crc.mk new file +14 -0
new file mode 100644
index 0000000000..afee463092
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-crc
+#
+################################################################################
+
+PYTHON_CRC_VERSION = 7.1.0
+PYTHON_CRC_SOURCE = crc-$(PYTHON_CRC_VERSION).tar.gz
+PYTHON_CRC_SITE = https://files.pythonhosted.org/packages/7e/e6/c3488c35ecae290751466252e5ea01ef50fc67bfc1a9aba43983329b7025
+PYTHON_CRC_SETUP_TYPE = poetry
+PYTHON_CRC_LICENSE = BSD-2-Clause
+PYTHON_CRC_LICENSE_FILES = LICENSE.txt
+
+$(eval $(python-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/python-crc: new runtime test

---
 DEVELOPERS                                         |  2 ++
 support/testing/tests/package/sample_python_crc.py |  7 +++++++
 support/testing/tests/package/test_python_crc.py   | 11 +++++++++++
 3 files changed, 20 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_crc.py
 create mode 100644 support/testing/tests/package/test_python_crc.py
DEVELOPERS +2 -0
index e43d265d7a..1d799730c0 100644
@@ -2284,12 +2284,14 @@ F:	package/python-ruamel-yaml-clib/
 F:	package/python-typing-inspection/
 F:	package/python-tzlocal/
 F:	package/python-waitress/
+F:	support/testing/tests/package/test_python_crc.py
 F:	support/testing/tests/package/test_python_fastapi.py
 F:	support/testing/tests/package/test_python_pydantic.py
 F:	support/testing/tests/package/test_python_pydantic_settings.py
 F:	support/testing/tests/package/test_python_ruamel_yaml.py
 F:	support/testing/tests/package/test_python_tzlocal.py
 F:	support/testing/tests/package/test_python_waitress.py
+F:	support/testing/tests/package/sample_python_crc.py
 F:	support/testing/tests/package/sample_python_fastapi.py
 F:	support/testing/tests/package/sample_python_pydantic.py
 F:	support/testing/tests/package/sample_python_pydantic_settings.py
support/testing/tests/package/sample_python_crc.py new file +7 -0
new file mode 100644
index 0000000000..0090df11f2
@@ -0,0 +1,7 @@
+from crc import Calculator, Crc8
+
+expected = 0xBC
+data = bytes([0, 1, 2, 3, 4, 5])
+calculator = Calculator(Crc8.CCITT)
+
+assert expected == calculator.checksum(data)
support/testing/tests/package/test_python_crc.py new file +11 -0
new file mode 100644
index 0000000000..0b36580a44
@@ -0,0 +1,11 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Crc(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_CRC=y
+        """
+    sample_scripts = ["tests/package/sample_python_crc.py"]
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot