Use a (mostly) hermetic Python interpreter
It still requires python to be installed on the host to run the wrapper
scripts, but it's close to being fully hermetic.
This also requires/enables the following changes, unfortunately all at
the same time:
* Use a downloaded f2py
* Use a downloaded scipy/numpy/matplotlib
* Fix a few things that don't run with the python version in their #!
* Stop using bazel-generated __init__.py files, because those interfere
with importing matplotlib nicely
Change-Id: Ife280464613d67cece9587b7d947f0b1d5466d7e
diff --git a/motors/BUILD b/motors/BUILD
index 395765e..a1375f4 100644
--- a/motors/BUILD
+++ b/motors/BUILD
@@ -148,3 +148,9 @@
name = "simple_receiver",
restricted_to = mcu_cpus,
)
+
+py_library(
+ name = "python_init",
+ srcs = ["__init__.py"],
+ visibility = ["//visibility:public"],
+)
diff --git a/motors/__init__.py b/motors/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/motors/__init__.py
diff --git a/motors/python/BUILD b/motors/python/BUILD
index 408f3cd..903b397 100644
--- a/motors/python/BUILD
+++ b/motors/python/BUILD
@@ -3,8 +3,10 @@
srcs = [
"big_phase_current.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
@@ -16,10 +18,19 @@
srcs = [
"haptic_phase_current.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
],
)
+
+py_library(
+ name = "python_init",
+ srcs = ["__init__.py"],
+ visibility = ["//visibility:public"],
+ deps = ["//motors:python_init"],
+)
diff --git a/motors/python/__init__.py b/motors/python/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/motors/python/__init__.py
diff --git a/motors/seems_reasonable/BUILD b/motors/seems_reasonable/BUILD
index a1613eb..4b2919e 100644
--- a/motors/seems_reasonable/BUILD
+++ b/motors/seems_reasonable/BUILD
@@ -5,8 +5,10 @@
srcs = [
"drivetrain.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:drivetrain",
@@ -19,8 +21,10 @@
"drivetrain.py",
"polydrivetrain.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:polydrivetrain",
@@ -94,3 +98,10 @@
"//aos/testing:googletest",
],
)
+
+py_library(
+ name = "python_init",
+ srcs = ["__init__.py"],
+ visibility = ["//visibility:public"],
+ deps = ["//motors:python_init"],
+)
diff --git a/motors/seems_reasonable/__init__.py b/motors/seems_reasonable/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/motors/seems_reasonable/__init__.py