From 5f0dbe2fb02b8ce67feab20ef68d15e9f52647e8 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 08:35:38 -0300 Subject: [PATCH 01/11] 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 --- .github/workflows/pythonpackage.yml | 5 +++++ Makefile | 24 ++++++++++++++++++++++++ requirements.txt | 1 + 3 files changed, 30 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 5b5e382a7..942050e0a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -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/ diff --git a/Makefile b/Makefile index 1ba0fa374..952bcad0a 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 "" @@ -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 diff --git a/requirements.txt b/requirements.txt index fb6da3812..50e73f386 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ transifex-client sphinx-intl powrap pospell +pomerge From 7a81b2ac52e9efeab75e784f9fa3655c57e994f7 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 08:44:37 -0300 Subject: [PATCH 02/11] Makefile: avoid OLDPWD in tx-config Instead of changing dir to OLDPWD in an incorrect way, now using mkdir and sed to create .tx/config --- Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 952bcad0a..6bf80da9b 100644 --- a/Makefile +++ b/Makefile @@ -106,13 +106,12 @@ tx-config: pot --locale-dir . \ --pot-dir pot; - cd $(OLDPWD) - mv $(CPYTHON_WORKDIR)/Doc/locales/.tx/config .tx/config - - sed -i .tx/config \ + mkdir -p .tx + sed $(CPYTHON_WORKDIR)/Doc/locales/.tx/config \ -e '/^source_file/d' \ -e 's|/LC_MESSAGES/||' \ - -e "s|^file_filter|trans.$(LANGUAGE)|" + -e "s|^file_filter|trans.$(LANGUAGE)|" \ + > .tx/config # pot: After running "setup" target, run a cpython Makefile's target From 90fd96189035f38db7b6b19e50ba6644a8178952 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 09:04:16 -0300 Subject: [PATCH 03/11] Makefile: do not echo command lines Add @ to the beginning of the command lines to avoid echoing them, and add messages of what is being executed. --- Makefile | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 6bf80da9b..913adc624 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,8 @@ help: # treated as errors, which is good to skip simple Sphinx syntax mistakes. .PHONY: build build: setup - $(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ + @echo "Building Python $(BRANCH) Documentation ..." + @$(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ PYTHON=$(PYTHON) \ SPHINXERRORHANDLING=$(SPHINXERRORHANDLING) \ @@ -58,10 +59,10 @@ build: setup -D latex_engine=xelatex \ -D latex_elements.inputenc= \ -D latex_elements.fontenc=' \ - html; + html - @echo "Success! Open file://$(CPYTHON_WORKDIR)/Doc/build/html/index.html, " \ - "or run 'make serve' to see them in http://localhost:8000"; + @echo "Success! Open file://$(CPYTHON_WORKDIR)/Doc/build/html/index.html, " \ + "or run 'make serve' to see them in http://localhost:8000"; # push: push new translation files and Transifex config files to repository, @@ -69,7 +70,7 @@ build: setup # then assumes we are in GitHub Actions, requiring different push args .PHONY: push push: - if ! git status -s | egrep '\.po|\.tx/config'; then \ + @if ! git status -s | egrep '\.po|\.tx/config'; then \ echo "Nothing to commit"; \ exit 0; \ else \ @@ -89,8 +90,8 @@ push: # to update the translation file mapping. .PHONY: pull pull: venv - $(VENV)/bin/tx pull --force --language=$(LANGUAGE) --parallel - $(VENV)/bin/powrap --quiet *.po **/*.po + @$(VENV)/bin/tx pull --force --language=$(LANGUAGE) --parallel + @$(VENV)/bin/powrap --quiet *.po **/*.po # tx-config: After running "pot", create a new Transifex config file by @@ -98,7 +99,7 @@ pull: venv # LANGUAGE. .PHONY: tx-config tx-config: pot - cd $(CPYTHON_WORKDIR)/Doc/locales; \ + @cd $(CPYTHON_WORKDIR)/Doc/locales; \ rm -rf .tx; \ $(VENV)/bin/sphinx-intl create-txconfig; \ $(VENV)/bin/sphinx-intl update-txconfig-resources \ @@ -106,8 +107,8 @@ tx-config: pot --locale-dir . \ --pot-dir pot; - mkdir -p .tx - sed $(CPYTHON_WORKDIR)/Doc/locales/.tx/config \ + @mkdir -p .tx + @sed $(CPYTHON_WORKDIR)/Doc/locales/.tx/config \ -e '/^source_file/d' \ -e 's|/LC_MESSAGES/||' \ -e "s|^file_filter|trans.$(LANGUAGE)|" \ @@ -118,7 +119,7 @@ tx-config: pot # to generate .pot files under $(CPYTHON_WORKDIR)/Doc/locales/pot .PHONY: pot pot: setup - $(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ + @$(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ PYTHON=$(PYTHON) \ ALLSPHINXOPTS='-E -b gettext \ @@ -134,42 +135,46 @@ pot: setup # the translation files copy which could have new/updated files. .PHONY: setup setup: venv - # Setup the main clone - if ! [ -d $(CPYTHON_PATH) ]; then \ + @if ! [ -d $(CPYTHON_PATH) ]; then \ + echo "CPython repo not found; cloning ..."; \ git clone --depth 1 --branch $(BRANCH) $(UPSTREAM) $(CPYTHON_PATH); \ else \ + echo "CPython repo found; updating ..."; \ git -C $(CPYTHON_PATH) pull --rebase; \ fi - # Setup the current work directory - if ! [ -d $(CPYTHON_WORKDIR) ]; then \ + @if ! [ -d $(CPYTHON_WORKDIR) ]; then \ + echo "Setting up CPython repo in workdir ..."; \ rm -fr $(WORKDIRS); \ mkdir -p $(WORKDIRS); \ git clone $(CPYTHON_PATH) $(CPYTHON_WORKDIR); \ $(MAKE) -C $(CPYTHON_WORKDIR)/Doc \ VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ PYTHON=$(PYTHON) venv; \ + else \ + echo "CPython repo already ready in workdir"; \ fi - # Setup translation files - if ! [ -d $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/ ]; then \ + @echo "Setting up translation files in workdir ..." + @if ! [ -d $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/ ]; then \ mkdir -p $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/; \ - fi; \ - cp --parents *.po **/*.po $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/ \ + fi + @cp --parents *.po **/*.po $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/ # venv: create a virtual environment which will be used by almost every # other target of this script .PHONY: venv venv: - if [ ! -d $(VENV) ]; then \ + @echo "Setting up $(LANGUAGE_TEAM)'s virtual environment ..."; + @if [ ! -d $(VENV) ]; then \ $(PYTHON) -m venv --prompt $(LANGUAGE_TEAM) $(VENV); \ fi - $(VENV)/bin/python -m pip install -q -r requirements.txt 2> $(VENV)/pip-install.log + @$(VENV)/bin/python -m pip install -q -r requirements.txt 2> $(VENV)/pip-install.log - if grep -q 'pip install --upgrade pip' $(VENV)/pip-install.log; then \ - $(VENV)/bin/pip install -q --upgrade pip; \ + @if grep -q 'pip install --upgrade pip' $(VENV)/pip-install.log; then \ + $(VENV)/bin/pip install -q --upgrade pip; \ fi @@ -177,7 +182,7 @@ venv: # Makefile's "serve" target. Run "build" before using this target. .PHONY: serve serve: - $(MAKE) -C $(CPYTHON_WORKDIR)/Doc serve + @$(MAKE) -C $(CPYTHON_WORKDIR)/Doc serve # list files for spellchecking From fc624b17b4e5a06bb7b8b61ce2bb6905af810614 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 09:14:42 -0300 Subject: [PATCH 04/11] Makefile: Reorganize venv --- Makefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 913adc624..87aa018d0 100644 --- a/Makefile +++ b/Makefile @@ -166,16 +166,12 @@ setup: venv # other target of this script .PHONY: venv venv: - @echo "Setting up $(LANGUAGE_TEAM)'s virtual environment ..."; - @if [ ! -d $(VENV) ]; then \ - $(PYTHON) -m venv --prompt $(LANGUAGE_TEAM) $(VENV); \ - fi - - @$(VENV)/bin/python -m pip install -q -r requirements.txt 2> $(VENV)/pip-install.log - - @if grep -q 'pip install --upgrade pip' $(VENV)/pip-install.log; then \ - $(VENV)/bin/pip install -q --upgrade pip; \ + @if [ ! -d $(VENV) ]; then \ + echo "Setting up $(LANGUAGE_TEAM)'s virtual environment ..."; \ + $(PYTHON) -m venv --prompt $(LANGUAGE_TEAM) $(VENV); \ + $(VENV)/bin/python -m pip install --upgrade pip; \ fi + @$(VENV)/bin/pip install --upgrade --requirement requirements.txt # serve: serve the documentation in a simple local web server, using cpython From fd4afdcf8855b909f196b9851bb06ab6fac4034c Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 09:25:34 -0300 Subject: [PATCH 05/11] Makefile: reorganize variables Reorganize variables, adding documentation to them --- Makefile | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 87aa018d0..1bf6e8c07 100644 --- a/Makefile +++ b/Makefile @@ -5,27 +5,41 @@ # based on: https://github.com/python/python-docs-fr/blob/3.8/Makefile # +################# # Configuration -CPYTHON_PATH := ../cpython -BRANCH := 3.8 +# Main translation branch; please make sure it matches 'python-newest' +# project's version in 'python-docs' organization in Transifex +BRANCH := $(shell git branch --show-current) + +# Branches representing docs for older Python versions, which current +# translations should be merged into MERGEBRANCHES := 3.7 3.6 2.7 + +# Name of language team; should be python-docs-LANG, where LANG is the +# IETF language tag for your language; see Language Tag section in PEP 545 LANGUAGE_TEAM := python-docs-pt-br -LANGUAGE := pt_BR -# Internal variables +# Language code in ISO 639; see Language Tag section in PEP 545, and +# Sphinx configuration's supported languages +LANGUAGE := pt_BR +# Paths and URLs UPSTREAM := https://github.com/python/cpython -VENV := $(shell realpath ./venv) PYTHON := $(shell which python3) +CPYTHON_PATH := $(shell realpath ../cpython) +POSPELL_TMP_DIR := .pospell +VENV := $(shell realpath ./venv) WORKDIRS := $(VENV)/workdirs CPYTHON_WORKDIR := $(WORKDIRS)/cpython LOCALE_DIR := $(WORKDIRS)/locale + +# Settings for 'build' target JOBS := auto SPHINXERRORHANDLING := "-W" -TRANSIFEX_PROJECT := python-newest -POSPELL_TMP_DIR := .pospell +# +################# .PHONY: help help: @@ -98,6 +112,7 @@ pull: venv # reading pot files generated, then tweak this config file to # LANGUAGE. .PHONY: tx-config +tx-config: TRANSIFEX_PROJECT := python-newest tx-config: pot @cd $(CPYTHON_WORKDIR)/Doc/locales; \ rm -rf .tx; \ @@ -181,16 +196,15 @@ serve: @$(MAKE) -C $(CPYTHON_WORKDIR)/Doc serve -# list files for spellchecking -SRCS := $(wildcard *.po **/*.po) -DESTS = $(addprefix $(POSPELL_TMP_DIR)/out/,$(patsubst %.po,%.txt,$(SRCS))) - - # spell: run spell checking tool in all po files listed in SRCS variable, # storing the output in text files DESTS for proofreading. The # DESTS target run the spellchecking, while the typos.txt target # gather all reported issues in one file, sorted without redundancy .PHONY: spell + +SRCS := $(wildcard *.po **/*.po) +DESTS = $(addprefix $(POSPELL_TMP_DIR)/out/,$(patsubst %.po,%.txt,$(SRCS))) + spell: venv $(DESTS) $(POSPELL_TMP_DIR)/typos.txt $(POSPELL_TMP_DIR)/out/%.txt: %.po dict From a8ed9bda387b62260e76db8afbe3058ecca0dbc8 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 09:29:38 -0300 Subject: [PATCH 06/11] Makefile: Adjust targets' documentation --- Makefile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 1bf6e8c07..78f7c6aeb 100644 --- a/Makefile +++ b/Makefile @@ -79,9 +79,9 @@ build: setup "or run 'make serve' to see them in http://localhost:8000"; -# push: push new translation files and Transifex config files to repository, -# if any. Do nothing if there is no file changes. If GITHUB_TOKEN is set, -# then assumes we are in GitHub Actions, requiring different push args +# push: push changed translation files and Transifex config file to repository. +# Do nothing if there is no file changes. If GITHUB_TOKEN is set, then +# assumes we are in GitHub Actions, requiring different push args. .PHONY: push push: @if ! git status -s | egrep '\.po|\.tx/config'; then \ @@ -109,8 +109,7 @@ pull: venv # tx-config: After running "pot", create a new Transifex config file by -# reading pot files generated, then tweak this config file to -# LANGUAGE. +# reading pot files generated, then tweak it to LANGUAGE. .PHONY: tx-config tx-config: TRANSIFEX_PROJECT := python-newest tx-config: pot @@ -131,7 +130,7 @@ tx-config: pot # pot: After running "setup" target, run a cpython Makefile's target -# to generate .pot files under $(CPYTHON_WORKDIR)/Doc/locales/pot +# to generate .pot files under $(CPYTHON_WORKDIR)/Doc/locales/pot. .PHONY: pot pot: setup @$(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ @@ -178,7 +177,7 @@ setup: venv # venv: create a virtual environment which will be used by almost every -# other target of this script +# other target of this script. .PHONY: venv venv: @if [ ! -d $(VENV) ]; then \ @@ -199,7 +198,7 @@ serve: # spell: run spell checking tool in all po files listed in SRCS variable, # storing the output in text files DESTS for proofreading. The # DESTS target run the spellchecking, while the typos.txt target -# gather all reported issues in one file, sorted without redundancy +# gather all reported issues in one file, sorted without redundancy. .PHONY: spell SRCS := $(wildcard *.po **/*.po) @@ -239,8 +238,8 @@ $(MERGEBRANCHES): @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 +# 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 clean: rm -fr $(VENV) From c005789f0be10b68e37bd7ee696bc5ff12eae728 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 17:23:00 -0300 Subject: [PATCH 07/11] Makefile: no-single-branch cpython Doing shallow clone (--depth 1) didn't make possible to checkout other branches of CPython, which could be useful for using this script in other branches at some point, e.g. building Python docs. --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 78f7c6aeb..b1384d888 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ build: setup html @echo "Success! Open file://$(CPYTHON_WORKDIR)/Doc/build/html/index.html, " \ - "or run 'make serve' to see them in http://localhost:8000"; + "or run 'make serve' to see them in http://localhost:8000"; # push: push changed translation files and Transifex config file to repository. @@ -151,9 +151,11 @@ pot: setup setup: venv @if ! [ -d $(CPYTHON_PATH) ]; then \ echo "CPython repo not found; cloning ..."; \ - git clone --depth 1 --branch $(BRANCH) $(UPSTREAM) $(CPYTHON_PATH); \ + git clone --depth 1 --no-single-branch $(UPSTREAM) $(CPYTHON_PATH); \ + git -C $(CPYTHON_PATH) checkout $(BRANCH); \ else \ echo "CPython repo found; updating ..."; \ + git -C $(CPYTHON_PATH) checkout $(BRANCH); \ git -C $(CPYTHON_PATH) pull --rebase; \ fi @@ -166,7 +168,7 @@ setup: venv VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ PYTHON=$(PYTHON) venv; \ else \ - echo "CPython repo already ready in workdir"; \ + echo "CPython repo already ready in workdir"; \ fi @echo "Setting up translation files in workdir ..." From 35d44698fd2d53ef4f3c9d0e1337224c3aa27077 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 17:23:25 -0300 Subject: [PATCH 08/11] workflow: update modules, do not set python version Now going to use latest python version (3.8) --- .github/workflows/pythonpackage.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 942050e0a..4e544e010 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,8 +13,6 @@ jobs: runs-on: ubuntu-latest strategy: max-parallel: 4 - matrix: - python-version: [3.7] steps: - uses: actions/checkout@v2 @@ -24,9 +22,7 @@ jobs: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} + uses: actions/setup-python@v2 - name: Install dependencies via package manager run: | @@ -45,7 +41,7 @@ jobs: - name: If failed, make the log file an artifact if: failure() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: pip-install-log path: venv/pip-install.log From 49bc17f5dae2bee4dd0bed301f41a17fb277202e Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 10 May 2020 17:23:54 -0300 Subject: [PATCH 09/11] workflow: reorganize instructions - Rename workflow name to 'python-docs-pt-br CI', as it makes more sense than the generic 'Build and update documentation' - Separate jobs: rename main workflow from build to 'update'; and move 'merge', 'spell' and 'build' (warnings as errors) into separate jobs, called right next 'update' is done - Simplify 'run' calls, reducing 'name' and '--version' print (log file already has the version installed) - Remove pip-install-log artifact uploading, as the script does not generate this log anymore. - The 'build-warn-as-err' job create an artifact containing log files if job has failed --- .github/workflows/pythonpackage.yml | 132 +++++++++++++++++----------- 1 file changed, 83 insertions(+), 49 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4e544e010..16730c4e2 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -1,13 +1,19 @@ -name: Build and update documentation +name: python-docs-pt-br CI # Daily at 0 am -on: - schedule: - - cron: '0 0 * * *' +#on: +# schedule: +# - cron: '0 0 * * *' +on: push + +# Branch where translation takes place +env: + BRANCH: 3.8 jobs: - build: + # Job to pull, build and push translations from Transifex to the repository + update: if: (github.event_name == 'schedule' && github.repository == 'python/python-docs-pt-br') || (github.event_name != 'schedule') runs-on: ubuntu-latest @@ -17,40 +23,14 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: 3.8 - - run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + ref: ${{ env.BRANCH }} - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - uses: actions/setup-python@v2 + - run: sudo apt update + - run: sudo apt install -y gettext + - run: make tx-config - - name: Install dependencies via package manager - run: | - sudo apt update - sudo apt install -y gettext hunspell hunspell-pt-br - msgfmt -V - hunspell -v - - - name: Prepare virtual environment - run: | - make venv - venv/bin/pip --version - venv/bin/tx --version - venv/bin/sphinx-intl --help - venv/bin/powrap --version - - - name: If failed, make the log file an artifact - if: failure() - uses: actions/upload-artifact@v2 - with: - name: pip-install-log - path: venv/pip-install.log - - - name: Recreate an up-to-date project .tx/config - run: | - make tx-config - - - name: Update translations from Transifex + - name: Run make pull run: | if [[ -n "$TRANSIFEX_APIKEY" ]]; then echo -e "[https://www.transifex.com]\n" \ @@ -65,11 +45,9 @@ jobs: env: TRANSIFEX_APIKEY: ${{ secrets.TRANSIFEX_APIKEY }} - - name: Build documentation - run: | - make build CPYTHON_PATH=/tmp/cpython/ SPHINXERRORHANDLING='' + - run: make build CPYTHON_PATH=/tmp/cpython/ SPHINXERRORHANDLING='' - - name: Push translations + - name: Run make push run: | git config user.email "github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" @@ -77,23 +55,79 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check spelling of translations + # Job to check spelling of translations + spellcheck: + needs: update + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ env.BRANCH }} + + - uses: actions/setup-python@v2 + - run: sudo apt update + - run: sudo apt install -y gettext hunspell hunspell-pt-br + + - name: Run make spell run: | make spell cd .pospell/ tar -czf ../pospell-out.tar.gz *.txt **/*.txt - - name: Make spellchecking output available - uses: actions/upload-artifact@v1 + - name: Update artifact spellchecking-output + uses: actions/upload-artifact@v2 with: name: spellchecking-output path: pospell-out.tar.gz - - name: Merge translations with older branches - run: make merge + # Job to merge translation from current BRANCH to older ones + merge: + needs: update + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ env.BRANCH }} + + - run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + + - uses: actions/setup-python@v2 + - run: sudo apt update + - run: sudo apt install -y gettext + + - name: Run make push + run: | + git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + make merge env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build documentation treating warnings as errors - run: | - make build CPYTHON_PATH=/tmp/cpython/ + # Job to build translated documentation treating warnings as errors + build-warn-as-err: + needs: update + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ env.BRANCH }} + + - uses: actions/setup-python@v2 + - run: make build CPYTHON_PATH=/tmp/cpython/ 2> >(tee -a build-log.txt >&2) + + - name: Update artifact spellchecking-output + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: build-output + path: build-log.txt From d0f57e8bcc6ffeb42cf0863709983c1ed3783381 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 11 May 2020 16:12:05 +0000 Subject: [PATCH 10/11] Update translations from Transifex --- library/importlib.po | 2 +- library/stdtypes.po | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/library/importlib.po b/library/importlib.po index 67cf54dd5..77a27d872 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -1546,7 +1546,7 @@ msgstr "" #: ../../library/importlib.rst:1311 msgid "(``__loader__``)" -msgstr "" +msgstr "(``__loader__``)" #: ../../library/importlib.rst:1313 msgid "" diff --git a/library/stdtypes.po b/library/stdtypes.po index 58cf67245..825962c25 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -10,9 +10,9 @@ # (Douglas da Silva) , 2017 # Raphael Mendonça, 2017 # Claudio Rogerio Carvalho Filho , 2017 -# Rafael Fontenelle , 2020 # Adorilson Bezerra , 2020 # Vinicius Gubiani Ferreira , 2020 +# Rafael Fontenelle , 2020 # #, fuzzy msgid "" @@ -21,7 +21,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-03-04 12:51+0000\n" "PO-Revision-Date: 2017-02-16 23:27+0000\n" -"Last-Translator: Vinicius Gubiani Ferreira , 2020\n" +"Last-Translator: Rafael Fontenelle , 2020\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/python-doc/" "teams/5390/pt_BR/)\n" "MIME-Version: 1.0\n" @@ -5701,6 +5701,8 @@ msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" +"Instâncias de :class:`set` e :class:`frozenset` fornecem as seguintes " +"operações:" #: ../../library/stdtypes.rst:4004 msgid "Return the number of elements in set *s* (cardinality of *s*)." @@ -5956,6 +5958,10 @@ msgid "" "value`` pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` " "or ``{4098: 'jack', 4127: 'sjoerd'}``, or by the :class:`dict` constructor." msgstr "" +"Dicionários podem ser criados posicionando uma lista de pares ``key: value`` " +"separados por vírgula dentro de chaves, por exemplo: ``{'jack': 4098, " +"'sjoerd': 4127}`` ou ``{4098: 'jack', 4127: 'sjoerd'}``, ou usando o " +"construtor de :class:`dict`." #: ../../library/stdtypes.rst:4188 msgid "" @@ -5991,6 +5997,10 @@ msgid "" "being added is already present, the value from the keyword argument replaces " "the value from the positional argument." msgstr "" +"Se argumentos nomeados são fornecidos, os argumentos nomeados e seus valores " +"são adicionados ao dicionário criado a partir do argumento posicional. Se " +"uma chave sendo adicionada já está presente, o valor do argumento nomeado " +"substitui o valor do argumento posicional." #: ../../library/stdtypes.rst:4206 msgid "" @@ -6003,6 +6013,9 @@ msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" +"Fornecer argumentos nomeados conforme no primeiro exemplo somente funciona " +"para chaves que são identificadores válidos no Python. Caso contrário, " +"quaisquer chaves válidas podem ser usadas." #: ../../library/stdtypes.rst:4221 msgid "" @@ -6048,6 +6061,9 @@ msgid "" "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" +"O exemplo acima mostra parte da implementação de :class:`collections." +"Counter`. Um método ``__missing__`` diferente é usado para :class:" +"`collections.defaultdict`." #: ../../library/stdtypes.rst:4263 msgid "Set ``d[key]`` to *value*." @@ -6108,6 +6124,9 @@ msgid "" "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" +"Retorna o valor para *key* se *key* está no dicionário, caso contrário " +"*default*. Se *default* não é fornecido, será usado o valor padrão ``None``, " +"de tal forma que este método nunca levanta um :exc:`KeyError`." #: ../../library/stdtypes.rst:4309 msgid "" From 8a188c88da0dcebad50a35e7667950596561d997 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 11 May 2020 16:20:47 -0300 Subject: [PATCH 11/11] workflow: rollback the workflow name --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 16730c4e2..ceed50299 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -1,4 +1,4 @@ -name: python-docs-pt-br CI +name: Build and update documentation # Daily at 0 am #on: