-
|
This is my use case, I am embedding a configuration file in my pex binary, and I would like to also pass that file in as a command line argument. For example: pex_binary(
name="mybinary",
script="mybinary",
dependencies=[
"//configuration:my_configuration_file",
],
include_tools=True,
args=[
"--configuration_file",
some_path_resolver("//configuration:my_configuration_file")
],
)What's the best way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
@aebrahim this recapitulates some Slack discussion, but for future readers: With pex 2.82.0 or greater (which requires Pants >= 2.30.1rc0): [pex-cli]
version = "v2.82.0"
known_versions = [
"v2.82.0|macos_x86_64|6b48461f7ba94ff1702aab287cf8cff0b7baec7b16a4a7b0b86212083b3c8ff9|4955508",
"v2.82.0|macos_arm64|6b48461f7ba94ff1702aab287cf8cff0b7baec7b16a4a7b0b86212083b3c8ff9|4955508",
"v2.82.0|linux_x86_64|6b48461f7ba94ff1702aab287cf8cff0b7baec7b16a4a7b0b86212083b3c8ff9|4955508",
"v2.82.0|linux_arm64|6b48461f7ba94ff1702aab287cf8cff0b7baec7b16a4a7b0b86212083b3c8ff9|4955508"
]And assuming pex_binary(
name="mybinary",
script="mybinary",
dependencies=[
"//configuration:my_configuration_file",
],
include_tools=True,
args=[
"--configuration_file",
"{pex.env.MY_CONFIGURATION_FILE}"
],
extra_build_args=[
"--bind-resource-path",
"MY_CONFIGURATION_FILE=relative/path/of/my_configuration.file"
]
)Here I have a working example using the 3rdparty fortune PyPI package and a repository-local fortune file resource here: https://github.com/jsirois/pants-discussions-22865 |
Beta Was this translation helpful? Give feedback.
@aebrahim this recapitulates some Slack discussion, but for future readers:
With pex 2.82.0 or greater (which requires Pants >= 2.30.1rc0):
And assuming
//configuration:my_configuration_fileis aresourcetarget, you'd write: