From 025434edb8997f95e137e5892972e130f12c4624 Mon Sep 17 00:00:00 2001 From: Andrew Gallagher Date: Sat, 5 Oct 2024 02:41:42 -0700 Subject: [PATCH] Add `wheel_linker_flags` to python toolchain Summary: Allow setting linker flags specific to `python_wheel` rules. Reviewed By: fduwjj, manav-a Differential Revision: D63904190 fbshipit-source-id: cf6edb767746117dc02e28fe1665c2db82a7ad78 --- python/python_wheel.bzl | 1 + python/toolchain.bzl | 1 + 2 files changed, 2 insertions(+) diff --git a/python/python_wheel.bzl b/python/python_wheel.bzl index cb7bb1580..f94dc6371 100644 --- a/python/python_wheel.bzl +++ b/python/python_wheel.bzl @@ -152,6 +152,7 @@ def _impl(ctx: AnalysisContext) -> list[Provider]: opts = link_options( links = [ LinkArgs(flags = python_toolchain.extension_linker_flags), + LinkArgs(flags = python_toolchain.wheel_linker_flags), LinkArgs(infos = inputs), ], category_suffix = "native_extension", diff --git a/python/toolchain.bzl b/python/toolchain.bzl index 6c8c05653..3a0e4260b 100644 --- a/python/toolchain.bzl +++ b/python/toolchain.bzl @@ -57,6 +57,7 @@ PythonToolchainInfo = provider( "linker_flags": provider_field(typing.Any, default = None), "binary_linker_flags": provider_field(typing.Any, default = None), "extension_linker_flags": provider_field(typing.Any, default = None), + "wheel_linker_flags": provider_field(list[typing.Any], default = []), "generate_static_extension_info": provider_field(typing.Any, default = None), "parse_imports": provider_field(typing.Any, default = None), "traverse_dep_manifest": provider_field(typing.Any, default = None),