@@ -22,7 +22,7 @@ make it possible to have multiple tools inside the `pypi` directory
22
22
load ("//python:py_binary.bzl" , _py_binary = "py_binary" )
23
23
load ("//python:py_test.bzl" , _py_test = "py_test" )
24
24
25
- _DEFAULT_TAGS = ["no-sandbox" , "no-remote-exec" , "requires-network" ]
25
+ _TAGS_FOR_REMOTE_EXECUTION = ["no-sandbox" , "no-remote-exec" , "requires-network" ]
26
26
27
27
def pip_compile (
28
28
name ,
@@ -39,7 +39,8 @@ def pip_compile(
39
39
requirements_linux = None ,
40
40
requirements_windows = None ,
41
41
visibility = ["//visibility:private" ],
42
- tags = _DEFAULT_TAGS ,
42
+ tags = None ,
43
+ remoteable = True ,
43
44
** kwargs ):
44
45
"""Generates targets for managing pip dependencies with pip-compile.
45
46
@@ -70,6 +71,7 @@ def pip_compile(
70
71
extra_args: passed to pip-compile.
71
72
extra_deps: extra dependencies passed to pip-compile.
72
73
generate_hashes: whether to put hashes in the requirements_txt file.
74
+ remoteable: whether of not to add tags that support remote execution.
73
75
py_binary: the py_binary rule to be used.
74
76
py_test: the py_test rule to be used.
75
77
requirements_in: file expressing desired dependencies. Deprecated, use src or srcs instead.
@@ -78,7 +80,6 @@ def pip_compile(
78
80
requirements_darwin: File of darwin specific resolve output to check validate if requirement.in has changes.
79
81
requirements_windows: File of windows specific resolve output to check validate if requirement.in has changes.
80
82
tags: tagging attribute common to all build rules, passed to both the _test and .update rules.
81
- default: ["no-sandbox", "no-remote-exec", "requires-network"]
82
83
visibility: passed to both the _test and .update rules.
83
84
**kwargs: other bazel attributes passed to the "_test" rule.
84
85
"""
@@ -144,14 +145,19 @@ def pip_compile(
144
145
Label ("//python/runfiles:runfiles" ),
145
146
] + extra_deps
146
147
147
- tags = tags or []
148
+ tags_to_use = []
149
+ if tags :
150
+ tags_to_use += tags
151
+ if remoteable :
152
+ tags_to_use += _TAGS_FOR_REMOTE_EXECUTION
153
+
148
154
attrs = {
149
155
"args" : args ,
150
156
"data" : data ,
151
157
"deps" : deps ,
152
158
"main" : pip_compile ,
153
159
"srcs" : [pip_compile ],
154
- "tags" : tags ,
160
+ "tags" : tags_to_use ,
155
161
"visibility" : visibility ,
156
162
}
157
163
0 commit comments