Skip to content
Next Next commit
Add support to pomerge
Use JulienPalard and seluj78's pomerge tool to merge translations from current branch with older branches, making it possible to keep documentations of older versions of Python up-to-date with latest translations. workflow: add pomerge step Makefile: add 'merge' target requirements: add pomerge to be installed by pip
  • Loading branch information
rffontenelle committed May 10, 2020
commit 5f0dbe2fb02b8ce67feab20ef68d15e9f52647e8
5 changes: 5 additions & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ jobs:
name: spellchecking-output
path: pospell-out.tar.gz

- name: Merge translations with older branches
run: make merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build documentation treating warnings as errors
run: |
make build CPYTHON_PATH=/tmp/cpython/
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

CPYTHON_PATH := ../cpython
BRANCH := 3.8
MERGEBRANCHES := 3.7 3.6 2.7
LANGUAGE_TEAM := python-docs-pt-br
LANGUAGE := pt_BR

Expand Down Expand Up @@ -36,6 +37,7 @@ help:
@echo " pot Create/Update POT files from source files"
@echo " serve Serve a built documentation on http://localhost:8000"
@echo " spell Check spelling, storing output in $(POSPELL_TMP_DIR)"
@echo " merge Merge $(BRANCH) branch's .po files into: $(MERGEBRANCHES)"
@echo ""


Expand Down Expand Up @@ -201,6 +203,28 @@ $(POSPELL_TMP_DIR)/typos.txt:
@cut -d: -f3- $(DESTS) | sort -u > $@


# merge: merge translations from BRANCH (Python version currently aim of
# translation) into each branch listed by MERGEBRANCHES (branches
# of older Python versions) so that older versions of the Python
# docs make at least some use the latest translations, if possible.
# After merging, git-push merged files (if any) to the target branch.
.PHONY: merge
merge: venv $(MERGEBRANCHES)

$(MERGEBRANCHES):
@echo "Merging translations from $(BRANCH) branch into $@ ..."
@$(VENV)/bin/pomerge --from-files *.po **/*.po
@git checkout $@
@$(VENV)/bin/pomerge --no-overwrite --to-files *.po **/*.po
@$(VENV)/bin/powrap --modified *.po **/*.po
@if git status -s | egrep '\.po'; then \
git add *.po **/*.po; \
git commit -m "pomerge from $(BRANCH) branch into @"; \
git push; \
fi
@git checkout $(BRANCH)


# clean: remove all .mo files and the venv directory that may exist and
# could have been created by the actions in other targets of this script
.PHONY: clean
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ transifex-client
sphinx-intl
powrap
pospell
pomerge