feat: add attrs/fields for the runtime's ABI flags#2390
Merged
rickeylev merged 1 commit intobazel-contrib:mainfrom Nov 11, 2024
Merged
feat: add attrs/fields for the runtime's ABI flags#2390rickeylev merged 1 commit intobazel-contrib:mainfrom
rickeylev merged 1 commit intobazel-contrib:mainfrom
Conversation
b0014b0 to
c94ff29
Compare
c94ff29 to
72e8f87
Compare
aignas
approved these changes
Nov 11, 2024
aignas
reviewed
Nov 11, 2024
| interpreter_version_info["minor"], | ||
| ) | ||
|
|
||
| abi_flags = ctx.attr.abi_flags |
Collaborator
There was a problem hiding this comment.
What about doing
diff --git a/python/private/hermetic_runtime_repo_setup.bzl b/python/private/hermetic_runtime_repo_setup.bzl
index 3f7bb5d7..207d021b 100644
--- a/python/private/hermetic_runtime_repo_setup.bzl
+++ b/python/private/hermetic_runtime_repo_setup.bzl
@@ -198,6 +198,10 @@ def define_hermetic_runtime_toolchain_impl(
_IS_FREETHREADED: "cpython-{major}{minor}t".format(**version_dict),
"//conditions:default": "cpython-{major}{minor}".format(**version_dict),
}),
+ abi_info = select({
+ _IS_FREETHREADED: "t",
+ "//conditions:default": "",
+ }),
)
py_runtime_pair(Instead of depending on the _py_freethreaded_flag implementation?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds attributes and fields for storing the runtimes ABI flags value, i.e.
sys.abiflags.For freethreaded interpreters, the abi flags contain
t, which is used creating e.g.virtualenvs.
The attribute can be directly specified, or if it's not, will be computed based on the
--py_freethreadedflag.