vendor_chattolib.sh 1009 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # Vendoring script for hermes-chatto-plugin
  3. # Downloads dependencies from pyproject.toml using uv and vendors them into chattolib_vendor/
  4. # Usage: ./vendor_chattolib.sh
  5. set -euo pipefail
  6. PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  7. echo "Vendoring dependencies from pyproject.toml using uv..."
  8. # Clean up any existing vendored dependencies
  9. rm -rf "${PLUGIN_DIR}/vendor"
  10. # Create target directory
  11. mkdir -p "${PLUGIN_DIR}/vendor"
  12. # Create a temporary virtual environment
  13. uv venv .venv --clear
  14. # Set environment variables for the venv
  15. # shellcheck disable=SC1091
  16. source .venv/bin/activate
  17. cd "${PLUGIN_DIR}"
  18. uv pip install chattolib --target vendor-tmp
  19. cp -r vendor-tmp/chattolib* "${PLUGIN_DIR}/vendor/"
  20. # Create __init__.py to make it importable
  21. cat > "${PLUGIN_DIR}/vendor/chattolib/__init__.py" << 'EOF'
  22. # Vendored chattolib
  23. EOF
  24. rm -rf vendor-tmp/
  25. echo "✓ Dependencies vendored successfully to ${PLUGIN_DIR}/vendor/chattolib/"
  26. echo "do 'git add vendor/' now or later"