weblate/ci/pip-install
Michal Čihař 0639fd96b5 feat: add wlhosted extra
This makes it easier to develop with the hosted environment.
2024-11-06 22:12:10 +01:00

38 lines
1.6 KiB
Bash
Executable file

#!/bin/sh
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e -x
if [ "${1:-latest}" = minimal ]; then
# Adjust deps to force minimal version
sed -i '/^ *"/ s/>=/==/' pyproject.toml
uv sync --no-sources --all-extras --dev
elif [ "${1:-latest}" = edge ]; then
# Install from git / pre-release
mkdir -p build/packages
# Fetch current snapshots
curl -LsSf https://github.com/translate/translate/archive/master.zip > build/packages/translate-toolkit.zip
curl -LsSf https://github.com/WeblateOrg/language-data/archive/main.zip > build/packages/weblate-language-data.zip
curl -LsSf https://github.com/WeblateOrg/translation-finder/archive/main.zip > build/packages/transaltion-finder.zip
# TODO: lxml can use wheels once xmlsec has one
# see https://github.com/xmlsec/python-xmlsec/issues/327
# Add downloaded zip, cannot add URL as uv complains about missing checksum
uv add --no-sources --no-binary-package lxml build/packages/*
# Allow pre-repeases
uv add --no-sources --no-binary-package lxml --prerelease allow Django
uv sync --no-sources --all-extras --dev --no-binary-package lxml
elif python -c 'import sys; sys.exit(0 if sys.version_info >= (3,13) else 1)'; then
# TODO: lxml can use wheels once xmlsec has one
# see https://github.com/xmlsec/python-xmlsec/issues/327
uv sync --no-sources --frozen --all-extras --dev --no-binary-package lxml
else
uv sync --no-sources --frozen --all-extras --dev
fi
# Verify that deps are consistent
if [ "${1:-latest}" != edge ]; then
uv pip check
fi