From f141e67ffd4dcf50a8a42ecf8af6bc59c6bde947 Mon Sep 17 00:00:00 2001 From: Elvis Wianda Date: Tue, 16 Apr 2024 16:57:34 -0400 Subject: [PATCH] fix: Provide labels that are compartible with rules_python --- pycross/private/package_repo.bzl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pycross/private/package_repo.bzl b/pycross/private/package_repo.bzl index 37ffab2c..acc6c367 100644 --- a/pycross/private/package_repo.bzl +++ b/pycross/private/package_repo.bzl @@ -48,7 +48,7 @@ load("//_lock:lock.bzl", "targets") targets() """ -def _pin_build(package): +def _pin_build(pin, package): package_key = package["key"] lines = [ 'package(default_visibility = ["//visibility:public"])', @@ -58,6 +58,11 @@ def _pin_build(package): ' actual = "//_lock:_wheel_{}",'.format(package_key), ")", "", + "alias(", + ' name = "{}",'.format(pin), + ' actual = "//_lock:{}",'.format(package_key), + ")", + "", ] if package.get("sdist_file", {}).get("key"): @@ -201,8 +206,9 @@ def _package_repo_impl(rctx): _generate_lock_bzl(rctx, lock_json_path, lock_bzl_path) for pin, pin_target in lock["pins"].items(): + pin = pin.replace("-", "_") package = lock["packages"][pin_target] - rctx.file(paths.join(pin, "BUILD.bazel"), _pin_build(package)) + rctx.file(paths.join(pin, "BUILD.bazel"), _pin_build(pin, package)) rctx.file("BUILD.bazel", _root_build(lock["pins"]))