Skip to content

Commit dd2b0b3

Browse files
committed
pass create_inits() non-selet value, add select value afterwards
1 parent 82b9acc commit dd2b0b3

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

python/private/pypi/whl_library_targets.bzl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,18 +360,12 @@ def whl_library_targets(
360360
if item not in _data_exclude:
361361
_data_exclude.append(item)
362362

363-
site_packages_data = native.glob(
363+
data = data + native.glob(
364364
["site-packages/**/*"],
365365
exclude = _data_exclude,
366366
allow_empty = True,
367367
)
368368

369-
data_param = data
370-
data = data + site_packages_data + select({
371-
_IS_VENV_SITE_PACKAGES_YES: [DATA_LABEL],
372-
"//conditions:default": [],
373-
})
374-
375369
pyi_srcs = native.glob(
376370
["site-packages/**/*.pyi"],
377371
allow_empty = True,
@@ -381,14 +375,21 @@ def whl_library_targets(
381375
generated_namespace_package_files = select({
382376
_IS_VENV_SITE_PACKAGES_YES: [],
383377
"//conditions:default": rules.create_inits(
384-
srcs = srcs + data_param + site_packages_data + pyi_srcs,
378+
srcs = srcs + data + pyi_srcs,
385379
ignored_dirnames = [], # If you need to ignore certain folders, you can patch rules_python here to do so.
386380
root = "site-packages",
387381
),
388382
})
389383
namespace_package_files += generated_namespace_package_files
390384
srcs = srcs + generated_namespace_package_files
391385

386+
# This must be doe after the above because create_inits() is macro-phase,
387+
# so can't handle select() values.
388+
data = data + select({
389+
_IS_VENV_SITE_PACKAGES_YES: [DATA_LABEL],
390+
"//conditions:default": [],
391+
})
392+
392393
rules.py_library(
393394
name = py_library_label,
394395
srcs = srcs,

0 commit comments

Comments
 (0)