install: use Python entry-point script instead of python -m for launcher

'python -m blitztext' adds cwd to sys.path, so running blitztext from inside
a directory that contains a blitztext/ folder shadows the installed package.
A proper shebang entry-point script sets sys.path[0] to the script's own
directory (venv/bin), making the launcher cwd-independent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-06-08 20:41:30 +02:00
parent 2303dd8f78
commit f877a76550

View File

@ -44,9 +44,13 @@ echo "==> Writing default config (if absent)"
echo "==> Installing launcher → $BIN"
mkdir -p "$(dirname "$BIN")"
# Use a Python entry-point script (not `python -m`) so the current working
# directory is never added to sys.path and can't shadow the installed package.
cat > "$BIN" <<EOF
#!/bin/sh
exec "$VENV/bin/python" -m blitztext "\$@"
#!$VENV/bin/python
import sys
from blitztext.blitztext import main
sys.exit(main())
EOF
chmod +x "$BIN"