From 348aa2c964494b5947c0e7f96b82c1fe844d684f Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 6 Nov 2020 12:10:04 +0300 Subject: [PATCH] bazel support for tools (#982) * packages versions updated to be in sync with modern python versions --- WORKSPACE | 13 +++++++++++++ requirements.txt | 2 ++ tools/BUILD.bazel | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 requirements.txt create mode 100644 tools/BUILD.bazel diff --git a/WORKSPACE b/WORKSPACE index c00d12cd..fdc8c7f8 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -34,3 +34,16 @@ new_local_repository( build_file = "@//bindings/python:python_headers.BUILD", path = "/usr/include/python3.6", # May be overwritten by setup.py. ) + +http_archive( + name = "rules_python", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz", + sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0", +) + +load("@rules_python//python:pip.bzl", pip3_install="pip_install") + +pip3_install( + name = "py_deps", + requirements = "//:requirements.txt", +) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..85e89860 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +numpy == 1.19.4 +scipy == 1.5.4 diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel new file mode 100644 index 00000000..5895883a --- /dev/null +++ b/tools/BUILD.bazel @@ -0,0 +1,19 @@ +load("@py_deps//:requirements.bzl", "requirement") + +py_library( + name = "gbench", + srcs = glob(["gbench/*.py"]), + deps = [ + requirement("numpy"), + requirement("scipy"), + ], +) + +py_binary( + name = "compare", + srcs = ["compare.py"], + python_version = "PY2", + deps = [ + ":gbench", + ], +)