Skip to content

Commit fce691e

Browse files
committed
fix: delete BUILD et al files from pypi sourced dependencies
1 parent 4978027 commit fce691e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

python/private/pypi/whl_library.bzl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,26 @@ def _whl_library_impl(rctx):
471471
],
472472
)
473473

474-
rctx.file("BUILD.bazel", build_file_contents)
474+
# Delete these in case the wheel had them. They generally don't cause
475+
# a problem, but let's avoid the chance of that happening.
476+
rctx.file("WORKSPACE")
477+
rctx.file("WORKSPACE.bazel")
478+
rctx.file("MODULE.bazel")
479+
rctx.file("REPO.bazel")
480+
481+
paths = [rctx.path(".").readdir()]
482+
for _ in range(10000000):
483+
if not paths:
484+
break
485+
path = paths.pop()
486+
487+
# BUILD files interfere with globbing and Bazel package boundaries.
488+
if path.basename in ("BUILD", "BUILD.bazel"):
489+
rctx.delete(path)
490+
elif path.is_dir:
491+
paths.extend(path.readdir())
475492

493+
rctx.file("BUILD.bazel", build_file_contents)
476494
return
477495

478496
def _generate_entry_point_contents(

0 commit comments

Comments
 (0)