Skip to content

Commit 6cd68e1

Browse files
authored
New CI (python#64)
* Testing something new * test if it can catch * fix * Update CI * Update build.yml * Try using newer version of sphinx * revert * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Upcate CI * Make merge * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI
1 parent cc0aec9 commit 6cd68e1

File tree

492 files changed

+3885
-3449
lines changed

Some content is hidden

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

492 files changed

+3885
-3449
lines changed

.github/workflows/build.yml

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,75 @@
1-
name: Build
1+
name: Tests
22

33
on:
44
push:
55
branches:
6-
- "**"
6+
- '*.*'
77
pull_request:
8-
9-
env:
10-
CPYTHON_BRANCH: "3.10"
11-
LANGUAGE: "tr"
8+
branches:
9+
- '*.*'
1210

1311
jobs:
14-
test:
15-
name: Build
12+
checks:
13+
strategy:
14+
matrix:
15+
tool:
16+
- name: sphinx-lint
17+
package: sphinx-lint
18+
command: 'sphinx-lint --enable default-role --ignore .git'
19+
- name: Line length
20+
command: 'awk ''{if (length($0) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}'' $CHANGED_PO_FILES'
21+
22+
name: ${{ matrix.tool.name }} (${{ matrix.tool.package }})
1623
runs-on: ubuntu-latest
1724
steps:
1825
- uses: actions/checkout@v3
19-
- name: Set Up Python ${{ env.CPYTHON_BRANCH }}
20-
uses: actions/setup-python@v4
26+
- uses: lots0logs/gh-action-get-changed-files@2.1.4
27+
id: changed_files
2128
with:
22-
python-version: "${{ env.CPYTHON_BRANCH }}"
23-
- name: Get CPython
24-
run: |
25-
git clone https://github.com/python/cpython.git ../cpython --branch=${{ env.CPYTHON_BRANCH }}
26-
27-
- name: Install dependencies
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.10'
33+
- name: Install ${{ matrix.tool.package }}
2834
run: |
29-
sudo apt update
30-
sudo apt install -y gettext
31-
python -m pip install -r requirements.txt
32-
python -m pip install -r ../cpython/Doc/requirements.txt
33-
34-
- name: Sphinx lint
35+
if [ -n "${{ matrix.tool.apt_dependencies }}" ]; then
36+
sudo apt-get update && sudo apt-get install -y ${{ matrix.tool.apt_dependencies }}
37+
fi
38+
if [ -n "${{ matrix.tool.package }}" ]; then
39+
python -m pip install --upgrade pip setuptools wheel
40+
python -m pip install ${{ matrix.tool.package }}
41+
fi
42+
- name: Run ${{ matrix.tool.package }}
43+
env:
44+
ADDED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.added), ' ') }}
45+
MODIFIED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.modified), ' ') }}
3546
run: |
36-
sphinx-lint *.po */*.po
47+
CHANGED_PO_FILES=$(printf "%s %s\n" "$ADDED_FILES" "$MODIFIED_FILES" | tr ' ' '\n' | grep '.po$'; true)
48+
pwd
49+
tree -L 2
50+
if [ -n "$CHANGED_PO_FILES" ]
51+
then
52+
echo "Running on:" $CHANGED_PO_FILES
53+
${{ matrix.tool.command }}
54+
else
55+
echo "No changed po files, nothing to check."
56+
fi
3757
38-
- name: Build docs
58+
sphinx:
59+
name: 'Generate docs (sphinx)'
60+
runs-on: ubuntu-latest
61+
timeout-minutes: 30
62+
steps:
63+
- uses: actions/checkout@v3
64+
- uses: actions/setup-python@v4
65+
with:
66+
python-version: '3.10'
67+
- name: Prepare environment
3968
run: |
40-
make
69+
pwd
70+
tree -L 2
71+
git clone https://github.com/python/cpython.git venv/cpython/
72+
python -m pip install --upgrade pip setuptools wheel
73+
python -m pip install -r requirements.txt -r venv/cpython/Doc/requirements.txt
74+
- name: Make
75+
run: make

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ __pycache__/
77
*.pot
88
*.po.bak
99
locales/
10+
venv/
11+
.idea/
12+
.DS_Store
13+
.pospell/
14+
.potodo/
15+
.venv/

Makefile

Lines changed: 64 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# Makefile for tr Python Documentation
1+
# Makefile for Turkish Python Documentation
22
#
33
# Here is what you can do:
44
#
55
# - make # Automatically build an HTML local version
6-
# - make todo # To list remaining tasks
6+
# - make todo # To list remaining tasks and show current progression
77
# - make verifs # To check for correctness: wrapping, spelling
8-
# - make wrap # To check for wrapping
8+
# - make wrap # To rewrap modified files
99
# - make spell # To check for spelling
10-
# - make merge # To merge pot from upstream
10+
# - make clean # To remove build artifacts
1111
# - make fuzzy # To find fuzzy strings
12-
# - make progress # To compute current progression
1312
#
1413
# Modes are: autobuild-stable, autobuild-dev, and autobuild-html,
1514
# documented in gen/src/3.6/Doc/Makefile as we're only delegating the
@@ -21,14 +20,42 @@
2120
# from which we generated our po files. We use it here so when we
2221
# test build, we're building with the .rst files that generated our
2322
# .po files.
24-
CPYTHON_CURRENT_COMMIT := b027dd78bbdb66f2995bb898af304e66e5508bf6
25-
26-
CPYTHON_PATH := ../cpython/
27-
23+
CPYTHON_CURRENT_COMMIT := e699e5c20fc495952905597edfa82de0c1848f8c
2824
LANGUAGE := tr
2925
BRANCH := 3.10
3026

31-
EXCLUDED := whatsnew/ c-api/
27+
EXCLUDED := \
28+
whatsnew/2.?.po \
29+
whatsnew/3.[0-8].po \
30+
c-api/ \
31+
distutils/ \
32+
install/ \
33+
library/2to3.po \
34+
library/distutils.po \
35+
library/imp.po \
36+
library/tkinter.tix.po \
37+
library/test.po \
38+
library/aifc.po \
39+
library/asynchat.po \
40+
library/asyncore.po \
41+
library/audioop.po \
42+
library/cgi.po \
43+
library/cgitb.po \
44+
library/chunk.po \
45+
library/crypt.po \
46+
library/imghdr.po \
47+
library/msilib.po \
48+
library/nntplib.po \
49+
library/nis.po \
50+
library/ossaudiodev.po \
51+
library/pipes.po \
52+
library/smtpd.po \
53+
library/sndhdr.po \
54+
library/spwd.po \
55+
library/sunau.po \
56+
library/telnetlib.po \
57+
library/uu.po \
58+
library/xdrlib.po
3259

3360
# Internal variables
3461

@@ -38,6 +65,7 @@ PYTHON := $(shell which python3)
3865
MODE := html
3966
POSPELL_TMP_DIR := .pospell/
4067
JOBS := auto
68+
SERVE_PORT :=
4169

4270
# Detect OS
4371

@@ -58,89 +86,54 @@ endif
5886

5987
.PHONY: all
6088
all: ensure_prerequisites
61-
git -C $(CPYTHON_PATH) checkout $(CPYTHON_CURRENT_COMMIT)
89+
git -C venv/cpython checkout $(CPYTHON_CURRENT_COMMIT) || (git -C venv/cpython fetch && git -C venv/cpython checkout $(CPYTHON_CURRENT_COMMIT))
6290
mkdir -p locales/$(LANGUAGE)/LC_MESSAGES/
6391
$(CP_CMD) -u --parents *.po */*.po locales/$(LANGUAGE)/LC_MESSAGES/
64-
$(MAKE) -C $(CPYTHON_PATH)/Doc/ \
65-
SPHINXOPTS='-qW -j$(JOBS) \
92+
$(MAKE) -C venv/cpython/Doc/ \
93+
SPHINXOPTS='-j$(JOBS) \
6694
-D locale_dirs=$(abspath locales) \
6795
-D language=$(LANGUAGE) \
68-
-D gettext_compact=0 \
96+
-D gettext_compact=0 \
6997
-D latex_engine=xelatex \
7098
-D latex_elements.inputenc= \
7199
-D latex_elements.fontenc=' \
72100
$(MODE)
73-
git -C $(CPYTHON_PATH) checkout -
74-
@echo "Build success, open file://$(abspath $(CPYTHON_PATH))/Doc/build/html/index.html or run 'make serve' to see them."
101+
@echo "Build success, open file://$(abspath venv/cpython/)/Doc/build/html/index.html or run 'make serve' to see them."
102+
103+
104+
# We clone cpython/ inside venv/ because venv/ is the only directory
105+
# excluded by cpython' Sphinx configuration.
106+
venv/cpython/.git/HEAD:
107+
git clone https://github.com/python/cpython venv/cpython
75108

76109

77110
.PHONY: ensure_prerequisites
78-
ensure_prerequisites:
79-
@if [ -z $(CPYTHON_PATH) ]; then \
80-
echo "Your CPYTHON_PATH is empty, please provide one."; \
81-
exit 1; \
82-
fi
83-
@if ! [ -d $(CPYTHON_PATH) ]; then \
84-
echo "Building the translation requires a cpython clone."; \
85-
echo "Please provide the path to a clone using the CPYTHON_PATH variable."; \
86-
echo "(Currently CPYTHON_PATH is $(CPYTHON_PATH)."; \
87-
echo "So you may want to run:"; \
88-
echo ""; \
89-
echo " git clone $(UPSTREAM) $(CPYTHON_PATH)"; \
90-
exit 1; \
91-
fi
92-
@if [ -n "$$(git -C $(CPYTHON_PATH) status --porcelain)" ]; then \
93-
echo "Your cpython clone at $(CPYTHON_PATH) is not clean."; \
94-
echo "In order to avoid breaking things, please clean it first."; \
95-
exit 1; \
96-
fi
111+
ensure_prerequisites: venv/cpython/.git/HEAD
97112
@if ! (blurb help >/dev/null 2>&1 && sphinx-build --version >/dev/null 2>&1); then \
98-
git -C $(CPYTHON_PATH) checkout $(BRANCH); \
99-
echo "You're missing dependencies, please enable a venv and install:"; \
113+
git -C venv/cpython/ checkout $(BRANCH); \
114+
echo "You're missing dependencies please install:"; \
100115
echo ""; \
101-
echo " python -m pip install -r requirements.txt -r $(CPYTHON_PATH)/Doc/requirements.txt"; \
116+
echo " python -m pip install -r requirements.txt -r venv/cpython/Doc/requirements.txt"; \
102117
exit 1; \
103118
fi
104119

120+
105121
.PHONY: serve
106122
serve:
107-
$(MAKE) -C $(CPYTHON_PATH)/Doc/ serve
108-
109-
110-
.PHONY: progress
111-
progress:
112-
ifeq ($(file),)
113-
@echo "No file specified, showing total progress"; \
114-
$(PYTHON) -c 'import sys; print("{:.1%}".format(int(sys.argv[1]) / int(sys.argv[2])))' \
115-
$(shell msgcat *.po */*.po | msgattrib --translated | grep -c '^msgid') \
116-
$(shell msgcat *.po */*.po | grep -c '^msgid')
117-
123+
ifdef SERVE_PORT
124+
$(MAKE) -C venv/cpython/Doc/ serve SERVE_PORT=$(SERVE_PORT)
118125
else
119-
@$(PYTHON) -c 'import sys; print("{:.1%}".format(int(sys.argv[1]) / int(sys.argv[2])))' \
120-
$(shell msgcat $(file) | msgattrib --translated | grep -c '^msgid') \
121-
$(shell msgcat $(file) | grep -c '^msgid')
126+
$(MAKE) -C venv/cpython/Doc/ serve
122127
endif
123128

124-
125129
.PHONY: todo
126130
todo: ensure_prerequisites
127131
potodo --exclude venv .venv $(EXCLUDED)
128132

129133
.PHONY: wrap
130134
wrap: ensure_prerequisites
131-
ifeq ($(fix),)
132-
@echo "Verify wrapping"
133-
powrap --check --quiet *.po **/*.po
134-
135-
else
136-
ifeq ($(file),)
137-
@echo "Checking and fixing wrapping"
138-
powrap *.po **/*.po
139-
else
140-
@echo "Fixing wrapping in $(file)"
141-
powrap $(file)
142-
endif
143-
endif
135+
@echo "Re wrapping modified files"
136+
powrap -m
144137

145138
SRCS = $(shell git diff --name-only $(BRANCH) | grep '.po$$')
146139
# foo/bar.po => $(POSPELL_TMP_DIR)/foo/bar.po.out
@@ -152,41 +145,19 @@ spell: ensure_prerequisites $(DESTS)
152145
$(POSPELL_TMP_DIR)/%.po.out: %.po dict
153146
@echo "Pospell checking $<..."
154147
mkdir -p $(@D)
155-
pospell -p dict -l fr_FR $< && touch $@
148+
pospell -p dict -l tr_TR $< && touch $@
156149

157150
.PHONY: fuzzy
158151
fuzzy: ensure_prerequisites
159152
potodo -f --exclude venv .venv $(EXCLUDED)
160153

161154
.PHONY: verifs
162-
verifs: wrap spell
163-
164-
.PHONY: merge
165-
merge: ensure_prerequisites
166-
@echo "Merge from $(UPSTREAM)"
167-
git -C $(CPYTHON_PATH) checkout $(BRANCH)
168-
git -C $(CPYTHON_PATH) pull --ff-only
169-
(cd $(CPYTHON_PATH)/Doc; sphinx-build -Q -b gettext -D gettext_compact=0 . ../pot)
170-
find $(CPYTHON_PATH)/pot/ -name '*.pot' |\
171-
while read -r POT; \
172-
do \
173-
PO="./$$(echo "$$POT" | sed "s#$(CPYTHON_PATH)/pot/##; s#\.pot\$$#.po#")"; \
174-
mkdir -p "$$(dirname "$$PO")"; \
175-
if [ -f "$$PO" ]; \
176-
then \
177-
msgmerge --backup=off --force-po -U "$$PO" "$$POT"; \
178-
else \
179-
msgcat -o "$$PO" "$$POT"; \
180-
fi \
181-
done
182-
rm -fr $(CPYTHON_PATH)/pot/
183-
sed -i 's|^#: .*Doc/|#: |' *.po */*.po
184-
powrap -m
185-
@printf "\n%s %s\n" "Replace CPYTHON_CURRENT_COMMIT in Makefile by: " $(shell git -C $(CPYTHON_PATH) rev-parse HEAD)
186-
@printf 'To add, you can use:\n git status -s | grep "^ M .*\.po" | cut -d" " -f3 | while read -r file; do if [ $$(git diff "$$file" | wc -l) -gt 13 ]; then git add "$$file"; fi ; done\n'
155+
verifs: spell
187156

188157
.PHONY: clean
189158
clean:
190159
@echo "Cleaning *.mo and $(POSPELL_TMP_DIR)"
191-
rm -fr $(POSPELL_TMP_DIR)
160+
rm -rf $(POSPELL_TMP_DIR)
192161
find -name '*.mo' -delete
162+
@echo "Cleaning build directory"
163+
$(MAKE) -C venv/cpython/Doc/ clean

about.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Python Documentation Turkish Translation
22
# Copyright (C) 2001-2022, Python Software Foundation
33
# This file is distributed under the same license as the Python package.
4-
#
4+
#
55
msgid ""
66
msgstr ""
77
"Project-Id-Version: Python 3.10\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2022-12-02 04:25-0500\n"
9+
"POT-Creation-Date: 2022-12-05 18:31+0300\n"
1010
"PO-Revision-Date: 2021-12-17 21:04+0300\n"
1111
"Last-Translator: \n"
1212
"Language-Team: TURKISH <python.docs.tr@gmail.com>\n"

bugs.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Python Documentation Turkish Translation
22
# Copyright (C) 2001-2022, Python Software Foundation
33
# This file is distributed under the same license as the Python package.
4-
#
4+
#
55
msgid ""
66
msgstr ""
77
"Project-Id-Version: Python 3.10\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2022-12-02 04:25-0500\n"
9+
"POT-Creation-Date: 2022-12-05 18:31+0300\n"
1010
"PO-Revision-Date: 2021-12-17 22:58+0300\n"
1111
"Last-Translator: \n"
1212
"Language-Team: TURKISH <python.docs.tr@gmail.com>\n"

c-api/abstract.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Python Documentation Turkish Translation
22
# Copyright (C) 2001-2022, Python Software Foundation
33
# This file is distributed under the same license as the Python package.
4-
#
4+
#
55
#, fuzzy
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.10\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2021-12-17 23:20+0300\n"
10+
"POT-Creation-Date: 2022-12-05 18:31+0300\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: \n"
1313
"Language-Team: TURKISH <python.docs.tr@gmail.com>\n"

0 commit comments

Comments
 (0)