#!/bin/sh
set -e

# The client runs as an unprivileged user, who cannot write bytecode into
# /opt: compiled here once, or every run compiles Textual again in memory.
case "$1" in
    configure)
        if command -v py3compile >/dev/null 2>&1; then
            site=$(echo /opt/meshbay-common/venv/lib/python3.*/site-packages)
            while IFS= read -r entry; do
                [ -d "$site/$entry" ] && py3compile "$site/$entry" 2>/dev/null || true
            done < /opt/meshbay-cli/site-packages.list
        fi
        ;;
esac

#DEBHELPER#
