-
-
Notifications
You must be signed in to change notification settings - Fork 594
refactor!(toolchain): remove uname dep in the repository_rule stage #2406
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5c336a1
chore: stop exposing host platform in the toolchain aliases defs
aignas 44a1720
chore: stop exposing the interpreter - use python_3_x_host//:python i…
aignas ba6fc87
chore: remove uname calling from toolchain aliases repo
aignas f373be6
chore: stop exposing config settings in the toolchain aliases repo
aignas 45de4ac
move all of the alias setting to the new macro
aignas 6269dc3
chore: use identifiers used in platforms package for arch and os name…
aignas 2fa2f40
add nice log messages
aignas 8799dc3
fixup
aignas 638e36a
Merge branch 'main' into refactor/remove-uname-dep
aignas 73a8aa6
doc: changelog
aignas 87eea07
fixup
aignas c5b8b16
migrate away from using the interpreter const
aignas e90040a
Fix doc typoe
rickeylev 6f9b9b7
Merge branch 'main' into refactor/remove-uname-dep
aignas 919b8b9
doc: add docs for the toolchain selection env var
aignas d51861e
Merge branch 'main' into refactor/remove-uname-dep
aignas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright 2024 The Bazel Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Create toolchain alias targets.""" | ||
|
||
load("@rules_python//python:versions.bzl", "PLATFORMS") | ||
|
||
def toolchain_aliases(*, name, platforms, visibility = None, native = native): | ||
"""Cretae toolchain aliases for the python toolchains. | ||
|
||
Args: | ||
name: {type}`str` The name of the current repository. | ||
platforms: {type}`platforms` The list of platforms that are supported | ||
for the current toolchain repository. | ||
visibility: {type}`list[Target] | None` The visibility of the aliases. | ||
native: The native struct used in the macro, useful for testing. | ||
""" | ||
for platform in PLATFORMS.keys(): | ||
if platform not in platforms: | ||
continue | ||
|
||
native.config_setting( | ||
name = platform, | ||
flag_values = PLATFORMS[platform].flag_values, | ||
constraint_values = PLATFORMS[platform].compatible_with, | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
prefix = name | ||
for name in [ | ||
"files", | ||
"includes", | ||
"libpython", | ||
"py3_runtime", | ||
"python_headers", | ||
"python_runtimes", | ||
]: | ||
native.alias( | ||
name = name, | ||
actual = select({ | ||
":" + platform: "@{}_{}//:{}".format(prefix, platform, name) | ||
for platform in platforms | ||
}), | ||
visibility = visibility, | ||
) | ||
|
||
native.alias( | ||
name = "python3", | ||
actual = select({ | ||
":" + platform: "@{}_{}//:{}".format(prefix, platform, "python.exe" if "windows" in platform else "bin/python3") | ||
for platform in platforms | ||
}), | ||
visibility = visibility, | ||
) | ||
native.alias( | ||
name = "pip", | ||
actual = select({ | ||
":" + platform: "@{}_{}//:python_runtimes".format(prefix, platform) | ||
for platform in platforms | ||
if "windows" not in platform | ||
}), | ||
visibility = visibility, | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.