-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
BUILD
76 lines (68 loc) · 1.94 KB
/
BUILD
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
load(":python_version.bzl", "define_python_version_flag")
package(default_visibility = ["//visibility:public"])
sh_binary(
name = "2to3",
srcs = ["2to3.sh"],
)
filegroup(
name = "srcs",
srcs = glob(["**"]) + [
"//tools/python/runfiles:srcs",
],
)
filegroup(
name = "embedded_tools",
srcs = glob(["**"]) + [
"//tools/python/runfiles:embedded_tools",
],
visibility = ["//tools:__pkg__"],
)
test_suite(
name = "all_windows_tests",
tests = [
"//tools/python/runfiles:all_windows_tests",
],
visibility = ["//tools:__pkg__"],
)
# This target can be used to inspect the current Python major version. To use,
# put it in the `flag_values` attribute of a `config_setting` and test it
# against the values "PY2" or "PY3". It will always match one or the other.
#
# If you do not need to test any other flags in combination with the Python
# version, then as a convenience you may use the predefined `config_setting`s
# `@bazel_tools//tools/python:PY2` and `@bazel_tools//tools/python:PY3`.
#
# Example usage:
#
# config_setting(
# name = "py3_on_arm",
# values = {"cpu": "arm"},
# flag_values = {"@bazel_tools//tools/python:python_version": "PY3"},
# )
#
# my_target(
# ...
# some_attr = select({
# ":py3_on_arm": ...,
# ...
# }),
# ...
# )
#
# Caution: Do not `select()` on the built-in command-line flags `--force_python`
# or `--python_version`, as they do not always reflect the true Python version
# of the current target. `select()`-ing on them can lead to action conflicts and
# will be disallowed.
define_python_version_flag(
name = "python_version",
)
config_setting(
name = "PY2",
flag_values = {":python_version": "PY2"},
visibility = ["//visibility:public"],
)
config_setting(
name = "PY3",
flag_values = {":python_version": "PY3"},
visibility = ["//visibility:public"],
)