Skip to content

Commit b51cbb7

Browse files
committed
Fix case where lock is at the root of a workspace
1 parent 9fb13ec commit b51cbb7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

examples/bzlmod/.python_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9
1+
3.12

python/uv/private/lock.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,15 @@ def _maybe_file(path):
327327
def _expand_template_impl(ctx):
328328
pkg = ctx.label.package
329329
update_src = ctx.actions.declare_file(ctx.attr.update_target + ".py")
330+
331+
# Fix the path construction to avoid absolute paths
332+
# If package is empty (root), don't add a leading slash
333+
dst = ctx.attr.output if pkg == "" else "{}/{}".format(pkg, ctx.attr.output)
334+
330335
ctx.actions.expand_template(
331336
template = ctx.files._template[0],
332337
substitutions = {
333-
"{{dst}}": "{}/{}".format(pkg, ctx.attr.output),
338+
"{{dst}}": dst,
334339
"{{src}}": "{}".format(ctx.files.src[0].short_path),
335340
"{{update_target}}": "//{}:{}".format(pkg, ctx.attr.update_target),
336341
},

0 commit comments

Comments
 (0)