Use pre-packaged Python libraries instead of /usr
Change-Id: If27064f17c243ab1b0c98957a013eb86a37b5cb0
diff --git a/WORKSPACE b/WORKSPACE
index 42bf4e9..e250a5c 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -7,6 +7,13 @@
generate_repositories_for_debs(python_debs)
generate_repositories_for_debs(clang_debs)
+new_http_archive(
+ name = 'python_repo',
+ build_file = 'debian/python.BUILD',
+ sha256 = '21214b6386273698b6aa1b64bccf1bc8c5ef4ef44563871bac5cd85383575af5',
+ url = 'http://frc971.org/Build-Dependencies/python.tar.gz',
+)
+
new_local_repository(
name = 'usr_repo',
path = '/usr',
diff --git a/debian/python.BUILD b/debian/python.BUILD
new file mode 100644
index 0000000..084f198
--- /dev/null
+++ b/debian/python.BUILD
@@ -0,0 +1,66 @@
+package(default_visibility = ['@//debian:__pkg__'])
+
+cc_library(
+ name = 'python3.4_lib',
+ hdrs = glob(['usr/include/python3.4m/**/*.h']),
+ includes = [
+ 'usr/include/python3.4m/',
+ ],
+ visibility = ['//visibility:public'],
+)
+
+cc_library(
+ name = 'python3.4_f2py',
+ srcs = [
+ 'usr/lib/python3/dist-packages/numpy/f2py/src/fortranobject.c',
+ ],
+ hdrs = [
+ 'usr/lib/python3/dist-packages/numpy/f2py/src/fortranobject.h',
+ ],
+ copts = [
+ '-Wno-error',
+ '-Wno-parentheses-equality',
+ ],
+ includes = [
+ 'usr/lib/python3/dist-packages/numpy/f2py/src/',
+ ],
+ deps = [
+ ':python3.4_lib',
+ ],
+ visibility = ['//visibility:public'],
+)
+
+cc_library(
+ name = 'python2.7_lib',
+ hdrs = glob([
+ 'usr/include/**/*.h',
+ ]),
+ srcs = [
+ 'usr/lib/x86_64-linux-gnu/libpython2.7.so',
+ ],
+ includes = [
+ 'usr/include/',
+ 'usr/include/python2.7/',
+ ],
+ visibility = ['//visibility:public'],
+)
+
+cc_library(
+ name = 'python2.7_f2py',
+ srcs = [
+ 'usr/lib/python2.7/dist-packages/numpy/f2py/src/fortranobject.c',
+ ],
+ hdrs = [
+ 'usr/lib/python2.7/dist-packages/numpy/f2py/src/fortranobject.h',
+ ],
+ copts = [
+ '-Wno-error',
+ ],
+ includes = [
+ 'usr/lib/python2.7/dist-packages/numpy/f2py/src/',
+ ],
+ deps = [
+ ':python2.7_lib',
+ ],
+ visibility = ['//visibility:public'],
+)
diff --git a/debian/slycot.BUILD b/debian/slycot.BUILD
index 0122f5d..9853c40 100644
--- a/debian/slycot.BUILD
+++ b/debian/slycot.BUILD
@@ -71,8 +71,8 @@
],
deps = [
':slicot',
- '@usr_repo//:python2.7_lib',
- '@usr_repo//:python2.7_f2py',
+ '@python_repo//:python2.7_lib',
+ '@python_repo//:python2.7_f2py',
],
copts = [
'-Wno-error',
diff --git a/third_party/matplotlib-cpp/BUILD b/third_party/matplotlib-cpp/BUILD
index 8eb8734..3d3959c 100644
--- a/third_party/matplotlib-cpp/BUILD
+++ b/third_party/matplotlib-cpp/BUILD
@@ -6,7 +6,7 @@
"matplotlibcpp.h"
],
deps = [
- "@usr_repo//:python2.7_lib",
+ "@python_repo//:python2.7_lib",
],
visibility = ["//visibility:public"],
restricted_to = ["//tools:k8"],