#!/usr/bin/env python3
"""Launcher: run the pp package that sits beside this file, wherever it is linked from.

realpath resolves every symlink (~/.local/bin/pp -> releases/pp/current/bin/pp -> releases/pp/<stamp>/bin/pp),
so a running pp stays on the release it started from even if `current` flips under it.
"""
import os
import sys

if sys.version_info < (3, 11, 4):      # pp/cli.py says it too, for `python -m pp` and the installed command
    print(f"pp needs Python >= 3.11.4 (tarfile's data filter); this is {sys.version.split()[0]} at "
          f"{sys.executable}", file=sys.stderr)
    raise SystemExit(2)

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from pp.cli import main  # noqa: E402

sys.exit(main())
