Files
simple/setup.sh
T
catarrh 2237a35db5
release / release (push) Waiting to run
v3.31.2: the SCP81 TLS-PSK Python floor, documented and guarded
ssl's TLS-PSK callbacks (PskTlsServer) exist only since Python 3.13 - the
first CI run on 3.12 errored in all 20 PSK tests, and the docs confirm
"Added in version 3.13".

- PskTlsServer._make_context raises a clear RuntimeError naming the
  requirement instead of AttributeError; a source pin keeps the guard.
- tests/test_scp81.py skips PskTlsServerTest where the callbacks are
  missing (it runs on 3.13+), so contributors on 3.9-3.12 no longer see
  20 failures.
- The READMEs state the requirement, and the Windows notes now strongly
  recommend Python 3.13: pyscard has wheels up to 3.13, and on 3.14
  pyscard and some pysim dependency wheels are unavailable and build
  from source (MSVC).  setup.bat and setup.sh print the same guidance.
- Version strings + the PWA cache bumped together (simple-v457).

998 Python + 953 frontend green.
2026-10-20 23:47:10 +03:00

65 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# pysim-simple-server setup script
# Creates a venv and installs pysim and its dependencies.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VENV_DIR="$SCRIPT_DIR/.venv"
# Check prerequisites
command -v python3 >/dev/null 2>&1 || { echo "Error: Python 3 is required but not found. Install Python 3.9+ from https://python.org"; exit 1; }
command -v git >/dev/null 2>&1 || { echo "Error: Git is required but not found. Install Git from https://git-scm.com"; exit 1; }
PY_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
echo "Found Python $PY_VER"
# Create venv
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment..."
python3 -m venv "$VENV_DIR"
fi
source "$VENV_DIR/bin/activate"
PIP="$VENV_DIR/bin/pip"
# Upgrade pip
$PIP install --upgrade pip -q
# Install pysim from the Osmocom repository
echo ""
echo "=== Installing pysim ==="
$PIP install git+https://github.com/osmocom/pysim.git
# Install pysim-simple-server
echo ""
echo "=== Installing pysim-simple-server ==="
$PIP install -e "$SCRIPT_DIR"
# Check for PC/SC
echo ""
if command -v pcscd >/dev/null 2>&1; then
echo "=== PC/SC daemon found ==="
if ! pgrep -x pcscd >/dev/null; then
echo "Starting pcscd..."
sudo pcscd || echo "Warning: could not start pcscd. Start it manually: sudo systemctl start pcscd"
fi
else
echo "Note: PC/SC daemon not found. If you use a USB smart card reader,"
echo "install pcsc-lite and ccid (plus the PC/SC headers that the"
echo "pyscard build needs on Linux):"
echo " Debian/Ubuntu: sudo apt install pcscd pcsc-tools libpcsclite-dev"
echo " Arch Linux: sudo pacman -S pcsc-lite ccid (headers included)"
echo " Fedora: sudo dnf install pcsc-lite pcsc-lite-ccid pcsc-lite-devel"
fi
# The SCP81 TLS-PSK listener uses ssl's PSK callbacks, added in Python 3.13.
PY_MINOR=$(echo "$PY_VER" | cut -d. -f2)
if [ "${PY_VER%.*}" = "3" ] && [ "$PY_MINOR" -lt 13 ]; then
echo "Note: the SCP81 TLS-PSK listener needs Python 3.13+ (this is $PY_VER);"
echo " the rest of the app works normally."
echo ""
fi
echo ""
echo "=== Setup complete ==="
echo "Run ./start.sh to start the server."