Skip to contentSkip to conversation

package/python-waitress: new package

PATCH In review Marcus Hoffmann via buildroot 1 participant 2 messages Feb 7, 2024 – Feb 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python-waitress: new package

The test runs the flask sample app through the waitress wsgi server instead of the flask development server.

---
 package/Config.in                             |  1 +
 package/python-waitress/Config.in             | 11 ++++++
 package/python-waitress/python-waitress.hash  |  5 +++
 package/python-waitress/python-waitress.mk    | 14 ++++++++
 .../tests/package/test_python_waitress.py     | 34 +++++++++++++++++++
 5 files changed, 65 insertions(+)
 create mode 100644 package/python-waitress/Config.in
 create mode 100644 package/python-waitress/python-waitress.hash
 create mode 100644 package/python-waitress/python-waitress.mk
 create mode 100644 support/testing/tests/package/test_python_waitress.py
package/Config.in +1 -0
index 97f590e2b7..bf8c325e99 100644
@@ -1406,6 +1406,7 @@ menu "External python modules"
 	source "package/python-validators/Config.in"
 	source "package/python-versiontools/Config.in"
 	source "package/python-visitor/Config.in"
+	source "package/python-waitress/Config.in"
 	source "package/python-watchdog/Config.in"
 	source "package/python-wcwidth/Config.in"
 	source "package/python-weasyprint/Config.in"
package/python-waitress/Config.in new file +11 -0
new file mode 100644
index 0000000000..7d8c73a650
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_WAITRESS
+	bool "python-waitress"
+	help
+	  Waitress WSGI server.
+
+	  Waitress is a production-quality pure-Python WSGI server
+	  with very acceptable performance. It has no dependencies
+	  except ones which live in the Python standard library.
+	  It supports HTTP/1.0 and HTTP/1.1.
+
+	  https://github.com/Pylons/waitress
package/python-waitress/python-waitress.hash new file +5 -0
new file mode 100644
index 0000000000..c1663a351a
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/waitress/json
+md5  b8c671ed131b84a0099493f445c98014  waitress-3.0.0.tar.gz
+sha256  005da479b04134cdd9dd602d1ee7c49d79de0537610d653674cc6cbde222b8a1  waitress-3.0.0.tar.gz
+# Locally computed sha256 checksums
+sha256  3e671db11df687516cc1db5b3d65e4aa383eaca3c20cea3faf53a0f7335d0a3c  LICENSE.txt
package/python-waitress/python-waitress.mk new file +14 -0
new file mode 100644
index 0000000000..c1618817dc
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-waitress
+#
+################################################################################
+
+PYTHON_WAITRESS_VERSION = 3.0.0
+PYTHON_WAITRESS_SOURCE = waitress-$(PYTHON_WAITRESS_VERSION).tar.gz
+PYTHON_WAITRESS_SITE = https://files.pythonhosted.org/packages/70/34/cb77e5249c433eb177a11ab7425056b32d3b57855377fa1e38b397412859
+PYTHON_WAITRESS_SETUP_TYPE = setuptools
+PYTHON_WAITRESS_LICENSE = ZPL-2.1
+PYTHON_WAITRESS_LICENSE_FILES = LICENSE.txt
+
+$(eval $(python-package))
support/testing/tests/package/test_python_waitress.py new file +34 -0
new file mode 100644
index 0000000000..46f04109c0
@@ -0,0 +1,34 @@
+import time
+
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonWaitress(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_FLASK=y
+        BR2_PACKAGE_PYTHON_WAITRESS=y
+        """
+
+    sample_scripts = ["tests/package/sample_python_flask.py"]
+
+    def test_run(self):
+        self.login()
+        self.check_sample_scripts_exist()
+        cmd = self.interpreter + " -m waitress sample_python_flask:app > /dev/null 2>&1 &"
+        # give some time to setup the server
+        _, exit = self.emulator.run(cmd, timeout=self.timeout)
+
+        # Give enough time for the uvicorn server to start up
+        for attempt in range(30):
+            time.sleep(1)
+
+            cmd = "wget -q -O - http://127.0.0.1:8080/"
+            output, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+            if exit_code == 0:
+                self.assertEqual(output[0], 'Hello, World!')
+                break
+        else:
+            self.assertTrue(False, "Timeout while waiting for waitress server")
Signature · 6 lines
2.43.0

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

Hello,

Quoted 4 lines · On Wed, 7 Feb 2024 18:18:27 +0100 Marcus Hoffmann via buildroot…

The test runs the flask sample app through the waitress wsgi server instead of the flask development server.

Quoted 11 lines
---
 package/Config.in                             |  1 +
 package/python-waitress/Config.in             | 11 ++++++
 package/python-waitress/python-waitress.hash  |  5 +++
 package/python-waitress/python-waitress.mk    | 14 ++++++++
 .../tests/package/test_python_waitress.py     | 34 +++++++++++++++++++
 5 files changed, 65 insertions(+)
 create mode 100644 package/python-waitress/Config.in
 create mode 100644 package/python-waitress/python-waitress.hash
 create mode 100644 package/python-waitress/python-waitress.mk
 create mode 100644 support/testing/tests/package/test_python_waitress.py

Sorry for the huge delay, applied! You had forgotten to update the DEVELOPERS file with the new package and test.

Thanks for having added a test together with the package BTW!

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot