Skip to content

Commit e4bee2a

Browse files
authored
Merge branch '3.9' into index
2 parents 657e006 + 3a35894 commit e4bee2a

File tree

229 files changed

+21776
-17674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+21776
-17674
lines changed

.github/workflows/ci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "3.7"
7+
- "3.8"
8+
- "3.9"
9+
10+
jobs:
11+
ci:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Install Dependencies
17+
run: sudo apt-get install gettext
18+
19+
- name: Build
20+
run: VERSION=${{ github.event.pull_request.base.ref }} make

.github/workflows/deploy-gh-page.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: deploy-gh-page
2+
3+
on:
4+
push:
5+
branches:
6+
- "3.9"
7+
8+
jobs:
9+
cd:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Install Dependencies
15+
run: sudo apt-get install gettext
16+
17+
- name: Build
18+
run: make
19+
20+
- name: Deploy to gh page
21+
uses: JamesIves/github-pages-deploy-action@3.7.1
22+
with:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
BRANCH: gh-pages
25+
FOLDER: ../cpython/Doc/build/html
26+
CLEAN: true
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: python-3.9-sync-with-cpython
2+
3+
on:
4+
push:
5+
branches:
6+
- "3.9"
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
jobs:
11+
sync:
12+
runs-on: ubuntu-latest
13+
env:
14+
VERSION: "3.9"
15+
BRANCH: "cron/sync/3.9"
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
ref: ${{ env.VERSION }}
20+
21+
- name: Get the changes on branch (if exists)
22+
continue-on-error: true
23+
run: |
24+
git fetch origin ${{ env.BRANCH }}:${{ env.BRANCH }}
25+
git reset --hard ${{ env.BRANCH }}
26+
27+
- name: Set env
28+
run: echo "LATEST_COMMIT_ID=$(git ls-remote https://github.com/python/CPython.git $VERSION | head -c 8)" >> $GITHUB_ENV
29+
30+
- name: Install Dependencies
31+
run: sudo apt-get install gettext
32+
33+
- name: Sync with CPython
34+
run: make clone && make merge && make rm_cpython
35+
36+
- uses: tibdex/github-app-token@v1
37+
id: generate-token
38+
with:
39+
app_id: ${{ secrets.APP_ID }}
40+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
41+
42+
- name: Create Pull Request
43+
id: cpr
44+
uses: peter-evans/create-pull-request@v3
45+
with:
46+
token: ${{ steps.generate-token.outputs.token }}
47+
commit-message: sync with cpython ${{ env.LATEST_COMMIT_ID }}
48+
committer: GitHub <noreply@github.com>
49+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
50+
base: ${{ env.VERSION }}
51+
branch: ${{ env.BRANCH }}
52+
delete-branch: false
53+
title: 'Sync with CPython ${{ env.VERSION }}'
54+
body: |
55+
Sync with CPython ${{ env.VERSION }}
56+
draft: true
57+
labels: |
58+
sync-cpython
59+
automation
60+
61+
- name: Check outputs
62+
run: |
63+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
64+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

Makefile

+11-7
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
2222
VENV := ~/.venvs/python-docs-i18n/
2323
PYTHON := $(shell which python3)
2424
MODE := autobuild-dev-html
25-
BRANCH = $(shell git describe --contains --all HEAD)
25+
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD))
2626
JOBS = 1
2727

2828

2929
.PHONY: all
30-
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb $(SPHINX_CONF)
30+
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone
3131
mkdir -p $(LC_MESSAGES)
3232
for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done
3333
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
3434
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)
3535

3636

37-
$(SPHINX_CONF):
38-
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE)
37+
clone:
38+
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists"
3939
cd $(CPYTHON_CLONE) && git checkout $(BRANCH)
4040

4141

@@ -84,11 +84,11 @@ endif
8484
if [ -f "$$PO" ];\
8585
then\
8686
case "$$POT" in\
87-
*whatsnew*) msgmerge --backup=off --force-po --no-fuzzy-matching -U "$$PO" "$$POT" ;;\
88-
*) msgmerge --backup=off --force-po -U "$$PO" "$$POT" ;;\
87+
*whatsnew*) msgmerge --lang=$(LANGUAGE) --backup=off --force-po --no-fuzzy-matching -U "$$PO" "$$POT" ;;\
88+
*) msgmerge --lang=$(LANGUAGE) --backup=off --force-po -U "$$PO" "$$POT" ;;\
8989
esac\
9090
else\
91-
msgcat -o "$$PO" "$$POT";\
91+
msgcat --lang=$(LANGUAGE) -o "$$PO" "$$POT";\
9292
fi\
9393
done
9494

@@ -104,3 +104,7 @@ update_txconfig:
104104
.PHONY: fuzzy
105105
fuzzy:
106106
for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr
107+
108+
.PHONY: rm_cpython
109+
rm_cpython:
110+
rm -rf $(CPYTHON_CLONE)

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Python 官方說明文件臺灣繁體中文翻譯計畫
1010

1111
翻譯之前,請務必詳讀並同意\ `授權與 License`_。參與方式請參考\ `參加翻譯`_。
1212

13-
您可以在 https://python-doc-tw.github.io/ 瀏覽目前翻譯的成果。
13+
您可以在 https://python.github.io/python-docs-zh-tw/ 瀏覽目前翻譯的成果。
1414

1515
想問問題、認識翻譯同好,歡迎加入 Telegram 聊天室 `t.me/PyDocTW`_
1616

0 commit comments

Comments
 (0)