[4/7] python3-py-cpuinfo: move from meta-python

Message ID 20220517081633.2992360-4-mingli.yu@windriver.com
State New
Headers show
Series [v2,1/7] python3-cryptography: add python3-pytest-benchmark rdepends | expand

Commit Message

Yu, Mingli May 17, 2022, 8:16 a.m. UTC
From: Mingli Yu <mingli.yu@windriver.com>

Py-cpuinfo gets CPU info with pure Python. Py-cpuinfo should
work without any extra programs or libraries, beyond what your
OS provides. It does not require any compilation(C/C++, assembly,
et cetera) to use. It works with Python 2 and 3.

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 .../python/python3-py-cpuinfo/run-ptest       |  3 +++
 .../python/python3-py-cpuinfo_8.0.0.bb        | 27 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-py-cpuinfo/run-ptest
 create mode 100644 meta/recipes-devtools/python/python3-py-cpuinfo_8.0.0.bb

Patch

diff --git a/meta/recipes-devtools/python/python3-py-cpuinfo/run-ptest b/meta/recipes-devtools/python/python3-py-cpuinfo/run-ptest
new file mode 100644
index 0000000000..b63c4de0d9
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-py-cpuinfo/run-ptest
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+pytest -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/SKIPPED/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/recipes-devtools/python/python3-py-cpuinfo_8.0.0.bb b/meta/recipes-devtools/python/python3-py-cpuinfo_8.0.0.bb
new file mode 100644
index 0000000000..6de2f17459
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-py-cpuinfo_8.0.0.bb
@@ -0,0 +1,27 @@ 
+# Copyright (C) 2021 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "Get CPU info with pure Python 2 & 3"
+HOMEPAGE = "https://github.com/workhorsy/py-cpuinfo"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b0b97c022f12b14d9e02de0b283ee9e9"
+
+SRC_URI[sha256sum] = "5f269be0e08e33fd959de96b34cd4aeeeacac014dd8305f70eb28d06de2345c5"
+
+inherit ptest pypi setuptools3
+
+SRC_URI += "file://run-ptest \
+           "
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+}
+
+RDEPENDS:${PN}-ptest += "\
+    python3-pytest \
+"
+
+RDEPENDS:${PN} += "python3-core python3-ctypes python3-datetime python3-json python3-io python3-mmap python3-multiprocessing python3-netclient python3-pickle python3-pprint python3-shell"
+
+BBCLASSEXTEND = "native nativesdk"