From 7d5bef197ca958e813f1d36149aa417a4d81af31 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 15:04:02 -0300 Subject: [PATCH 1/8] fix: add newer sphinx-intl to requirements This version supports the new Transifex CLI tool --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c3212d3ac..92be5591c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -sphinx-intl +git+https://github.com/sphinx-doc/sphinx-intl@6b3913fea5a8c9b819818b9b28b6d0d0b6f022b3 powrap pomerge From e3307b172e933024e444010726d52f55b959a91d Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 15:05:39 -0300 Subject: [PATCH 2/8] chore: update actions versions --- .github/workflows/build.yml | 14 ++++++++------ .github/workflows/compendium.yml | 10 +++++----- .github/workflows/update.yml | 26 ++++++++++++++++---------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 477f87e56..9ffa533d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out ${{ github.repository }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: persist-credentials: false - run: echo ${{ inputs.was-called }} @@ -40,16 +40,18 @@ jobs: run: | git pull --rebase - name: Check out CPython - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: python/cpython persist-credentials: false ref: ${{ env.CPYTHON_BRANCH }} path: cpython - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' - name: Install dependencies run: | sudo apt update -y && sudo apt install gettext -y @@ -87,7 +89,7 @@ jobs: path: cpython/Doc/build/html - name: Upload artifact - logs if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build-logs path: logs/ diff --git a/.github/workflows/compendium.yml b/.github/workflows/compendium.yml index cb66d1484..35675300f 100644 --- a/.github/workflows/compendium.yml +++ b/.github/workflows/compendium.yml @@ -14,16 +14,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out ${{ github.repository }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: persist-credentials: false - if: github.event_name == 'workflow_call' run: | git pull --rebase - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Install dependencies run: | sudo apt update -y && sudo apt install gettext -y @@ -33,7 +33,7 @@ jobs: run: | pocompendium --correct compendium.po *.po **/*.po - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: compendium path: compendium.po diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 223fe1e07..1d42f08f8 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -25,22 +25,24 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out ${{ github.repository }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Check out CPython - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: python/cpython persist-credentials: false ref: ${{ env.CPYTHON_BRANCH }} path: cpython - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' - name: Install Transifex CLI run: | curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash - mv tx /usr/local/bin/tx + working-directory: /usr/local/bin - name: Install dependencies run: | sudo apt update -y && sudo apt install gettext -y @@ -85,15 +87,19 @@ jobs: run: echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV - name: Check out source branch (${{ env.CURRENT_BRANCH }}) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{ env.CURRENT_BRANCH }} persist-credentials: false - name: Check out target branch (${{ matrix.branch }}) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ matrix.branch }} path: ${{ matrix.branch }} + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' - name: Install dependencies run: | sudo apt update -y && sudo apt install gettext -y @@ -123,7 +129,7 @@ jobs: # Call the build workflow after updating name: call needs: [update] - uses: python/python-docs-pt-br/.github/workflows/build.yml@3.10 + uses: ./.github/workflows/build.yml with: was-called: yes secrets: @@ -134,4 +140,4 @@ jobs: # Call the compendium workflow after updating name: call needs: [update] - uses: python/python-docs-pt-br/.github/workflows/compendium.yml@3.10 + uses: ./.github/workflows/compendium.yml From e6dac7488198e0889ba99e2956549378e6989801 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 15:06:43 -0300 Subject: [PATCH 3/8] fix: several fixes to scripts - 'serve' target is not available in Python Docs, so use the htmlview commands as alternative to check docs - Pull translations into cpython sub-directory and then copy to langauge repository, as the previous patch in .tx/config no longer works with the new Transifex CLI tool - Use realpath in update.sh ROOTDIR to make it easier to go back to the repository root directory --- scripts/build.sh | 16 +++++++++------- scripts/update.sh | 29 +++++++++++++++-------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index ed7696ee9..d475b255b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -9,20 +9,22 @@ LANGUAGE=${1:-pt_BR} ROOTDIR="$(dirname $0)/.." -cd ${ROOTDIR} +cd "${ROOTDIR}" -test -f cpython/Doc/conf.py || ( echo Unable to find proper CPython Doc folder; exit 1; ) +if ! test -f cpython/Doc/conf.py; then + echo Unable to find proper CPython Doc folder + exit 1 +fi -pofiles=$(find . -maxdepth 2 -name '*.po' | sort -u) +pofiles=$(find . -maxdepth 2 -name '*.po' | sort -u | sed -i 's|\./||') for po in ${pofiles}; do install -Dm644 ${po} "cpython/Doc/locales/${LANGUAGE}/LC_MESSAGES/${po}" done -sphinx-build -b html -d build/doctrees -q --keep-going -jauto -D locale_dirs=locales -D language=pt_BR -D gettext_compact=0 -D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -W cpython/Doc cpython/Doc/build/html +sphinx-build -b html -d build/doctrees -n -a --keep-going -jauto -D locale_dirs=locales -D language=pt_BR -D gettext_compact=0 -D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -W cpython/Doc cpython/Doc/build/html if [ -z "$GITHUB_ACTIONS" ]; then - echo "See file:/$(realpath ${ROOTDIR})/cpython/Doc/build/html/index.html" - echo "or serve it in http://localhost:8080 by running:" - echo "python3 cpython/Tools/scripts/serve.py cpython/Doc/build/html" + echo 'See the built documentation by running the following command:' + echo 'python3 -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('cpython/Doc/build/html/index.html'))""' fi diff --git a/scripts/update.sh b/scripts/update.sh index 2e8eca3c2..d3b149078 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -7,11 +7,14 @@ set -e # Allow language being passed as 1st argument, defaults to pt_BR LANGUAGE=${1:-pt_BR} -ROOTDIR=$(dirname $0)/.. +ROOTDIR=$(realpath "$(dirname $0)/..") cd ${ROOTDIR} -test -f cpython/Doc/conf.py || ( echo Unable to find proper CPython Doc folder; exit 1; ) +if ! test -f cpython/Doc/conf.py; then + echo Unable to find proper CPython Doc folder + exit 1 +fi # Create POT Files cd cpython/Doc @@ -20,15 +23,13 @@ sphinx-build -E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot # Update CPython's .tx/config cd locales sphinx-intl create-txconfig -sphinx-intl update-txconfig-resources -p pot -d . --transifex-project-name python-newest - -# 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|/LC_MESSAGES/||' \ - -e "s|^file_filter|trans.${LANGUAGE}|" \ - > .tx/config - -tx pull --languages ${LANGUAGE} --translations --use-git-timestamps --parallel +sphinx-intl update-txconfig-resources -p pot -d . --transifex-organization-name python-doc --transifex-project-name python-newest + +# Pull translations into cpython/Doc/locales/LANGUAGE/LC_MESSAGES/ +tx pull -l ${LANGUAGE} -t --use-git-timestamps -f + +# 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 From 7296b5fef34ae109abd53f78e7b02085847bb189 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 24 Oct 2022 18:30:02 +0000 Subject: [PATCH 4/8] Update translations from Transifex --- library/2to3.po | 14 +++++++++++++- library/_thread.po | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/library/2to3.po b/library/2to3.po index 36eeb11e1..20e4b70f9 100644 --- a/library/2to3.po +++ b/library/2to3.po @@ -8,6 +8,7 @@ # Sheila Gomes , 2021 # Claudio Rogerio Carvalho Filho , 2021 # Octavio von Sydow , 2021 +# Loyanne Cristine , 2022 # #, fuzzy msgid "" @@ -16,7 +17,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-06-16 06:28+0000\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" -"Last-Translator: Octavio von Sydow , 2021\n" +"Last-Translator: Loyanne Cristine , 2022\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/python-doc/" "teams/5390/pt_BR/)\n" "MIME-Version: 1.0\n" @@ -572,6 +573,8 @@ msgid "" "Renames definitions of methods called :meth:`__nonzero__` to :meth:`~object." "__bool__`." msgstr "" +"Renomeia as definições de métodos chamados :meth:`__nonzero__` para :meth:" +"`~object.__bool__`." #: ../../library/2to3.rst:341 msgid "Converts octal literals into the new syntax." @@ -788,6 +791,15 @@ msgid "" "library in Python 3.13. Consider third-party alternatives such as `LibCST`_ " "or `parso`_." msgstr "" +"Python 3.9 mudou para um analisador GASE (veja :pep:`617`) enquanto lib2to3 " +"está usando um analisador LL(1) menos flexível. Python 3.10 inclui uma nova " +"sintaxe de linguagem não analisável pelo analisador LL(1) da lib2to3 (veja :" +"pep:`634`). O módulo ``lib2to3``foi marcado como pendente para " +"descontinuação na versão Python 3.9 (aumentando :exc:" +"`PendingDeprecationWarning` na importação) e totalmente obsoleto na versão " +"Python 3.11 (aumentando :exc:`DeprecationWarning`). Ele será removido da " +"biblioteca padrão na versão Python 3.13. Considere alternativas de terceiros " +"como `LibCST`_ ou `parso`_." #: ../../library/2to3.rst:480 msgid "" diff --git a/library/_thread.po b/library/_thread.po index 98425768e..01903b90e 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -10,6 +10,7 @@ # Marcos Jurach , 2021 # Fabio Aragao , 2021 # Rafael Fontenelle , 2021 +# Loyanne Cristine , 2022 # #, fuzzy msgid "" @@ -18,7 +19,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-06-16 06:28+0000\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" -"Last-Translator: Rafael Fontenelle , 2021\n" +"Last-Translator: Loyanne Cristine , 2022\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/python-doc/" "teams/5390/pt_BR/)\n" "MIME-Version: 1.0\n" @@ -114,22 +115,29 @@ msgid "" "use this function to interrupt the main thread, though there is no guarantee " "that the interruption will happen immediately." msgstr "" +"Simule o efeito de um sinal chegando na thread principal. Uma thread pode " +"usar esta função para interromper a thread principal, embora não haja " +"garantia de que a interrupção ocorrerá imediatamente." #: ../../library/_thread.rst:70 msgid "" "If given, *signum* is the number of the signal to simulate. If *signum* is " "not given, :data:`signal.SIGINT` is simulated." msgstr "" +"Se fornecido, *signum* é o número do sinal a ser simulado. Se *signum* não " +"for fornecido, :data:`signal.SIGINT` será simulado." #: ../../library/_thread.rst:73 msgid "" "If the given signal isn't handled by Python (it was set to :data:`signal." "SIG_DFL` or :data:`signal.SIG_IGN`), this function does nothing." msgstr "" +"Se o sinal fornecido não for tratado por Python (foi definido como :data:" +"`signal.SIG_DFL` ou :data:`signal.SIG_IGN`), esta função não faz nada." #: ../../library/_thread.rst:77 msgid "The *signum* argument is added to customize the signal number." -msgstr "" +msgstr "O argumento *signum* é adicionado para personalizar o sinal de número." #: ../../library/_thread.rst:81 msgid "" @@ -137,6 +145,9 @@ msgid "" "associated handler (if it exists). If you want to truly emit the signal, " "use :func:`signal.raise_signal`." msgstr "" +"Isso não emite o sinal correspondente, mas agenda uma chamada para o " +"tratador associado (se existir). Se você quer realmente emitir o sinal, use :" +"func:`signal.raise_signal`." #: ../../library/_thread.rst:88 msgid "" From 420c14b88c65e0cafafd01f74517129833ab5ecf Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 15:34:57 -0300 Subject: [PATCH 5/8] fix: use correct sed syntax --- scripts/build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index d475b255b..98d3a54f9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -16,9 +16,7 @@ if ! test -f cpython/Doc/conf.py; then exit 1 fi -pofiles=$(find . -maxdepth 2 -name '*.po' | sort -u | sed -i 's|\./||') - -for po in ${pofiles}; do +for po in $(find . -type f -name '*.po' | sort | sed 's|^\./||'); do install -Dm644 ${po} "cpython/Doc/locales/${LANGUAGE}/LC_MESSAGES/${po}" done From b3441240ab46bafa71f577d8ef05f61f27085c6d Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 15:46:01 -0300 Subject: [PATCH 6/8] chore: Do not commit on pull requests --- .github/workflows/update.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 1d42f08f8..9b1734760 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -58,7 +58,9 @@ jobs: run: | powrap --modified - name: Commit and push changes - if: github.repository == 'python/python-docs-pt-br' + if: | + github.repository == 'python/python-docs-pt-br' && + ! github.event_name == 'pull_request' run: | git config user.name github-actions git config user.email github-actions@github.com @@ -116,7 +118,9 @@ jobs: run: | powrap --modified -C ${{ matrix.branch }} - name: Commit and push changes - if: github.repository == 'python/python-docs-pt-br' + if: | + github.repository == 'python/python-docs-pt-br' && + ! github.event_name == 'pull_request' run: | cd ${{ matrix.branch }} git config user.name github-actions From 1107f2e0ff97a6b36974c130f1cd6461958a7b78 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 15:59:00 -0300 Subject: [PATCH 7/8] fix: Downgrade Python to 3.9 --- .github/workflows/build.yml | 4 ++-- .github/workflows/update.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ffa533d6..5cf155e8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,10 +46,10 @@ jobs: persist-credentials: false ref: ${{ env.CPYTHON_BRANCH }} path: cpython - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.9' cache: 'pip' cache-dependency-path: '**/requirements*.txt' - name: Install dependencies diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 9b1734760..beb9ad12f 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -33,10 +33,10 @@ jobs: persist-credentials: false ref: ${{ env.CPYTHON_BRANCH }} path: cpython - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.9' cache: 'pip' cache-dependency-path: '**/requirements*.txt' - name: Install Transifex CLI From ed3affb1eec99b0a00b01728cad366c8cd5551a2 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 24 Oct 2022 16:45:04 -0300 Subject: [PATCH 8/8] fix: drop sphinx nit-pick mode --- scripts/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.sh b/scripts/build.sh index 98d3a54f9..c32e98671 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -20,7 +20,7 @@ for po in $(find . -type f -name '*.po' | sort | sed 's|^\./||'); do install -Dm644 ${po} "cpython/Doc/locales/${LANGUAGE}/LC_MESSAGES/${po}" done -sphinx-build -b html -d build/doctrees -n -a --keep-going -jauto -D locale_dirs=locales -D language=pt_BR -D gettext_compact=0 -D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -W cpython/Doc cpython/Doc/build/html +sphinx-build -b html -d build/doctrees -a --keep-going -jauto -D locale_dirs=locales -D language=pt_BR -D gettext_compact=0 -D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -W cpython/Doc cpython/Doc/build/html if [ -z "$GITHUB_ACTIONS" ]; then echo 'See the built documentation by running the following command:'