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

refactor: use bazel-skylib for creating hub repo aliases #1855

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Apr 17, 2024

With this PR the code becomes more maintainable and easier to inspect.
Since bazel-skylib is already a dependency of rules_python, this is
a backwards compatible change.

Skipping the CHANGELOG notes because it should not be an externally
visible change.

Work towards #735.

With this PR the code becomes more maintainable and easier to inspect.
Since bazel-skylib is already a dependency of rules_python, this is
a backwards compatible change.

Skipping the CHANGELOG notes because it should not be an externally
visible change.
Copy link
Contributor

@philsc philsc left a comment

Choose a reason for hiding this comment

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

Looks great!

return render.alias(
name = name,
actual = render.select(
selects,
{tuple(sorted(v, key = lambda x: ("is_python" not in x, x))): k for k, v in sorted(selects.items())},
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a comment here would be super helpful. It takes a bit of time to understand what this line done.

no_match_error = no_match_error,
key_repr = lambda x: repr(x[0]) if len(x) == 1 else render.tuple(x),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming you're doing this to support the selects.with_or construct from skylib?

EDIT: Okay, pretty clear from looking at the rest of the changes. Might be worth mentioning as a comment here maybe?

@aignas aignas added this pull request to the merge queue Apr 29, 2024
Merged via the queue into bazelbuild:main with commit ced8cc6 Apr 29, 2024
4 checks passed
@aignas aignas deleted the refactor/skylib-selects-in-render branch May 13, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants