Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff06042

Browse files
Improve ci (#40)
* Use new Transifex CLI toolThe Python implementation named transifex-client uses Transifex'sAPIv2, which is deprecated and will sunset in november 2022.The new tool, called Transifex CLI, is written in Golang and isAPIv3-ready. So adjusting the CI and requirements.txt is required.* Fix condition in the merge jobHaving the proper condition is important to have the translationupdate in the latest Python version (python-newest project), andthe condition wouldn't match the current repository.Co-authored-by: Maciej Olko <maciej.olko@affirm.com>* Update sphinx-intl required versionLast released sphinx-intl uses old transifex-client, which usesthe deprecated Transifex APIv2. There is a fix committed, butit is unreleased. So using specific commit where new TransifexCLI tool works.* Update script to work with the new TX commandPrevious solution of patching .tx/config does not work with thenew client, so the script had to be updated with new solution.Now, translations are pulled into a sub-directory of cpython, andthen installed in the languages's repository.Also using 'realpath' tool in ROOTDIR to retrieve absolute path,which actually eases referencing the repository root directory.* Update actions versionsOne of the reason is that some of them use node.js 12, which isnow deprecated. Actions is displaying warnings about it.v4 of setup-python is particular useful because it introducespackage caching, which reduces the time of workflow run.* Disable pushing translationsSource files auto-update is now done elsewhereCo-authored-by: Maciej Olko <maciej.olko@affirm.com>
1 parent5a36eec commitff06042

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

‎.github/workflows/update.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,24 @@ jobs:
2323
runs-on:ubuntu-latest
2424
steps:
2525
-name:Check out ${{ github.repository }}
26-
uses:actions/checkout@v2
26+
uses:actions/checkout@v3
2727
-name:Check out CPython
28-
uses:actions/checkout@v2
28+
uses:actions/checkout@v3
2929
with:
3030
repository:python/cpython
3131
persist-credentials:false
3232
ref:${{ env.CPYTHON_BRANCH }}
3333
path:cpython
3434
-name:Set up Python 3.9
35-
uses:actions/setup-python@v2
35+
uses:actions/setup-python@v4
3636
with:
3737
python-version:'3.9'
38+
cache:'pip'
39+
cache-dependency-path:'**/requirements*.txt'
40+
-name:Install Transifex CLI
41+
run:|
42+
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
43+
working-directory:/usr/local/bin
3844
-name:Install dependencies
3945
run:|
4046
sudo apt update -y && sudo apt install gettext -y
@@ -79,14 +85,20 @@ jobs:
7985
run:
8086
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
8187
-name:Check out source branch (${{ env.CURRENT_BRANCH }})
82-
uses:actions/checkout@v1
88+
uses:actions/checkout@v3
8389
with:
8490
path:${{ env.CURRENT_BRANCH }}
8591
-name:Check out target branch (${{ matrix.branch }})
86-
uses:actions/checkout@v2
92+
uses:actions/checkout@v3
8793
with:
8894
ref:${{ matrix.branch }}
8995
path:${{ matrix.branch }}
96+
-name:Set up Python 3.9
97+
uses:actions/setup-python@v4
98+
with:
99+
python-version:'3.9'
100+
cache:'pip'
101+
cache-dependency-path:'**/requirements*.txt'
90102
-name:Install dependencies
91103
run:|
92104
sudo apt update -y && sudo apt install gettext -y
@@ -103,7 +115,7 @@ jobs:
103115
run:|
104116
powrap --modified -C ${{ matrix.branch }}
105117
-name:Commit and push changes
106-
if:github.repository == 'rffontenelle/python-docs-pt-br'
118+
if:github.repository == 'python/python-docs-ja'
107119
run:|
108120
cd ${{ matrix.branch }}
109121
git config user.name github-actions

‎requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
transifex-client
21
sphinx
3-
sphinx-intl
2+
git+https://github.com/sphinx-doc/sphinx-intl@6b3913fea5a8c9b819818b9b28b6d0d0b6f022b3
43
powrap
54
pospell
65
pomerge

‎scripts/update.sh

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ set -e
77
# Allow language being passed as 1st argument, defaults to ja
88
LANGUAGE=${1:-ja}
99

10-
ROOTDIR=$(dirname$0)/..
10+
ROOTDIR=$(realpath"$(dirname$0)/..")
1111

12-
cd${ROOTDIR}
12+
cd"${ROOTDIR}"
1313

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

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

28-
if ["$CI"=true ]
29-
then
30-
tx push --source --no-interactive --skip
31-
fi
32-
33-
# Update the translation project's .tx/config
34-
cd ../../..# back to $ROOTDIR
35-
mkdir -p .tx
36-
sed cpython/Doc/locales/.tx/config \
37-
-e'/^source_file/d' \
38-
-e's|<lang>/LC_MESSAGES/||' \
39-
-e"s|^file_filter|trans.${LANGUAGE}|" \
40-
> .tx/config
28+
# Pull translations into cpython/Doc/locales/LANGUAGE/LC_MESSAGES/
29+
tx pull -l${LANGUAGE} -t --use-git-timestamps
4130

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp