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

feat: add attrs/fields for the runtime's ABI flags #2390

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

rickeylev
Copy link
Collaborator

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_freethreaded flag.

@rickeylev rickeylev requested a review from aignas as a code owner November 11, 2024 06:53
@rickeylev rickeylev force-pushed the feat.pyruntime.abiflags branch from b0014b0 to c94ff29 Compare November 11, 2024 06:53
@rickeylev rickeylev force-pushed the feat.pyruntime.abiflags branch from c94ff29 to 72e8f87 Compare November 11, 2024 06:57
@rickeylev rickeylev added this pull request to the merge queue Nov 11, 2024
@@ -101,6 +102,13 @@ def _py_runtime_impl(ctx):
interpreter_version_info["minor"],
)

abi_flags = ctx.attr.abi_flags
Copy link
Collaborator

@aignas aignas Nov 11, 2024

Choose a reason for hiding this comment

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

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?

Merged via the queue into bazelbuild:main with commit 4e61031 Nov 11, 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