Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] package/python-segno: new package
@ 2023-04-18 11:42 Witold Lipieta
  2023-06-22 14:55 ` Quentin Schulz via buildroot
  2023-08-25 17:06 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Witold Lipieta @ 2023-04-18 11:42 UTC (permalink / raw)
  To: buildroot; +Cc: Witold Lipieta, Yann E . MORIN, Thomas Petazzoni, Asaf Kahlon

segno 1.5.2 https://pypi.org/project/segno/

Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
---
Changes v1 -> v2:
 - resolve runtime dependency
 - add basic runtime check
---
 package/Config.in                                  |  1 +
 package/python-segno/Config.in                     |  7 +++++++
 package/python-segno/python-segno.hash             |  5 +++++
 package/python-segno/python-segno.mk               | 14 ++++++++++++++
 .../testing/tests/package/sample_python_segno.py   | 13 +++++++++++++
 support/testing/tests/package/test_python_segno.py | 11 +++++++++++
 6 files changed, 51 insertions(+)
 create mode 100644 package/python-segno/Config.in
 create mode 100644 package/python-segno/python-segno.hash
 create mode 100644 package/python-segno/python-segno.mk
 create mode 100644 support/testing/tests/package/sample_python_segno.py
 create mode 100644 support/testing/tests/package/test_python_segno.py

diff --git a/package/Config.in b/package/Config.in
index eaac32a01a..a4ad4c6ee8 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1274,6 +1274,7 @@ menu "External python modules"
 	source "package/python-sdnotify/Config.in"
 	source "package/python-secretstorage/Config.in"
 	source "package/python-see/Config.in"
+	source "package/python-segno/Config.in"
 	source "package/python-selenium/Config.in"
 	source "package/python-semver/Config.in"
 	source "package/python-sentry-sdk/Config.in"
diff --git a/package/python-segno/Config.in b/package/python-segno/Config.in
new file mode 100644
index 0000000000..3957cd79bf
--- /dev/null
+++ b/package/python-segno/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_SEGNO
+	bool "python-segno"
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS # runtime
+	help
+	  QR Code and Micro QR Code generator for Python 2 and Python 3
+
+	  https://github.com/heuer/segno/
diff --git a/package/python-segno/python-segno.hash b/package/python-segno/python-segno.hash
new file mode 100644
index 0000000000..286bdf3615
--- /dev/null
+++ b/package/python-segno/python-segno.hash
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/segno/json
+md5  6d7c852f951501cd3af85ef061d6bee4  segno-1.5.2.tar.gz
+sha256  983424b296e62189d70fc73460cd946cf56dcbe82b9bda18c066fc1b24371cdc  segno-1.5.2.tar.gz
+# Locally computed sha256 checksums
+sha256  98b0a86ca0cbf68c95051741bc983425a43fdece775fe0e2712e66be459cc9d1  LICENSE
diff --git a/package/python-segno/python-segno.mk b/package/python-segno/python-segno.mk
new file mode 100644
index 0000000000..c832f38f4b
--- /dev/null
+++ b/package/python-segno/python-segno.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-segno
+#
+################################################################################
+
+PYTHON_SEGNO_VERSION = 1.5.2
+PYTHON_SEGNO_SOURCE = segno-$(PYTHON_SEGNO_VERSION).tar.gz
+PYTHON_SEGNO_SITE = https://files.pythonhosted.org/packages/90/2a/2fedf1023f9273d8326362df7936748ebadef92ba53ab7970d9b8df1a6c2
+PYTHON_SEGNO_SETUP_TYPE = setuptools
+PYTHON_SEGNO_LICENSE = BSD-3-Clause
+PYTHON_SEGNO_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_segno.py b/support/testing/tests/package/sample_python_segno.py
new file mode 100644
index 0000000000..c96d6087ce
--- /dev/null
+++ b/support/testing/tests/package/sample_python_segno.py
@@ -0,0 +1,13 @@
+import segno
+import os
+import tempfile
+
+qr = segno.make_qr('http:/www.example.org/')
+with tempfile.NamedTemporaryFile('wb', suffix='.png', delete=False) as f:
+    fn = f.name
+qr.save(fn)
+expected = b'\211PNG\r\n\032\n'  # PNG magic number
+with open(fn, mode='rb') as f:
+    val = f.read(len(expected))
+os.unlink(fn)
+assert expected == val
diff --git a/support/testing/tests/package/test_python_segno.py b/support/testing/tests/package/test_python_segno.py
new file mode 100644
index 0000000000..75e7124399
--- /dev/null
+++ b/support/testing/tests/package/test_python_segno.py
@@ -0,0 +1,11 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Segno(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_SEGNO=y
+        """
+    sample_scripts = ["tests/package/sample_python_segno.py"]
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-25 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-18 11:42 [Buildroot] [PATCH v2 1/1] package/python-segno: new package Witold Lipieta
2023-06-22 14:55 ` Quentin Schulz via buildroot
2023-08-25 17:06 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox