10000 Create branch 3.10 · python/python-docs-ja@9f4d5fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f4d5fd

Browse files
committed
Create branch 3.10
0 parents  commit 9f4d5fd

15 files changed

+319
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# issue および pull request について
2+
3+
ドキュメントの未訳の部分や誤訳を見付けて、issue や pull request を作ろうとしてくれた人達へ感謝いたします。
4+
5+
これまでの経緯により、issue は [python-doc-ja レポジトリの issues](https://github.com/python-doc-ja/python-doc-ja/issues)
6+
に集約することにしています。
7+
このレポジトリではなく、python-doc-ja レポジトリで issue の作成をお願いします。
8+
9+
このレポジトリは Transifex にある翻訳データから生成された .po ファイルを保存するためのものです。
10+
そのため pull request をマージしても、そのままでは Transifex には反映されません。
11+
(反映されているとしたら、それは管理者により手作業で Transifex に入力されているのです。)
12+
13+
現時点では pull request 自体を受け付けず、作成された pull request はマージせずに閉じることとしますので、悪しからず。
14+
(将来的に pull request を受け付けるようになる可能性はあります。)

.github/ISSUE_TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# issue および pull request について
2+
3+
ドキュメントの未訳の部分や誤訳を見付けて、issue や pull request を作ろうとしてくれた人達へ感謝いたします。
4+
5+
これまでの経緯により、issue は [python-doc-ja レポジトリの issues](https://github.com/python-doc-ja/python-doc-ja/issues)
6+
に集約することにしています。
7+
このレポジトリではなく、python-doc-ja レポジトリで issue の作成をお願いします。
8+
9+
このレポジトリは Transifex にある翻訳データから生成された .po ファイルを保存するためのものです。
10+
そのため pull request をマージしても、そのままでは Transifex には反映されません。
11+
(反映されているとしたら、それは管理者により手作業で Transifex に入力されているのです。)
12+
13+
現時点では pull request 自体を受け付けず、作成された pull request はマージせずに閉じることとしますので、悪しからず。
14+
(将来的に pull request を受け付けるようになる可能性はあります。)

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# issue および pull request について
2+
3+
ドキュメントの未訳の部分や誤訳を見付けて、issue や pull request を作ろうとしてくれた人達へ感謝いたします。
4+
5+
これまでの経緯により、issue は [python-doc-ja レポジトリの issues](https://github.com/python-doc-ja/python-doc-ja/issues)
6+
に集約することにしています。
7+
このレポジトリではなく、python-doc-ja レポジトリで issue の作成をお願いします。
8+
9+
このレポジトリは Transifex にある翻訳データから生成された .po ファイルを保存するためのものです。
10+
そのため pull request をマージしても、そのままでは Transifex には反映されません。
11+
(反映されているとしたら、それは管理者により手作業で Transifex に入力されているのです。)
12+
13+
現時点では pull request 自体を受け付けず、作成された pull request はマージせずに閉じることとしますので、悪しからず。
14+
(将来的に pull request を受け付けるようになる可能性はあります。)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Delete docs built with PR
2+
3+
on:
4+
pull_request:
5+
branches: [ "3.9" ]
6+
types:
7+
- closed # PR closed
8+
9+
jobs:
10+
delete_pr_docs:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Prepare environment variables
15+
run: |
16+
ref=${GITHUB_REF#refs/pull/}
17+
pr_num=${ref%/merge}
18+
19+
echo "::set-env name=PR_NUM::${pr_num}"
20+
echo "::set-env name=PR_BUILD_ID::${GITHUB_BASE_REF}/${pr_num}"
21+
echo "::set-env name=DOCS_BASE_DIR::build/html"
22+
echo "::set-env name=DOCS_OUTPUT_DIR::build/html/${GITHUB_BASE_REF}/${pr_num}"
23+
24+
- name: Checkout GitHub Pages
25+
uses: actions/checkout@v2
26+
with:
27+
ref: gh-pages
28+
path: build/html
29+
30+
- name: Delete docs
31+
run: |
32+
cd ${GITHUB_WORKSPACE}/${DOCS_BASE_DIR}
33+
pwd
34+
git rm -r ${GITHUB_WORKSPACE}/${DOCS_OUTPUT_DIR}
35+
git config --local user.name "Autobuild bot on GitHub Actions"
36+
git config --local user.email "githubaction-build-bot@example.com"
37+
pwd
38+
git add .
39+
# if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi
40+
git commit -m "Delete docs, branch: ${GITHUB_BASE_REF} pr_num: ${PR_NUM}"
41+
git push --quiet "https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" gh-pages:gh-pages
42+

.github/workflows/pr_build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: PR build for ver 3.8
2+
3+
on:
4+
pull_request:
5+
branches: [ "3.9" ]
6+
types:
7+
- opened # open PR
8+
- synchronize # update the branch which pulled from
9+
- reopened # re-open PR
10+
11+
jobs:
12+
pr_build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Prepare environment variables
17+
run: |
18+
ref=${GITHUB_REF#refs/pull/}
19+
pr_num=${ref%/merge}
20+
21+
echo "::set-env name=PR_BUILD_ID::${GITHUB_BASE_REF}/${pr_num}"
22+
echo "::set-env name=DOCS_BASE_DIR::build/html"
23+
echo "::set-env name=DOCS_OUTPUT_DIR::build/html/${GITHUB_BASE_REF}/${pr_num}"
24+
25+
- name: Checkout cpython repository
26+
uses: actions/checkout@v2
27+
with:
28+
repository: python-doc-ja/cpython-doc-catalog
29+
ref: catalog-3.8
30+
path: cpython
31+
32+
33+
- name: Checkout PR branch
34+
uses: actions/checkout@v2
35+
with:
36+
ref: ${{ github.ref }}
37+
path: cpython/Doc/locales/ja/LC_MESSAGES
38+
39+
- name: Checkout GitHub Pages
40+
uses: actions/checkout@v2
41+
with:
42+
ref: gh-pages
43+
path: build/html
44+
45+
- name: Install dependencies
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y --no-install-recommends python3-venv
49+
50+
- name: Build docs
51+
run: |
52+
cd cpython/Doc
53+
make venv
54+
rm -rf ${DOCS_OUTPUT_DIR}
55+
make build ALLSPHINXOPTS="-b html -D language=ja -D gettext_compact=0 -E -d build/doctrees . ${GITHUB_WORKSPACE}/${DOCS_OUTPUT_DIR}"
56+
ls -l ${GITHUB_WORKSPACE}/${DOCS_OUTPUT_DIR}
57+
58+
- name: Publish docs
59+
run: |
60+
cd ${GITHUB_WORKSPACE}/${DOCS_BASE_DIR}
61+
git config --local user.name "Autobuild bot on GitHub Actions"
62+
git config --local user.email "githubaction-build-bot@example.com"
63+
git add .
64+
if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi
65+
git commit -m 'update html'
66+
git push --quiet "https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" gh-pages:gh-pages
67+
68+
- name: Notify the URL of the built docs
69+
uses: thollander/actions-comment-pull-request@master
70+
with:
71+
message: 'Please check the built documentation!!! https://python.github.io/python-docs-ja/${{ env.PR_BUILD_ID }}'
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
secrets_3.10.tar

.travis.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
dist: bionic
2+
language: python
3+
python: '3.8'
4+
branches:
5+
only:
6+
- 3.9
7+
env:
8+
global:
9+
# branch name of python-docs-ja repository
10+
- DOCS_BRANCH=3.9
11+
# branch name of cpython repository
12+
- CPYTHON_BRANCH=3.9
13+
# branch name of cpython-doc-catalog repository
14+
- CATALOG_BRANCH=catalog-3.9
15+
# Transifex project name
16+
- TRANSIFEX_PROJECT=python-39
17+
# Directory where repositories are cloned
18+
- BASEDIR="$(dirname ${TRAVIS_BUILD_DIR})"
19+
# Number of parent commits
20+
- NUM_PARENTS=$(git log --pretty=%P -n 1 HEAD | awk '{ print NF }')
21+
install:
22+
- pip install sphinx
23+
- pip install blurb
24+
- pip install transifex-client
25+
- pip install sphinx-intl
26+
before_script:
27+
- build_type=$(bash ${TRAVIS_BUILD_DIR}/scripts/determine-build-type)
28+
- export build_type
29+
script:
30+
- bash ${TRAVIS_BUILD_DIR}/scripts/${build_type}/main.sh

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Repository to store PO Files
2+
3+
https://www.python.org/dev/peps/pep-0545/#repository-for-po-files
4+
5+
Please see [CONTRIBUTING.md](.github/CONTRIBUTING.md)

scripts/determine-build-type

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
if [[ "${TRAVIS_EVENT_TYPE}" == "push" ]]; then
5+
if [[ ${NUM_PARENTS} == 1 ]]; then
6+
echo push
7+
else
8+
echo pr-merge
9+
fi
10+
elif [[ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]]; then
11+
echo pr
12+
elif [[ "${TRAVIS_EVENT_TYPE}" == "api" ]]; then
13+
# do not build
14+
echo ""
15+
elif [[ "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then
16+
echo push
17+
fi

scripts/pr-merge/main.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# not yet implemented
5+
exit 0

scripts/pr/main.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# not yet implemented
5+
exit 0

scripts/push/main.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
bash ${TRAVIS_BUILD_DIR}/scripts/${build_type}/prepare-build_3.9
5+
bash ${TRAVIS_BUILD_DIR}/scripts/${build_type}/upload-catalog
6+
bash ${TRAVIS_BUILD_DIR}/scripts/${build_type}/renew-catalog-template

scripts/push/prepare-build_3.9

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
ls -la ${BASEDIR}
5+
git config --global user.email "travisci-build-bot@example.com"
6+
git config --global user.name "Autobuild bot on TravisCI"
7+
git checkout ${DOCS_BRANCH}
8+
9+
# extract secrets
10+
cd ~
11+
openssl aes-256-cbc -K ${encryption_39_K} -iv ${encryption_39_iv} -in "${BASEDIR}/python-docs-ja/secrets_${DOCS_BRANCH}.tar.enc" -out ~/secrets_${DOCS_BRANCH}.tar -d
12+
tar xvf ~/secrets_${DOCS_BRANCH}.tar
13+
rm ~/secrets_${DOCS_BRANCH}.tar
14+
chmod 600 ~/.ssh/python-docs-ja_${DOCS_BRANCH}
15+
chmod 600 ~/.ssh/cpython-doc-catalog_${CATALOG_BRANCH}
16+
17+
# enable using plural deploy keys for repositories
18+
# Hack from: https://gist.github.com/jamesmcfadden/d379e04e7ae2861414886af189ec59e5
19+
cat <<EOF >> ~/.ssh/config
20+
Host python-docs-ja.github.com
21+
HostName github.com
22+
IdentityFile ~/.ssh/python-docs-ja_${DOCS_BRANCH}
23+
StrictHostKeyChecking no
24+
25+
Host cpython-doc-catalog.github.com
26+
HostName github.com
27+
IdentityFile ~/.ssh/cpython-doc-catalog_${CATALOG_BRANCH}
28+
StrictHostKeyChecking no
29+
EOF
30+
31+
cat ~/.ssh/config

scripts/push/renew-catalog-template

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# merge from upstream
5+
cd "${BASEDIR}"/cpython-doc-catalog
6+
git remote add upstream https://github.com/python/cpython.git
7+
git remote -v
8+
git fetch --quiet upstream
9+
git merge --no-ff upstream/${CPYTHON_BRANCH} -m "Merge remote-tracking branch 'upstream/${CPYTHON_BRANCH}' into ${CATALOG_BRANCH} by Autobuild bot on TravisCI"
10+
11+
# generate catalog
12+
cd Doc
13+
make build ALLSPHINXOPTS="-E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot"
14+
ls -lt locales/pot
15+
16+
# upload catalog templates to cpython-doc-catalog
17+
cd locales
18+
git add pot
19+
git status
20+
if [[ $(git status --short | wc -l) == 0 ]]; then
21+
echo "no .pot file to update"
22+
exit 0
23+
fi
24+
25+
echo "I have .pot file(s) to upload"
26+
27+
rm -rf .tx
28+
sphinx-intl create-txconfig
29+
sphinx-intl update-txconfig-resources --transifex-project-name=${TRANSIFEX_PROJECT} --locale-dir . --pot-dir pot
30+
tx push --source --parallel
31+
git add .tx
32+
git commit --message="[skip ci] Update .pot files and .tx/config"
33+
git push --quiet "git@cpython-doc-catalog.github.com:python-doc-ja/cpython-doc-catalog.git" ${CATALOG_BRANCH}:${CATALOG_BRANCH}

scripts/push/upload-catalog

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# clone an additional repository
5+
cd "${BASEDIR}"
6+
git clone --branch ${CATALOG_BRANCH} https://github.com/python-doc-ja/cpython-doc-catalog.git cpython-doc-catalog
7+
mkdir -p "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja
8+
cd "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja
9+
ln -s "${BASEDIR}"/python-docs-ja LC_MESSAGES
10+
ls -lF LC_MESSAGES
11+
12+
# upload catalogs to python-docs-ja
13+
cd "${BASEDIR}"/cpython-doc-catalog/Doc/locales
14+
if [ ! -e .tx/config ]; then
15+
echo ".tx/config does not exist. Skip uploading catalogs to python-docs-ja"
16+
exit 0
17+
fi
18+
19+
tx pull --force --language ja --parallel
20+
cd ja/LC_MESSAGES
21+
git add *.po **/*.po
22+
git status
23+
if [[ $(git status --short | wc -l) == 0 ]]; then
24+
echo "no .po file to upload"
25+
else
26+
echo "I have .po file(s) to upload"
27+
git commit --message="[skip ci] Update .po files"
28+
git push --quiet "git@python-docs-ja.github.com:python/python-docs-ja.git" ${DOCS_BRANCH}:${DOCS_BRANCH}
29+
fi
30+
rm -rf "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja

0 commit comments

Comments
 (0)
0