From 8467586fc5546debe7b672fcebbf2b13aa6fa06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 28 Dec 2017 18:46:36 +0000 Subject: Experiment: add some basic bazel support. This only defines targets needed to run test_common through bazel. Adding extra support for pyserial and other dependencies will take some time but would help with building a fully-hermetic test set. --- .gitignore | 5 +++++ WORKSPACE | 20 ++++++++++++++++++++ glucometerutils/BUILD | 23 +++++++++++++++++++++++ test/BUILD | 12 ++++++++++++ third_party/six.BUILD | 14 ++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 WORKSPACE create mode 100644 glucometerutils/BUILD create mode 100644 test/BUILD create mode 100644 third_party/six.BUILD diff --git a/.gitignore b/.gitignore index 894b10a..37e0dea 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ /MANIFEST /dist/ __pycache__/ +/bazel-bin +/bazel-genfiles +/bazel-glucometerutils +/bazel-out +/bazel-testlogs diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..5bd7c82 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,20 @@ +# -*- python -*- + +http_archive( + name = "abseil_py_archive", + strip_prefix = "abseil-py-9dd9c42657fee7f4022d625e39ca0f1f25ce265e", + urls = ["https://github.com/abseil/abseil-py/archive/9dd9c42657fee7f4022d625e39ca0f1f25ce265e.zip"] +) + +# From abseil-py (neeeded as transitive dependency). +# Copyright 2017 The Abseil Authors. +new_http_archive( + name = "six_archive", + urls = [ + "http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", + "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", + ], + sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", + strip_prefix = "six-1.10.0", + build_file = "third_party/six.BUILD", +) diff --git a/glucometerutils/BUILD b/glucometerutils/BUILD new file mode 100644 index 0000000..6b3c267 --- /dev/null +++ b/glucometerutils/BUILD @@ -0,0 +1,23 @@ +# -*- python -*- + +package( + default_visibility = [ + "//glucometerutils:__subpackages__", + "//test:__pkg__", + ] +) + +py_library( + name = "exceptions", + srcs = ["exceptions.py"], + srcs_version = "PY3", +) + +py_library( + name = "common", + srcs = ["common.py"], + srcs_version = "PY3", + deps = [ + ":exceptions", + ] +) diff --git a/test/BUILD b/test/BUILD new file mode 100644 index 0000000..e760b32 --- /dev/null +++ b/test/BUILD @@ -0,0 +1,12 @@ +# -*- python -*- + +py_test( + name = "test_common", + srcs = ["test_common.py"], + srcs_version = "PY3", + deps = [ + "//glucometerutils:common", + "@abseil_py_archive//absl/testing:parameterized", + ], + default_python_version = "PY3", +) diff --git a/third_party/six.BUILD b/third_party/six.BUILD new file mode 100644 index 0000000..a1b2f7b --- /dev/null +++ b/third_party/six.BUILD @@ -0,0 +1,14 @@ +# Description: +# Six provides simple utilities for wrapping over differences between Python 2 +# and Python 3. + +licenses(["notice"]) # MIT + +exports_files(["LICENSE"]) + +py_library( + name = "six", + srcs = ["six.py"], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], +) -- cgit v1.2.3