/
BUILD.bazel
46 lines (39 loc) · 1.24 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
exports_files([
"requirements.txt",
".bazelversion",
"pycodestyle.cfg",
"CPPLINT.cfg",
])
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
buildifier(
name = "buildifier",
)
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
# Python2 is a dependency of rules_docker due to its dependency on
# containerregistry. To run builds on environments in which 'which python'
# points to python3, you can use the py_runtime target below.
# To use this target, simply add the following flag to your build commands:
# --python_top=//python:py_runtime_2
# Note you need to have a symlink to a valid python2 version in
# '/usr/bin/python2' for this to work.
py_runtime(
name = "py_runtime_2",
interpreter_path = "/usr/bin/python2",
python_version = "PY2",
visibility = ["//visibility:public"],
)
py_runtime(
name = "py_runtime_3",
interpreter_path = "/usr/bin/python3",
python_version = "PY3",
)
py_runtime_pair(
name = "my_py_runtime_pair",
py2_runtime = ":py_runtime_2",
py3_runtime = ":py_runtime_3",
)
toolchain(
name = "system_installed_python_toolchain",
toolchain = ":my_py_runtime_pair",
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
)