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/debian/BUILD b/debian/BUILD
index 957df39..aa1b85f 100644
--- a/debian/BUILD
+++ b/debian/BUILD
@@ -24,8 +24,24 @@
":mingw_compiler.bzl",
mingw_compiler_debs = "files",
)
+load(
+ ":patchelf.bzl",
+ patchelf_debs = "files",
+)
+load(
+ ":matplotlib.bzl",
+ matplotlib_debs = "files",
+)
load("//debian:packages.bzl", "download_packages", "generate_deb_tarball")
+filegroup(
+ name = "matplotlib_patches",
+ srcs = [
+ "matplotlib_init.patch",
+ ],
+ visibility = ["@matplotlib//:__pkg__"],
+)
+
py_binary(
name = "download_packages",
srcs = [
@@ -45,8 +61,10 @@
packages = [
"python-dev",
"python-numpy",
+ "python-scipy",
"python3-dev",
"python3-numpy",
+ "python3-scipy",
],
)
@@ -98,6 +116,33 @@
],
)
+download_packages(
+ name = "download_patchelf_deps",
+ packages = [
+ "patchelf",
+ ],
+)
+
+download_packages(
+ name = "download_matplotlib_deps",
+ excludes = [
+ "python-dev",
+ "python-numpy",
+ "python-scipy",
+ "python3-dev",
+ "python3-numpy",
+ "python3-scipy",
+ "x11-common",
+ "fonts-freefont",
+ "python",
+ "libcups2",
+ ],
+ packages = [
+ "python-matplotlib",
+ "python3-matplotlib",
+ ],
+)
+
generate_deb_tarball(
name = "python",
files = python_debs,
@@ -127,3 +172,13 @@
name = "mingw_compiler",
files = mingw_compiler_debs,
)
+
+generate_deb_tarball(
+ name = "patchelf",
+ files = patchelf_debs,
+)
+
+generate_deb_tarball(
+ name = "matplotlib",
+ files = matplotlib_debs,
+)