#!/bin/bash # Vendoring script for hermes-chatto-plugin # Downloads dependencies from pyproject.toml using uv and vendors them into chattolib_vendor/ # Usage: ./vendor_chattolib.sh set -euo pipefail PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo "Vendoring dependencies from pyproject.toml using uv..." # Clean up any existing vendored dependencies rm -rf "${PLUGIN_DIR}/vendor" # Create target directory mkdir -p "${PLUGIN_DIR}/vendor" # Create a temporary virtual environment uv venv .venv --clear # Set environment variables for the venv # shellcheck disable=SC1091 source .venv/bin/activate cd "${PLUGIN_DIR}" uv pip install chattolib --target vendor-tmp cp -r vendor-tmp/chattolib* "${PLUGIN_DIR}/vendor/" # Create __init__.py to make it importable cat > "${PLUGIN_DIR}/vendor/chattolib/__init__.py" << 'EOF' # Vendored chattolib EOF rm -rf vendor-tmp/ echo "✓ Dependencies vendored successfully to ${PLUGIN_DIR}/vendor/chattolib/" echo "do 'git add vendor/' now or later"