Skip to content

Commit ba62630

Browse files
committed
feat: generate filegroup with all extracted wheel files
1 parent 5b1db07 commit ba62630

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

python/private/pypi/labels.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
"""Constants used by parts of pip_repository for naming libraries and wheels."""
1616

17+
EXTRACTED_WHEEL_FILES = "extracted_whl_files"
1718
WHEEL_FILE_PUBLIC_LABEL = "whl"
1819
WHEEL_FILE_IMPL_LABEL = "_whl"
1920
PY_LIBRARY_PUBLIC_LABEL = "pkg"

python/private/pypi/whl_library_targets.bzl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ load(
2424
":labels.bzl",
2525
"DATA_LABEL",
2626
"DIST_INFO_LABEL",
27+
"EXTRACTED_WHEEL_FILES",
2728
"PY_LIBRARY_IMPL_LABEL",
2829
"PY_LIBRARY_PUBLIC_LABEL",
2930
"WHEEL_ENTRY_POINT_PREFIX",
@@ -101,8 +102,16 @@ def whl_library_targets(
101102
srcs_exclude = [],
102103
tags = [],
103104
filegroups = {
104-
DIST_INFO_LABEL: ["site-packages/*.dist-info/**"],
105-
DATA_LABEL: ["data/**"],
105+
EXTRACTED_WHEEL_FILES: dict(
106+
include = ["**"],
107+
exclude = ["*.whl"],
108+
),
109+
DIST_INFO_LABEL: dict(
110+
include = ["site-packages/*.dist-info/**"],
111+
),
112+
DATA_LABEL: dict(
113+
include = ["data/**"],
114+
),
106115
},
107116
dependencies = [],
108117
dependencies_by_platform = {},
@@ -168,10 +177,11 @@ def whl_library_targets(
168177
tags = sorted(tags)
169178
data = [] + data
170179

171-
for filegroup_name, glob in filegroups.items():
180+
for filegroup_name, glob_kwargs in filegroups.items():
181+
glob_kwargs = {"allow_empty": True} | glob_kwargs
172182
native.filegroup(
173183
name = filegroup_name,
174-
srcs = native.glob(glob, allow_empty = True),
184+
srcs = native.glob(**glob_kwargs),
175185
visibility = ["//visibility:public"],
176186
)
177187

0 commit comments

Comments
 (0)