Skip to content

Improve ci #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update script to work with the new TX command
Previous solution of patching .tx/config does not work with the
new client, so the script had to be updated with new solution.
Now, translations are pulled into a sub-directory of cpython, and
then installed in the languages's repository.

Also using 'realpath' tool in ROOTDIR to retrieve absolute path,
which actually eases referencing the repository root directory.
  • Loading branch information
rffontenelle committed Oct 24, 2022
commit 5a0df7999a33ee138ee460f44771be702ea3692f
27 changes: 12 additions & 15 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ set -e
# Allow language being passed as 1st argument, defaults to ja
LANGUAGE=${1:-ja}

ROOTDIR=$(dirname $0)/..
ROOTDIR=$(realpath "$(dirname $0)/..")

cd ${ROOTDIR}
cd "${ROOTDIR}"

if ! test -f cpython/Doc/conf.py; then
echo Unable to find proper CPython Doc folder
Expand All @@ -21,22 +21,19 @@ cd cpython/Doc
sphinx-build -E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot

# Update CPython's .tx/config
cd locales
cd locales
sphinx-intl create-txconfig
sphinx-intl update-txconfig-resources -p pot -d . --transifex-project-name python-newest
sphinx-intl update-txconfig-resources -p pot -d . --transifex-organization-name python-doc --transifex-project-name python-newest

if [ "$CI" = true ]
then
if [ "$CI" = true ]; then
tx push --source --no-interactive --skip
fi

# Update the translation project's .tx/config
cd ../../.. # back to $ROOTDIR
mkdir -p .tx
sed cpython/Doc/locales/.tx/config \
-e '/^source_file/d' \
-e 's|<lang>/LC_MESSAGES/||' \
-e "s|^file_filter|trans.${LANGUAGE}|" \
> .tx/config
# Pull translations into cpython/Doc/locales/LANGUAGE/LC_MESSAGES/
tx pull -l ${LANGUAGE} -t --use-git-timestamps -f

tx pull -l ${LANGUAGE} --use-git-timestamps --parallel
# Finally, move downloaded translation files to the language's repository
cd "${LANGUAGE}/LC_MESSAGES/"
for po in $(find . -type f -name '*.po' | sort | sed 's|^\./||'); do
install -Dm644 ${po} "${ROOTDIR}/${po}"
done