mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
cpu-gather: Create python wrapper for shell script
This changes the invocation from ./cpu-gather.sh | ./cpu-parse.sh to ./cpu-gather.py | ./cpu-parse.sh Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9d25f2fe16
commit
34c9db5a4a
13
tests/cputestdata/cpu-gather.py
Executable file
13
tests/cputestdata/cpu-gather.py
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
os.environ["CPU_GATHER_PY"] = "true"
|
||||||
|
subprocess.check_call("./cpu-gather.sh")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -4,6 +4,11 @@
|
|||||||
# distro does not provide such package, you can find the sources or binary
|
# distro does not provide such package, you can find the sources or binary
|
||||||
# packages at https://www.etallen.com/cpuid.html
|
# packages at https://www.etallen.com/cpuid.html
|
||||||
|
|
||||||
|
if [ -z "${CPU_GATHER_PY}" ]; then
|
||||||
|
echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
grep 'model name' /proc/cpuinfo | head -n1
|
grep 'model name' /proc/cpuinfo | head -n1
|
||||||
|
|
||||||
cpuid -1r
|
cpuid -1r
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./cpu-gather.sh | ./cpu-parse.sh
|
# ./cpu-gather.py | ./cpu-parse.sh
|
||||||
|
|
||||||
data=`cat`
|
data=`cat`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user