diff mbox series

[kirkstone,meta-python] python3-setproctitle: Add new recipe

Message ID 20240929072744.1929825-1-mingli.yu@windriver.com
State New
Headers show
Series [kirkstone,meta-python] python3-setproctitle: Add new recipe | expand

Commit Message

Yu, Mingli Sept. 29, 2024, 7:27 a.m. UTC
From: Mingli Yu <mingli.yu@windriver.com>

A Python module to customize the process title.
 # ./run-ptest
PASS: tests/module_test.py::test_no_import_side_effect
PASS: tests/module_test.py::test_version
PASS: tests/module_test.py::test_c_extension_built
PASS: tests/setproctitle_test.py::test_runner
PASS: tests/setproctitle_test.py::test_init_getproctitle
PASS: tests/setproctitle_test.py::test_setproctitle
tests/setproctitle_test.py::test_setproctitle_darwin SKIPPED (Mac on...)
PASS: tests/setproctitle_test.py::test_prctl
PASS: tests/setproctitle_test.py::test_getproctitle
PASS: tests/setproctitle_test.py::test_kwarg
PASS: tests/setproctitle_test.py::test_environ
PASS: tests/setproctitle_test.py::test_issue_8
PASS: tests/setproctitle_test.py::test_large_cmdline
PASS: tests/setproctitle_test.py::test_weird_args
PASS: tests/setproctitle_test.py::test_weird_path
PASS: tests/setproctitle_test.py::test_embedded
PASS: tests/setproctitle_test.py::test_embedded_many_args
PASS: tests/setproctitle_test.py::test_noenv
PASS: tests/setproctitle_test.py::test_large_env
PASS: tests/setproctitle_test.py::test_clear_segfault
PASS: tests/setproctitle_test.py::test_fork_segfault
PASS: tests/setproctitle_test.py::test_thread_fork_segfault
PASS: tests/setthreadtitle_test.py::test_thread_title_unchanged
PASS: tests/setthreadtitle_test.py::test_set_thread_title
PASS: tests/setthreadtitle_test.py::test_set_threads_title

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 ...0001-conftest.py-Make-embed-avaiable.patch | 45 +++++++++++++++++++
 .../python/python3-setproctitle/run-ptest     |  4 ++
 .../python/python3-setproctitle_1.3.3.bb      | 34 ++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-setproctitle/0001-conftest.py-Make-embed-avaiable.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-setproctitle/run-ptest
 create mode 100644 meta-python/recipes-devtools/python/python3-setproctitle_1.3.3.bb
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-setproctitle/0001-conftest.py-Make-embed-avaiable.patch b/meta-python/recipes-devtools/python/python3-setproctitle/0001-conftest.py-Make-embed-avaiable.patch
new file mode 100644
index 000000000..5de07de03
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-setproctitle/0001-conftest.py-Make-embed-avaiable.patch
@@ -0,0 +1,45 @@ 
+From ce7430f6252ce69af0699dc376662b5b1dc00b96 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+Date: Fri, 27 Sep 2024 10:56:32 +0000
+Subject: [PATCH] conftest.py: Make --embed avaiable
+
+Though --embed exists in the help message as below.
+ $ /usr/bin/python3.10-config --help
+ Usage: /usr/bin/python3.10-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed
+
+ # https://github.com/dvarrazzo/py-setproctitle/issues/142
+ But has_embed which indicates if the help includes "--embed"
+ provides a wrong check as beow.
+ >>> import subprocess
+ >>> subprocess.check_output(["/usr/bin/python3.10-config", "--help"])
+Usage: /usr/bin/python3.10-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed]
+ b''
+ >>> help = subprocess.check_output(["/usr/bin/python3.10-config", "--help"])
+ >>> has_embed = b"--embed" in help
+
+So make sure --embed avaiable to fix the gap.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
+---
+ tests/conftest.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 6e15988..b01e2bd 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -84,8 +84,7 @@ def pyconfig():
+ 
+     def pyconfig_func(opt):
+         cmdline = [pyconfexe, f"--{opt}"]
+-        if has_embed:
+-            cmdline.append("--embed")
++        cmdline.append("--embed")
+         bout = sp.check_output(cmdline)
+         out = bout.decode(
+             sys.getfilesystemencoding()  # sounds like a good bet
+-- 
+2.35.5
+
diff --git a/meta-python/recipes-devtools/python/python3-setproctitle/run-ptest b/meta-python/recipes-devtools/python/python3-setproctitle/run-ptest
new file mode 100644
index 000000000..8bedb66d4
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-setproctitle/run-ptest
@@ -0,0 +1,4 @@ 
+#!/bin/sh
+
+# https://github.com/dvarrazzo/py-setproctitle/issues/141
+pytest -k 'not test_unicode' -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'
diff --git a/meta-python/recipes-devtools/python/python3-setproctitle_1.3.3.bb b/meta-python/recipes-devtools/python/python3-setproctitle_1.3.3.bb
new file mode 100644
index 000000000..01e9d21cd
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-setproctitle_1.3.3.bb
@@ -0,0 +1,34 @@ 
+SUMMARY = "A Python module to customize the process title"
+DESCRIPTION = "The setproctitle module allows a process to change its \
+title (as displayed by system tools such as ps, top or MacOS Activity \
+Monitor)."
+HOMEPAGE = "https://github.com/dvarrazzo/py-setproctitle"
+BUGTRACKER = "https://github.com/dvarrazzo/py-setproctitle/issues"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=86d2d41b5f4f023f43466f8cb7adebaa"
+
+inherit pypi setuptools3 ptest
+
+SRC_URI[sha256sum] = "c913e151e7ea01567837ff037a23ca8740192880198b7fbb90b16d181607caae"
+
+SRC_URI += " \
+    file://0001-conftest.py-Make-embed-avaiable.patch \
+    file://run-ptest \
+"
+
+RDEPENDS:${PN}-ptest += "\
+    packagegroup-core-buildessential \
+    procps-ps \
+    python3-dev \
+    python3-multiprocessing \
+    ${PYTHON_PN}-pytest \
+"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+}
+
+BBCLASSEXTEND = "native nativesdk"
+
+INSANE_SKIP:${PN}-ptest = "dev-deps"