SideFX Houdini customization package
git clone https://git.lucas.co/hou-control.git
houdini-agent/hrun (976B)
1 #!/bin/bash
2 # Wrapper to run python code in a running Houdini via the hrpyc bridge.
3 #
4 # Paths are derived from this script's own location. The previous version
5 # hardcoded /home/lsgalante/src/hou-control, which stopped existing when the
6 # repo moved under Dropbox, so hrun silently pointed at nothing.
7 set -euo pipefail
8
9 AGENT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
10 BRIDGE_SCRIPT="$AGENT_DIR/bridge.py"
11 VENV_PY="$AGENT_DIR/.venv/bin/python3"
12
13 if [ "$#" -lt 1 ]; then
14 echo "Usage: hrun <python_code>" >&2
15 exit 1
16 fi
17
18 if [ ! -x "$VENV_PY" ]; then
19 echo "hrun: no interpreter at $VENV_PY" >&2
20 echo " python3 -m venv '$AGENT_DIR/.venv'" >&2
21 echo " '$AGENT_DIR/.venv/bin/pip' install -r '$AGENT_DIR/mcpserver/requirements.txt'" >&2
22 exit 1
23 fi
24
25 if [ ! -f "$BRIDGE_SCRIPT" ]; then
26 echo "hrun: bridge not found at $BRIDGE_SCRIPT" >&2
27 exit 1
28 fi
29
30 # Pass the original string argument as is.
31 exec "$VENV_PY" "$BRIDGE_SCRIPT" "$1"