17
17
18
18
load ("@bazel_skylib//rules:diff_test.bzl" , "diff_test" )
19
19
load ("@bazel_skylib//rules:expand_template.bzl" , "expand_template" )
20
- load ("//python:py_binary .bzl" , "py_binary " )
20
+ load ("//python:py_test .bzl" , "py_test " )
21
21
22
22
visibility (["//..." ])
23
23
@@ -78,6 +78,7 @@ def _lock_impl(ctx):
78
78
lock_args .add ("--custom-compile-command" , update_command )
79
79
run_args .extend (("--custom-compile-command" , "'{}'" .format (update_command )))
80
80
81
+ lock_args .add ("--no-progress" )
81
82
lock_args .add ("--python" , py_runtime .interpreter )
82
83
lock_args .add_all (args )
83
84
lock_args .add_all (srcs )
@@ -225,7 +226,7 @@ def lock(*, name, srcs, out, args = [], **kwargs):
225
226
srcs: The srcs to use as inputs.
226
227
out: The output file.
227
228
args: Extra args to pass to `uv`.
228
- **kwargs: Extra kwargs passed to the {obj}`py_binary ` rule.
229
+ **kwargs: Extra kwargs passed to the {obj}`py_test ` rule.
229
230
"""
230
231
pkg = native .package_name ()
231
232
update_target = "{}.update" .format (name )
@@ -249,14 +250,6 @@ def lock(*, name, srcs, out, args = [], **kwargs):
249
250
args = args ,
250
251
)
251
252
252
- if maybe_out :
253
- diff_test (
254
- name = name + "_test" ,
255
- file1 = out + ".new" ,
256
- file2 = maybe_out ,
257
- tags = ["manual" ],
258
- )
259
-
260
253
_lock_run (
261
254
name = locker_target ,
262
255
lock = name ,
@@ -271,16 +264,21 @@ def lock(*, name, srcs, out, args = [], **kwargs):
271
264
template = "//python/uv/private:copy.py" ,
272
265
substitutions = {
273
266
'dst = ""' : 'dst = "{}/{}"' .format (pkg , out ),
267
+ 'src = ""' : 'src = "{}/{}.new"' .format (pkg , out ),
274
268
},
275
269
)
276
270
277
- py_binary (
271
+ py_test (
278
272
name = update_target ,
279
273
srcs = [update_target + ".py" ],
280
- data = [name ],
281
- env = {
282
- "REQUIREMENTS_FILE" : "$(rootpath {})" .format (name ),
283
- },
284
- tags = ["manual" ],
274
+ data = [name ] + ([] if not maybe_out else [maybe_out ]),
285
275
** kwargs
286
276
)
277
+
278
+ if maybe_out :
279
+ diff_test (
280
+ name = name + "_test" ,
281
+ file1 = out + ".new" ,
282
+ file2 = maybe_out ,
283
+ tags = ["manual" ],
284
+ )
0 commit comments