-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathsetup.sh
executable file
·39 lines (32 loc) · 1.25 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# Set up environment for operations on Python docs translation
# This is meant for running locally to make it easier to test etc.
#
# SPDX-License-Identifier: CC0-1.0
set -xeu
# Fail earlier if required variables are not set
test -n ${PYDOC_VERSION+x}
test -n ${PYDOC_REPO+x}
test -n ${PYDOC_LANGUAGE+x}
# Make sure to run all commands from repository root directory
cd $(dirname $0)/..
# Clean up
rm -rf cpython
# Check out needed repositories
git clone --depth 1 --single-branch --branch ${PYDOC_VERSION} https://github.com/python/cpython cpython
git clone --depth 1 --single-branch --branch ${PYDOC_VERSION} ${PYDOC_REPO} cpython/Doc/locales/${PYDOC_LANGUAGE}/LC_MESSAGES
# Install dependencies; Require being in a VENV or in GitHub Actions
set +u
if [ -z "${VIRTUAL_ENV+x}" ] && [ -z "${CI+x}" ]; then
echo "Expected to be in a virtual environment. For instance:"
echo " rm -rf .venv && python -m venv .venv && source ~/venv/bin/activate"
exit 1
fi
set -u
pip install -r requirements.txt
make -C cpython/Doc venv
if ! command -v tx > /dev/null; then
echo "WARNING: Transifex CLI tool was not found."
echo "If going to pull translations it is needed, can be ignored otherwise."
echo "See https://github.com/transifex/cli for install info"
fi