-
-
Notifications
You must be signed in to change notification settings - Fork 610
fix(repo setup): Skip aliases for unloaded toolchains #1473
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
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
ed59285
to
b646894
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly lgtm, just move the platforms constant out of the generated defs.bzl
python/private/toolchains_repo.bzl
Outdated
@@ -195,6 +196,9 @@ load("{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_ | |||
|
|||
host_platform = "{host_platform}" | |||
interpreter = "@{py_repository}_{host_platform}//:{python3_binary_path}" | |||
PLATFORMS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take this out of defs.bzl -- defs.bzl is a public entry point, and this isn't a detail we want to make part of our public API.
Instead, it can be inlined in build_contents directly:
_plaforms = [
{loaded_platforms}
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the selection of platforms is valuable information, but I am not sure if this is the right form to make that available. So, I am fine with removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as suggested.
CHANGELOG.md
Outdated
* Skip aliases for unloaded toolchains. Toolchains without a checksum are skipped | ||
in the repo load phase. These skipped repos now don't have aliases in the toolchains repo. | ||
This is relevant when working with older python versions that don't have full platform | ||
support. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Skip aliases for unloaded toolchains. Toolchains without a checksum are skipped | |
in the repo load phase. These skipped repos now don't have aliases in the toolchains repo. | |
This is relevant when working with older python versions that don't have full platform | |
support. | |
* Skip aliases for unloaded toolchains. Some Python versions that don't have full | |
platform support, and referencing their undefined repositories can break operations | |
like `bazel query rdeps(...)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
CI is unhappy, but it's not immediately apparent why. It gives me the feeling there might be a syntax error somewhere? Or maybe what's happening is the BUILD file is trying to load defs.bzl before something defs.bzl needs is ready? Maybe removing that |
Toolchains without a checksum are skipped in python_register_toolchain. This commit also skips the creation of aliases to those toolchains. Closes bazel-contrib#1472
b646894
to
4f3af59
Compare
@rickeylev I have addressed your concerns. CI is happy now, even without knowing the root cause of the original failures. Could you please re-review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Some platforms don't contain every version, e.g. s390x doesn't have 3.8, which is
indicated by a missing sha256 value. When this happens, no repository for the runtime
is created (
python_repository
rule).Similar logic needs to be in the toolchains setup logic because otherwise a reference
to an undefined repository exists in the select() expression of the aliases. Because those
references are lazily evaluated, they don't always cause a problem, but do mean that
query operations (e.g.,
rdeps()
) can't work and the order of entries is important(which is surprising).
Closes #1472