[Buildroot] [git commit] package/python-rsa: new package

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat Sep 4 18:25:19 UTC 2021


commit: https://git.buildroot.net/buildroot/commit/?id=58c99c957b002a9d6fa7de8df24c87df379c9faf
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Python-RSA is a pure-Python RSA implementation.

Signed-off-by: Raphaël Mélotte <raphael.melotte at essensium.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 DEVELOPERS                                         |  3 +++
 package/Config.in                                  |  1 +
 package/python-rsa/Config.in                       | 11 +++++++++++
 package/python-rsa/python-rsa.hash                 |  5 +++++
 package/python-rsa/python-rsa.mk                   | 14 ++++++++++++++
 support/testing/tests/package/sample_python_rsa.py |  2 ++
 support/testing/tests/package/test_python_rsa.py   | 11 +++++++++++
 7 files changed, 47 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 5c663628b6..8bf15686a7 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2281,7 +2281,10 @@ F:	package/python-boto3/
 F:	package/python-botocore/
 F:	package/python-jmespath/
 F:	package/python-pymupdf/
+F:	package/python-rsa/
 F:	package/python-s3transfer/
+F:	support/testing/tests/package/sample_python_rsa.py
+F:	support/testing/tests/package/test_python_rsa.py
 
 N:	Refik Tuzakli <tuzakli.refik at gmail.com>
 F:	package/freescale-imx/
diff --git a/package/Config.in b/package/Config.in
index 046c04e994..1b9a960bf7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1184,6 +1184,7 @@ menu "External python modules"
 	source "package/python-requests-toolbelt/Config.in"
 	source "package/python-rpi-gpio/Config.in"
 	source "package/python-rpi-ws281x/Config.in"
+	source "package/python-rsa/Config.in"
 	source "package/python-rtslib-fb/Config.in"
 	source "package/python-s3transfer/Config.in"
 	source "package/python-scandir/Config.in"
diff --git a/package/python-rsa/Config.in b/package/python-rsa/Config.in
new file mode 100644
index 0000000000..bc9ec2feab
--- /dev/null
+++ b/package/python-rsa/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_RSA
+	bool "python-rsa"
+	depends on BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_PYTHON_PYASN1 # runtime
+	help
+	  Python-RSA is a pure-Python RSA implementation. It supports
+	  encryption and decryption, signing and verifying signatures,
+	  and key generation according to PKCS\#1 version 1.5. It can
+	  be used as a Python library as well as on the command line.
+
+	  https://stuvel.eu/rsa
diff --git a/package/python-rsa/python-rsa.hash b/package/python-rsa/python-rsa.hash
new file mode 100644
index 0000000000..9fbbf0ac88
--- /dev/null
+++ b/package/python-rsa/python-rsa.hash
@@ -0,0 +1,5 @@
+# From https://pypi.org/project/rsa/
+sha256  9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9  rsa-4.7.2.tar.gz
+
+# Locally computed
+sha256	073f28b7d389c8fe74f607e17c27f81eaa5ace69edc43a884f23f41b41c5c726  LICENSE
diff --git a/package/python-rsa/python-rsa.mk b/package/python-rsa/python-rsa.mk
new file mode 100644
index 0000000000..eaa47e8037
--- /dev/null
+++ b/package/python-rsa/python-rsa.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-rsa
+#
+################################################################################
+
+PYTHON_RSA_VERSION = 4.7.2
+PYTHON_RSA_SOURCE = rsa-$(PYTHON_RSA_VERSION).tar.gz
+PYTHON_RSA_SITE = https://files.pythonhosted.org/packages/db/b5/475c45a58650b0580421746504b680cd2db4e81bc941e94ca53785250269
+PYTHON_RSA_SETUP_TYPE = setuptools
+PYTHON_RSA_LICENSE = Apache-2.0
+PYTHON_RSA_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_rsa.py b/support/testing/tests/package/sample_python_rsa.py
new file mode 100644
index 0000000000..6f246f4d62
--- /dev/null
+++ b/support/testing/tests/package/sample_python_rsa.py
@@ -0,0 +1,2 @@
+import rsa
+(pubkey, privkey) = rsa.newkeys(512)
diff --git a/support/testing/tests/package/test_python_rsa.py b/support/testing/tests/package/test_python_rsa.py
new file mode 100644
index 0000000000..e63d63e1de
--- /dev/null
+++ b/support/testing/tests/package/test_python_rsa.py
@@ -0,0 +1,11 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3RSA(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_RSA=y
+        """
+    sample_scripts = ["tests/package/sample_python_rsa.py"]


More information about the buildroot mailing list