Dosyalar
rocm-systems/cmake/Templates/console-script.in
T
David Galiffi ba0efacd3f Execute arguments via eval (#28)
Porting https://github.com/ROCm/omnitrace/pull/410.

As eval builtin interprets its arguments in the same way as shell would do, which would need some escape work, otherwise, it won't work if the input arguments contains e.g. a JSON string:

omnitrace-python -- ./test.py --json='{"foo": "bar"}'
2024-11-14 13:26:52 -05:00

18 satır
449 B
Bash
Çalıştırılabilir Dosya

#!/usr/bin/env bash
export PYTHONPATH=$(cd $(dirname ${BASH_SOURCE[0]})/../@CMAKE_INSTALL_PYTHONDIR@ && pwd):${PYTHONPATH}
: ${PYTHON_EXECUTABLE:=@PYTHON_EXECUTABLE@}
if [ ! -f ${PYTHON_EXECUTABLE} ]; then PYTHON_EXECUTABLE=$(basename ${PYTHON_EXECUTABLE}); fi
set -e
run-script()
{
echo -e "\n##### ${PROJECT_NAME} :: executing '${@}'... #####\n"
eval $@
}
run-script ${PYTHON_EXECUTABLE} -m @SCRIPT_SUBMODULE@ "$(printf ' %q' "$@")"