xref: /aosp_15_r20/external/tink/python/examples/mac/BUILD.bazel (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1load("@rules_python//python:defs.bzl", "py_binary")
2load("@pip_deps//:requirements.bzl", "requirement")
3
4package(default_visibility = ["//visibility:private"])
5
6licenses(["notice"])
7
8exports_files(["mac_test_keyset.json"])
9
10py_binary(
11    name = "mac",
12    srcs = ["mac.py"],
13    python_version = "PY3",
14    deps = [
15        requirement("absl-py"),
16        "@tink_py//tink:cleartext_keyset_handle",
17        "@tink_py//tink:tink_python",
18        "@tink_py//tink/mac",
19    ],
20)
21
22sh_test(
23    name = "mac_test",
24    size = "small",
25    srcs = ["mac_test.sh"],
26    args = [
27        "$(rootpath :mac)",
28        "$(rootpath :mac_test_keyset.json)",
29    ],
30    data = [
31        ":mac",
32        ":mac_test_keyset.json",
33    ],
34)
35
36# This runs the previous test assuming the Tink python package has been
37# installed previously with pip3 install.
38sh_test(
39    name = "mac_test_package",
40    size = "small",
41    srcs = ["mac_test.sh"],
42    args = [
43        "'python3 $(rootpath :mac.py)'",
44        "$(rootpath :mac_test_keyset.json)",
45    ],
46    data = [
47        ":mac.py",
48        ":mac_test_keyset.json",
49    ],
50)
51
52py_library(
53    name = "mac_basic",
54    srcs = ["mac_basic.py"],
55    deps = [
56        "@tink_py//tink:cleartext_keyset_handle",
57        "@tink_py//tink:tink_python",
58        "@tink_py//tink/mac",
59    ],
60)
61
62py_test(
63    name = "mac_basic_test",
64    srcs = ["mac_basic_test.py"],
65    python_version = "PY3",
66    deps = [
67        requirement("absl-py"),
68        ":mac_basic",
69    ],
70)
71