Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ END_UNRELEASED_TEMPLATE
### Fixed
* (gazelle) Fixed handling of auto-included `__init__.py` files when generating `py_binary`
targets ([#3729](https://github.com/bazel-contrib/rules_python/issues/3729)).
* (entry_point) From now on `mypy` type checking will be skipped on the generated
files ([#3126](https://github.com/bazel-contrib/rules_python/issues/3126)).

{#v0-0-0-added}
### Added
Expand Down
2 changes: 1 addition & 1 deletion python/private/py_console_script_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
raise

if __name__ == "__main__":
sys.exit({entry_point}())
sys.exit({entry_point}()) # type: ignore
"""


Expand Down
22 changes: 12 additions & 10 deletions python/private/pypi/whl_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -546,26 +546,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
2 changes: 1 addition & 1 deletion tests/entry_points/py_console_script_gen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_a_single_entry_point(self):
raise

if __name__ == "__main__":
sys.exit(baz())
sys.exit(baz()) # type: ignore
"""
)
self.assertEqual(want, got)
Expand Down