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/y2018/control_loops/python/BUILD b/y2018/control_loops/python/BUILD
index 89f8882..eebbfe2 100644
--- a/y2018/control_loops/python/BUILD
+++ b/y2018/control_loops/python/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",
@@ -47,9 +51,11 @@
srcs = [
"polydrivetrain_test.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
":polydrivetrain_lib",
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
@@ -63,8 +69,10 @@
"arm_trajectory.py",
"path_points.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
@@ -76,11 +84,14 @@
srcs = [
"intake.py",
],
+ legacy_create_init = False,
restricted_to = ["//tools:k8"],
deps = [
+ ":python_init",
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
+ "@matplotlib",
],
)
@@ -104,9 +115,12 @@
"graph_edit.py",
"graph_generate.py",
],
- # Sigh, these aren't respected.
default_python_version = "PY3",
+ legacy_create_init = False,
srcs_version = "PY3",
+ deps = [
+ ":python_init",
+ ],
)
py_binary(
@@ -115,7 +129,17 @@
"graph_codegen.py",
"graph_generate.py",
],
- # Sigh, these aren't respected.
default_python_version = "PY2",
+ legacy_create_init = False,
srcs_version = "PY2",
+ deps = [
+ ":python_init",
+ ],
+)
+
+py_library(
+ name = "python_init",
+ srcs = ["__init__.py"],
+ visibility = ["//visibility:public"],
+ deps = ["//y2018/control_loops:python_init"],
)