quiet-army-59227
07/26/2024, 1:03 AMargs
and name
field in the pex_binary
target if I use pex_binaries
instead of individually writing each pex_binary
target with different entry_points
?broad-processor-92400
07/26/2024, 1:15 AMquiet-army-59227
07/26/2024, 1:16 AMIf you'd like to override a field's value for everytarget generated by this target, change the field directly on this target rather than using thepex_binary
field.overrides
quiet-army-59227
07/26/2024, 1:16 AMbroad-processor-92400
07/26/2024, 1:17 AMquiet-army-59227
07/26/2024, 1:18 AM__defaults__(extend=True, pex_binary=dict(name="bin", args=["-h"]))
and got this:
TypeError: set_defaults() got an unexpected keyword argument 'pex_binary'
broad-processor-92400
07/26/2024, 1:20 AM__defaults__
takes a dict
not kwargs directly (https://www.pantsbuild.org/2.21/docs/using-pants/key-concepts/targets-and-build-files#field-default-values)
__defaults__({pex_binary: dict(name="bin", args=["-h"])}, extend=True)
(NB the {...}
)
However that's something slightly different to overrides
quiet-army-59227
07/26/2024, 1:21 AMInvalidFieldException: Unrecognized field `name` for target pex_binary. Valid fields are: args, check, complete_platforms, dependencies, description, emit_warnings, entry_point, env, environment, executable, execution_mode, extra_build_args, ignore_errors, include_requirements, include_sources, include_tools, inherit_path, interpreter_constraints, layout, output_path, platforms, resolve, resolve_local_platforms, restartable, script, sh_boot, shebang, strip_pex_env, tags, venv_hermetic_scripts, venv_site_packages_copies.
broad-processor-92400
07/26/2024, 1:23 AM__defaults__
? I think the name
field may be special and so may not work with __defaults__
. But, it's a bit surprising that to be setting the name by default, one cannot have two targets with the same name in a single directorybroad-processor-92400
07/26/2024, 1:24 AMpex_binaries(..., overrides={....: dict(name="a"), ...: dict(name="b")})
where the ...
depend on your specificsquiet-army-59227
07/26/2024, 1:24 AMpex_binaries
name each pex_binary
target? And is there a way to customize it?broad-processor-92400
07/26/2024, 1:25 AMpants list
, e.g. pants list path/to/directory:
will print the names of all the targets defined in path/to/directory/BUILD
I thinkquiet-army-59227
07/26/2024, 1:25 AM