1
0
mirror of https://github.com/Prowlarr/Indexers.git synced 2025-12-20 02:58:28 +00:00
Files
Indexers/scripts/validate-python.sh
2025-08-13 12:45:47 -05:00

37 lines
969 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Check for Python and determine command to use
PYTHON_CMD=""
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
else
echo "Python could not be found. Check your Python installation"
exit 1
fi
echo "Using Python command: $PYTHON_CMD"
# Check if we have a virtual environment and activate it
if [ -d ".venv" ]; then
echo "Activating virtual environment"
if [ -f ".venv/bin/activate" ]; then
# Linux/Mac
source .venv/bin/activate
elif [ -f ".venv/Scripts/activate" ]; then
# Windows
source .venv/Scripts/activate
fi
fi
# Check if required Python packages are available
if ! $PYTHON_CMD -c "import jsonschema, yaml" &> /dev/null; then
echo "required python packages are missing. Install with: pip install -r requirements.txt"
exit 2
fi
# Run Python validation
$PYTHON_CMD scripts/validate.py