Prevent Python from importing the host's pip packages
This patch prevents Python from searching the user's installed pip
packages as well as the host's `site` package. The host's `site`
package normally performs the setup necessary to allow importing
globally installed pip packages. We don't want that.
From the upstream documentation:
https://docs.python.org/3/using/cmdline.html
-s
Don’t add the user site-packages directory to sys.path.
See also PEP 370 – Per user site-packages directory
-S
Disable the import of the module site and the
site-dependent manipulations of sys.path that it
entails. Also disable these manipulations if site is
explicitly imported later (call site.main() if you
want them to be triggered).
Change-Id: I11a64c33920fc174dd8ac5d200e2e8550a3c084a
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/tools/python/runtime_binary.sh b/tools/python/runtime_binary.sh
index 8380424..9cd1519 100755
--- a/tools/python/runtime_binary.sh
+++ b/tools/python/runtime_binary.sh
@@ -36,4 +36,5 @@
export LD_LIBRARY_PATH="${BASE_PATH}/usr/lib/lapack:${BASE_PATH}/usr/lib/libblas:${BASE_PATH}/usr/lib/x86_64-linux-gnu"
-exec "$BASE_PATH"/usr/bin/python3 "$@"
+# Prevent Python from importing the host's installed packages.
+exec "$BASE_PATH"/usr/bin/python3 -sS "$@"