Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 17313cc

Browse filesBrowse files
committed
fix: spill module mapping args to a file
1 parent bb6249b commit 17313cc
Copy full SHA for 17313cc

File tree

Expand file treeCollapse file tree

3 files changed

+11
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-4
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Unreleased changes template.
5959
* (pypi) The `ppc64le` is now pointing to the right target in the `platforms` package.
6060
* (gazelle) No longer incorrectly merge `py_binary` targets during partial updates in
6161
`file` generation mode. Fixed in [#2619](https://github.com/bazelbuild/rules_python/pull/2619).
62+
* (gazelle) Don't collapse depsets to a list or into args when generating the modules mapping file.
63+
Support spilling modules mapping args into a params file.
6264

6365
{#v0-0-0-added}
6466
### Added

‎gazelle/modules_mapping/def.bzl

Copy file name to clipboardExpand all lines: gazelle/modules_mapping/def.bzl
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,22 @@ module name doesn't match the wheel distribution name.
2525

2626
def _modules_mapping_impl(ctx):
2727
modules_mapping = ctx.actions.declare_file(ctx.attr.modules_mapping_name)
28-
args = ctx.actions.args()
2928
all_wheels = depset(
3029
[whl for whl in ctx.files.wheels],
3130
transitive = [dep[DefaultInfo].files for dep in ctx.attr.wheels] + [dep[DefaultInfo].data_runfiles.files for dep in ctx.attr.wheels],
3231
)
33-
args.add("--output_file", modules_mapping.path)
32+
33+
args = ctx.actions.args()
34+
args.use_param_file(param_file_arg = "@%s")
35+
args.set_param_file_format(format = "multiline")
3436
if ctx.attr.include_stub_packages:
3537
args.add("--include_stub_packages")
38+
args.add("--output_file", modules_mapping)
3639
args.add_all("--exclude_patterns", ctx.attr.exclude_patterns)
37-
args.add_all("--wheels", [whl.path for whl in all_wheels.to_list()])
40+
args.add_all("--wheels", all_wheels)
41+
3842
ctx.actions.run(
39-
inputs = all_wheels.to_list(),
43+
inputs = all_wheels,
4044
outputs = [modules_mapping],
4145
executable = ctx.executable._generator,
4246
arguments = [args],

‎gazelle/modules_mapping/generator.py

Copy file name to clipboardExpand all lines: gazelle/modules_mapping/generator.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def data_has_purelib_or_platlib(path):
152152
parser = argparse.ArgumentParser(
153153
prog="generator",
154154
description="Generates the modules mapping used by the Gazelle manifest.",
155+
fromfile_prefix_chars="@",
155156
)
156157
parser.add_argument("--output_file", type=str)
157158
parser.add_argument("--include_stub_packages", action="store_true")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.