Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions python/private/pypi/whl_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -535,26 +535,28 @@ def _whl_library_impl(rctx):
rctx.file("MODULE.bazel")
rctx.file("REPO.bazel")

# BUILD files interfere with globbing and Bazel package boundaries.
_remove_files(rctx, "BUILD", "BUILD.bazel")
rctx.file("BUILD.bazel", build_file_contents)

if enable_pipstar and enable_pipstar_extract:
if hasattr(rctx, "repo_metadata"):
return rctx.repo_metadata(reproducible = True)

return None

def _remove_files(rctx, *basenames):
paths = list(rctx.path(".").readdir())
for _ in range(10000000):
if not paths:
break
path = paths.pop()

# BUILD files interfere with globbing and Bazel package boundaries.
if path.basename in ("BUILD", "BUILD.bazel"):
if path.basename in basenames:
rctx.delete(path)
elif path.is_dir:
paths.extend(path.readdir())

rctx.file("BUILD.bazel", build_file_contents)

if enable_pipstar and enable_pipstar_extract:
if hasattr(rctx, "repo_metadata"):
return rctx.repo_metadata(reproducible = True)

return None

def _generate_entry_point_contents(
module,
attribute,
Expand Down