@@ -102,6 +102,7 @@ def whl_library_targets(
102102 srcs_exclude = [],
103103 tags = [],
104104 dependencies = [],
105+ filegroups = None ,
105106 dependencies_by_platform = {},
106107 dependencies_with_markers = {},
107108 group_deps = [],
@@ -131,8 +132,8 @@ def whl_library_targets(
131132 dependencies by platform key.
132133 dependencies_with_markers: {type}`dict[str, str]` A marker to evaluate
133134 in order for the dep to be included.
134- filegroups: {type}`dict[str, list[str]]` A dictionary of the target
135- names and the glob matches.
135+ filegroups: {type}`dict[str, list[str]] | None ` A dictionary of the target
136+ names and the glob matches. If `None`, defaults will be used.
136137 group_name: {type}`str` name of the dependency group (if any) which
137138 contains this library. If set, this library will behave as a shim
138139 to group implementation rules which will provide simultaneously
@@ -165,22 +166,23 @@ def whl_library_targets(
165166 tags = sorted (tags )
166167 data = [] + data
167168
168- _filegroups = {
169- # TODO(#3011): Consider parsing the RECORD file to get a precise list of files
170- # instead of relying on a glob with excludes.
171- EXTRACTED_WHEEL_FILES : dict (
172- include = ["**" ],
173- exclude = [name ],
174- ),
175- DIST_INFO_LABEL : dict (
176- include = ["site-packages/*.dist-info/**" ],
177- ),
178- DATA_LABEL : dict (
179- include = ["data/**" ],
180- ),
181- }
169+ if filesgroups == None :
170+ filegroups = {
171+ # TODO(#3011): Consider parsing the RECORD file to get a precise list of files
172+ # instead of relying on a glob with excludes.
173+ EXTRACTED_WHEEL_FILES : dict (
174+ include = ["**" ],
175+ exclude = [name ],
176+ ),
177+ DIST_INFO_LABEL : dict (
178+ include = ["site-packages/*.dist-info/**" ],
179+ ),
180+ DATA_LABEL : dict (
181+ include = ["data/**" ],
182+ ),
183+ }
182184
183- for filegroup_name , glob_kwargs in _filegroups .items ():
185+ for filegroup_name , glob_kwargs in filegroups .items ():
184186 glob_kwargs = {"allow_empty" : True } | glob_kwargs
185187 native .filegroup (
186188 name = filegroup_name ,
0 commit comments