Conversation
| site_packages_pth_file, | ||
| env_file, | ||
| venv_tool, | ||
| ] + py_toolchain.files.to_list()), |
There was a problem hiding this comment.
py_toolchain should already be in rfs
|
9f5d7d1 to
1c9b48c
Compare
| @@ -1,5 +1,5 @@ | |||
| # tools_telemetry | |||
| bazel_dep(name = "aspect_tools_telemetry", version = "0.2.8") | |||
| bazel_dep(name = "aspect_tools_telemetry", version = "0.3.2") | |||
| workspace_name = ctx.workspace_name | ||
|
|
||
| args = ctx.actions.args() | ||
| args.add_all([venv_dir], expand_directories = False, format_each = "--location=%s") | ||
| args.add(py_shim.bin.bin, format = "--venv-shim=%s") | ||
|
|
||
| # Post-bzlmod we need to record the current repository in case the | ||
| # user tries to consume a `py_venv_binary` across repo boundaries | ||
| # which could cause repo mapping to become relevant. | ||
| args.add( | ||
| ctx.label.repo_name or workspace_name, | ||
| format = "--repo=%s", | ||
| ) | ||
| args.add_all( | ||
| [py_toolchain], | ||
| map_each = lambda py_toolchain: _interpreter_path(workspace_name, py_toolchain), | ||
| format_each = "--python=%s", | ||
| allow_closure = True, | ||
| ) | ||
| args.add(site_packages_pth_file, format = "--pth-file=%s") | ||
| args.add(env_file, format = "--env-file=%s") | ||
| args.add_all([ctx.bin_dir], expand_directories = False, format_each = "--bin-dir=%s") | ||
| args.add(ctx.attr.package_collisions, format = "--collision-strategy=%s") | ||
| args.add(venv_name, format = "--venv-name=%s") | ||
| args.add(ctx.attr.mode, format = "--mode=%s") | ||
| args.add( | ||
| "{}.{}".format( | ||
| py_toolchain.interpreter_version_info.major, | ||
| py_toolchain.interpreter_version_info.minor, | ||
| ), | ||
| format = "--version=%s", | ||
| ) | ||
| args.add( | ||
| "true" if ctx.attr.include_system_site_packages else "false", | ||
| format = "--include-system-site-packages=%s", | ||
| ) | ||
| args.add( | ||
| "true" if ctx.attr.include_system_site_packages else "false", | ||
| format = "--include-user-site-packages=%s", | ||
| ) | ||
|
|
||
| if ctx.attr.debug: | ||
| args.add("--debug") |
There was a problem hiding this comment.
This seems worthwhile if we can peel it out.
|
|
- Use ctx.actions.args() instead of string concatenation with .path - Avoid depset flattening via transitive_files instead of .to_list() - Fork _to_rlocation_path from bazel-lib to avoid keeping ctx alive to execution phase Closes #725


.pathusage so we can enable path-mapping and dedupe the action across configsChanges are visible to end-users: no
Test plan