@@ -22,7 +22,7 @@ make it possible to have multiple tools inside the `pypi` directory
2222load ("//python:py_binary.bzl" , _py_binary  =  "py_binary" )
2323load ("//python:py_test.bzl" , _py_test  =  "py_test" )
2424
25- _DEFAULT_TAGS  =  ["no-sandbox" , "no-remote-exec" , "requires-network" ]
25+ _TAGS_FOR_REMOTE_EXECUTION  =  ["no-sandbox" , "no-remote-exec" , "requires-network" ]
2626
2727def  pip_compile (
2828        name ,
@@ -39,7 +39,8 @@ def pip_compile(
3939        requirements_linux  =  None ,
4040        requirements_windows  =  None ,
4141        visibility  =  ["//visibility:private" ],
42-         tags  =  _DEFAULT_TAGS ,
42+         tags  =  None ,
43+         remoteable  =  True ,
4344        ** kwargs ):
4445    """Generates targets for managing pip dependencies with pip-compile. 
4546
@@ -70,6 +71,7 @@ def pip_compile(
7071        extra_args: passed to pip-compile. 
7172        extra_deps: extra dependencies passed to pip-compile. 
7273        generate_hashes: whether to put hashes in the requirements_txt file. 
74+         remoteable: whether of not to add tags that support remote execution. 
7375        py_binary: the py_binary rule to be used. 
7476        py_test: the py_test rule to be used. 
7577        requirements_in: file expressing desired dependencies. Deprecated, use src or srcs instead. 
@@ -78,7 +80,6 @@ def pip_compile(
7880        requirements_darwin: File of darwin specific resolve output to check validate if requirement.in has changes. 
7981        requirements_windows: File of windows specific resolve output to check validate if requirement.in has changes. 
8082        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"] 
8283        visibility: passed to both the _test and .update rules. 
8384        **kwargs: other bazel attributes passed to the "_test" rule. 
8485    """ 
@@ -144,14 +145,19 @@ def pip_compile(
144145        Label ("//python/runfiles:runfiles" ),
145146    ] +  extra_deps 
146147
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+ 
148154    attrs  =  {
149155        "args" : args ,
150156        "data" : data ,
151157        "deps" : deps ,
152158        "main" : pip_compile ,
153159        "srcs" : [pip_compile ],
154-         "tags" : tags ,
160+         "tags" : tags_to_use ,
155161        "visibility" : visibility ,
156162    }
157163
0 commit comments