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

Also name the BUILD file in external repository roots BUILD.bazel #457

Merged
merged 2 commits into from
Apr 18, 2021

Conversation

person142
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Does not include precompiled binaries, eg. .par files. See CONTRIBUTING.md for info
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Closes #440

The build file in the repository roots generated by pip_repository is still BUILD and not BUILD.bazel. Since pip_parse has only one layer of directories, the external repository then ends up with a BUILD and a BUILD.bazel.

What is the new behavior?

It's now called BUILD.bazel, which means pip_parse later overwrites it with the final BUILD.bazel.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This prevents a regression of #427 with pip_parse.

@person142
Copy link
Contributor Author

This comment: #441 (comment) gives an example that fails on master but passes on this branch.

@@ -12,7 +12,7 @@ def _construct_pypath(rctx):
rctx: Handle to the repository_context.
Returns: String of the PYTHONPATH.
"""
rctx.file("BUILD", "")
rctx.file("BUILD.bazel", "")
Copy link
Contributor

@hrfuller hrfuller Apr 18, 2021

Choose a reason for hiding this comment

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

Can you move this line inside the else block here?

It shouldn't have been part of _construct_pypath in the first place, which was my mistake while refactoring. The root level BUILD.bazel file is only needed by pip_install. pip_parse already creates a root level BUILD.bazel in each repository via the extract_wheel function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 6e92245.

The here link above links back to the comment, but I'm assuming you were referring to this else:

https://github.com/bazelbuild/rules_python/blob/master/python/pip_install/pip_repository.bzl#L82

I put it outside that conditional, since we do want the empty build file inside the repository where the requirements.bzl is generated-otherwise user code can't load from it. But it will be left out of the repositories for the individual packages still because it's not being injected here:

https://github.com/bazelbuild/rules_python/blob/master/python/pip_install/pip_repository.bzl#L215

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! Yes you read my mind. I was mixing up with whl_library invocation for that else block.

@hrfuller hrfuller merged commit 04c6d7f into bazelbuild:master Apr 18, 2021
@person142
Copy link
Contributor Author

Thanks for reviewing @hrfuller.

@person142 person142 deleted the build-bazel branch April 18, 2021 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repositories generated by pip_parse contain a BUILD and a BUILD.bazel
2 participants