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/frc971/control_loops/python/BUILD b/frc971/control_loops/python/BUILD
index a4b8fb8..8679374 100644
--- a/frc971/control_loops/python/BUILD
+++ b/frc971/control_loops/python/BUILD
@@ -26,12 +26,12 @@
],
data = [
"//third_party/cddlib:_cddlib.so",
- "@python_repo//:scipy",
],
target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":python_init",
"//external:python-glog",
+ "@python_repo//:scipy",
],
)
@@ -98,6 +98,7 @@
deps = [
":libspline",
":python_init",
+ "@python_repo//:numpy",
],
)