aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/shell/lib/setup_python.sh
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2023-11-29 21:34:27 +0000
committerArnaldo Carvalho de Melo <[email protected]>2023-12-05 18:48:52 +0000
commit8226e4a3b35f525d11934484ee5979399ff8b7dc (patch)
tree28b20ba8efcc3ad96e59d142c257415af955fdf5 /tools/perf/tests/shell/lib/setup_python.sh
parentperf build: Shellcheck support for OUTPUT directory (diff)
downloadkernel-8226e4a3b35f525d11934484ee5979399ff8b7dc.tar.gz
kernel-8226e4a3b35f525d11934484ee5979399ff8b7dc.zip
perf test: Use common python setup library
Avoid replicated logic by having a common library to set the PYTHON environment variable. Reviewed-by: Athira Jajeev <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/tests/shell/lib/setup_python.sh')
-rw-r--r--tools/perf/tests/shell/lib/setup_python.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/lib/setup_python.sh b/tools/perf/tests/shell/lib/setup_python.sh
new file mode 100644
index 000000000000..c2fce1793538
--- /dev/null
+++ b/tools/perf/tests/shell/lib/setup_python.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+if [ "x$PYTHON" = "x" ]
+then
+ python3 --version >/dev/null 2>&1 && PYTHON=python3
+fi
+if [ "x$PYTHON" = "x" ]
+then
+ python --version >/dev/null 2>&1 && PYTHON=python
+fi
+if [ "x$PYTHON" = "x" ]
+then
+ echo Skipping test, python not detected please set environment variable PYTHON.
+ exit 2
+fi