mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-24 02:03:29 +08:00
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
45 lines
1.1 KiB
Bash
Executable file
45 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
set -e
|
|
|
|
cd /app/src
|
|
|
|
install_deps() {
|
|
uv pip install \
|
|
--no-config \
|
|
--no-binary xmlsec \
|
|
--no-binary lxml \
|
|
-r /tmp/requirements.txt \
|
|
supervisor \
|
|
watchfiles
|
|
}
|
|
|
|
# Prune unused uv cache entries
|
|
uv cache prune
|
|
|
|
echo "Exporting Weblate requirements..."
|
|
uv export --no-config --format requirements-txt --python "python${PYVERSION}" --all-extras > /tmp/requirements.txt
|
|
|
|
echo "Checking /app/venv..."
|
|
if [ ! -f /app/venv/bin/activate ]; then
|
|
uv venv --no-config /app/venv
|
|
fi
|
|
echo "/app/data/python" > "/app/venv/lib/python${PYVERSION}/site-packages/weblate-docker.pth"
|
|
# shellcheck disable=SC1091
|
|
. /app/venv/bin/activate
|
|
|
|
echo "Installing Weblate requirements..."
|
|
install_deps
|
|
if ! python -c "import xmlsec" 2> /dev/null; then
|
|
# Clean uv cache in case xmlsec (and related lxml/libxml bindings) does not work
|
|
# (typically caused by upgrade of underlying system or otherwise mixed up libxml versions)
|
|
uv cache clean
|
|
install_deps
|
|
fi
|
|
|
|
echo "Starting Weblate..."
|
|
exec /app/bin/start "$@"
|