diff options
| author | Mark Brown <broonie@kernel.org> | 2026-07-27 13:39:09 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-27 13:39:09 +0100 |
| commit | c52a755c5f20c1915745342036aacc1cdcdcb8a2 (patch) | |
| tree | ad96e606aa8b9f75474e43504e1e9fccf31661fc /tools/perf/tests/shell/lib/setup_python.sh | |
| parent | 13c5e0be61b75c5a54d8df95def1bfedbcbf2673 (diff) | |
| parent | da85966dfd23a3b03e00ee3bce6ad301f0a2b229 (diff) | |
| download | linux-next-c52a755c5f20c1915745342036aacc1cdcdcb8a2.tar.gz linux-next-c52a755c5f20c1915745342036aacc1cdcdcb8a2.zip | |
Merge branch 'perf-tools-next' of https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git
Diffstat (limited to 'tools/perf/tests/shell/lib/setup_python.sh')
| -rw-r--r-- | tools/perf/tests/shell/lib/setup_python.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/lib/setup_python.sh b/tools/perf/tests/shell/lib/setup_python.sh index a58e5536f2ed..2173215a0517 100644 --- a/tools/perf/tests/shell/lib/setup_python.sh +++ b/tools/perf/tests/shell/lib/setup_python.sh @@ -14,3 +14,16 @@ then echo Skipping test, python not detected please set environment variable PYTHON. exit 2 fi + +# Set PYTHONPATH to find the in-tree built perf.so first, avoiding system-wide perf.so +if [ -n "$PERF_EXEC_PATH" ] && [ -d "$PERF_EXEC_PATH/python" ]; then + PYTHONPATH_DIR="$PERF_EXEC_PATH/python" +elif [ -d "$(dirname "$0")/../../python" ]; then + PYTHONPATH_DIR="$(dirname "$0")/../../python" +elif [ -d "$(dirname "$0")/../python" ]; then + PYTHONPATH_DIR="$(dirname "$0")/../python" +fi + +if [ -n "$PYTHONPATH_DIR" ]; then + export PYTHONPATH="$PYTHONPATH_DIR${PYTHONPATH:+:$PYTHONPATH}" +fi |
