fix: Prevent absolute path creation in uv lock template (#2769)

This change fixes a bug in the `lock` rule where, when the package is at
the root level, the path to `requirements.txt` is constructed
incorrectly with a leading double slash (`//requirements.txt`), causing
it to be interpreted as an absolute path.

This change detects if the package is empty before constructing the
output path.

Work towards #1975

---------

Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
diff --git a/python/uv/private/lock.bzl b/python/uv/private/lock.bzl
index 45a3819..2731d6b 100644
--- a/python/uv/private/lock.bzl
+++ b/python/uv/private/lock.bzl
@@ -327,10 +327,15 @@
 def _expand_template_impl(ctx):
     pkg = ctx.label.package
     update_src = ctx.actions.declare_file(ctx.attr.update_target + ".py")
+
+    # Fix the path construction to avoid absolute paths
+    # If package is empty (root), don't add a leading slash
+    dst = "{}/{}".format(pkg, ctx.attr.output) if pkg else ctx.attr.output
+
     ctx.actions.expand_template(
         template = ctx.files._template[0],
         substitutions = {
-            "{{dst}}": "{}/{}".format(pkg, ctx.attr.output),
+            "{{dst}}": dst,
             "{{src}}": "{}".format(ctx.files.src[0].short_path),
             "{{update_target}}": "//{}:{}".format(pkg, ctx.attr.update_target),
         },