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(pkg_aliases): create a macro for creating whl aliases #2391

Merged
merged 17 commits into from
Nov 13, 2024

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Nov 11, 2024

This just cleans up the code and moves more logic from the repository_rule
(i.e. generation of BUILD.bazel files) to loading time (macro evaluation).
This makes the unit testing easier and I plan to also move the code that is
generating config setting names from filenames to this new macro, but wanted to
submit this PR to reduce the review chunks.

Summary:

  • Add a new pkg_aliases macro.
  • Move logic and tests for creating WORKSPACE aliases.
  • Move logic and tests bzlmod aliases.
  • Move logic and tests bzlmod aliases with groups.
  • Add a test for extra alias creation.
  • Use whl_alias in pypi extension integration tests.
  • Improve the serialization of whl_alias for passing to the pypi hub repo.

Related to #260, #2386, #2337, #2319 - hopefully cleaning the code up will make
it easier to address those feature requests later.

@aignas
Copy link
Collaborator Author

aignas commented Nov 12, 2024

Bazel 9 integration tests are failing - I'll wait for the #2379.

python/private/pypi/pkg_aliases.bzl Outdated Show resolved Hide resolved
python/private/pypi/pkg_aliases.bzl Outdated Show resolved Hide resolved
python/private/pypi/pkg_aliases.bzl Outdated Show resolved Hide resolved

def mock_select(value, no_match_error = None):
actual_no_match_error.append(no_match_error)
env.expect.that_str(no_match_error).equals("""\
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh ouch, this is brittle. I gotta add some StrSubject methods to make partial matching easier. FYI: .contains() can be used for less exact matching

aignas and others added 5 commits November 13, 2024 09:35
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
@aignas aignas added this pull request to the merge queue Nov 13, 2024
Merged via the queue into bazelbuild:main with commit 7b95ea6 Nov 13, 2024
4 checks passed
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.

2 participants