weblate/ci/pip-install
2024-04-19 12:24:23 +02:00

43 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
# Install CI requirements
# shellcheck disable=SC2046
python -m pip install $(sed -n 's/.*"\(pip==\([^"]*\)\)".*/\1/p' pyproject.toml)
# shellcheck disable=SC2046
pip install $(sed -n 's/.*"\(wheel==\([^"]*\)\)".*/\1/p' pyproject.toml)
# Workaround for
# SystemError: ffi_prep_closure(): bad user_data (it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time)
pip install --no-binary :all: cffi
if [ "${1:-latest}" = migrations ] ; then
pip install -e ".[all,mysql,ci]"
else
if [ "${1:-latest}" = minimal ] ; then
# Adjust deps to force minimal version
sed -i '/^ *"/ s/>=/==/' pyproject.toml
fi
if [ "${1:-latest}" = mypy ] ; then
pip install -e ".[all,mysql,ci,mypy,test]"
else
pip install -e ".[all,mysql,ci,test]"
fi
if [ "${1:-latest}" = edge ] ; then
pip install --no-binary=lxml --upgrade-strategy eager -U -e ".[all,mysql,test,ci]"
# Install from git / pre-release
pip install --no-deps --upgrade --force-reinstall https://github.com/translate/translate/archive/master.zip
pip install --no-deps --upgrade --force-reinstall https://github.com/WeblateOrg/language-data/archive/main.zip
pip install --no-deps --upgrade --force-reinstall https://github.com/WeblateOrg/translation-finder/archive/main.zip
pip install --upgrade --pre Django
fi
fi
# Verify that deps are consistent
pip check