Skip to content

Commit 9fa551a

Browse files
committed
fix(common): manage interpreter at runtime
1 parent 0b6d149 commit 9fa551a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

bin/compile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,23 @@ install_managed_python() {
6767

6868
write_python_shim() {
6969
local shim_path="$1"
70-
local shim_name="$2"
71-
local managed_python_relative="${PYTHON_BIN#"$BUILD_DIR"/}"
70+
local python_executable_name
71+
72+
python_executable_name="$(basename "$PYTHON_BIN")"
7273

7374
cat > "$shim_path" <<EOF
7475
#!/usr/bin/env bash
7576
set -euo pipefail
7677
APP_DIR="\$(cd "\$(dirname "\${BASH_SOURCE[0]}")/../.." && pwd)"
77-
exec "\$APP_DIR/$managed_python_relative" "\$@"
78+
79+
for candidate in "\$APP_DIR"/.uv/python/*/bin/${python_executable_name}; do
80+
if [ -x "\$candidate" ]; then
81+
exec "\$candidate" "\$@"
82+
fi
83+
done
84+
85+
echo "Managed Python executable not found for ${python_executable_name} under \$APP_DIR/.uv/python" >&2
86+
exit 1
7887
EOF
7988
chmod +x "$shim_path"
8089
}

0 commit comments

Comments
 (0)