Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Provide labels that are compartible with rules_python #89

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pycross/private/package_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"])',
Expand All @@ -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"):
Expand Down Expand Up @@ -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("-", "_")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, not sure how this could be handled. Just wanted to demonstrate that it is possible.

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"]))

Expand Down
Loading