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

Commitd16bd17

Browse files
authored
Listar arquivo PO obsoletos (#136)
* Create list-obsolete.py* Add list-obsolete job to check.yml* Add list-obsolete.py to the list of path triggers in check.yml* Quit with error when at least one file from list-obsolete.py* Rename .github/prepmsg.sh to .github/scripts/prepmsg.sh* prepmsg.sh is now in scripts dir - check.yml* Make list-obsolete.py an executable* Remove obsolete files* Remove install/index.po
1 parent1474400 commitd16bd17

32 files changed

+67
-11481
lines changed

‎.github/scripts/list-obsolete.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
# List PO files that no longer have a corresponding page in Python docs
3+
4+
importos
5+
importos.path
6+
importsys
7+
importsubprocess
8+
9+
defrun(cmd):
10+
returnsubprocess.check_output(cmd,shell=True,text=True)
11+
12+
# Set POT root directory from command-line argument or hardcoded, then test it
13+
pot_root='cpython/Doc/locales/pot/'
14+
15+
iflen(sys.argv)>1:
16+
pot_root=sys.argv[0]
17+
18+
ifnotos.path.isdir(pot_root):
19+
print(f'Unable to find the POT directory{pot_root}')
20+
exit(1)
21+
22+
# List PO files tracked by git
23+
po_files=run('git ls-files | grep .po | tr "\n" " "').split()
24+
25+
# Compare po vs pot, store po without corresponding pot
26+
to_remove= []
27+
forfileinsorted(po_files):
28+
pot=os.path.join(pot_root,file+'t')
29+
ifnotos.path.isfile(pot):
30+
to_remove.append(file)
31+
32+
# Exit if no obsolete, or print obsoletes files.
33+
# If running in GitHub Actions, add a problem matcher to bring up the attention
34+
iflen(to_remove)==0:
35+
exit
36+
else:
37+
matcher=""
38+
if'CI'inos.environ:
39+
matcher='::error::'
40+
print(f'{matcher}The following files are absent in the documentation, hence they should be removed:\n')
41+
forfileinto_remove:
42+
print(f'{matcher} '+file)
43+
print("")
44+
exit(1)
File renamed without changes.

‎.github/workflows/check.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ on:
1010
-'3.12'
1111
paths:
1212
-'.github/workflows/check.yml'
13-
-'.github/prepmsg.sh'
13+
-'.github/scripts/prepmsg.sh'
14+
-'.github/scripts/list-obsolete.py'
1415
-'Makefile'
1516
-'requirements.txt'
1617
-'*.po'
@@ -20,7 +21,8 @@ on:
2021
-'3.12'
2122
paths:
2223
-'.github/workflows/check.yml'
23-
-'.github/prepmsg.sh'
24+
-'.github/scripts/prepmsg.sh'
25+
-'.github/scripts/list-obsolete.py'
2426
-'Makefile'
2527
-'requirements.txt'
2628
-'*.po'
@@ -73,7 +75,7 @@ jobs:
7375
-name:Prepare notification (only on error)
7476
if:steps.build.outcome == 'failure'
7577
id:prepare
76-
run:.github/prepmsg.sh logs/build/err*.txt logs/notify.txt
78+
run:.github/scripts/prepmsg.sh logs/build/err*.txt logs/notify.txt
7779
env:
7880
GITHUB_JOB:${{ github.job }}
7981
GITHUB_RUN_ID:${{ github.run_id }}
@@ -205,3 +207,21 @@ jobs:
205207
with:
206208
name:compendium
207209
path:compendium.po
210+
211+
# List PO files that no longer have a corresponding page in Python docs
212+
list-obsolete:
213+
runs-on:ubuntu-latest
214+
steps:
215+
-name:Check out ${{ github.repository }}
216+
uses:actions/checkout@v4.1.1
217+
218+
-name:Set up Python 3
219+
uses:actions/setup-python@v4.7.1
220+
with:
221+
python-version:'3'
222+
223+
-name:Generate POT files
224+
run:make pot
225+
226+
-name:List obsolete PO files, if any
227+
run:python3 .github/scripts/list-obsolete.py

‎distutils/_setuptools_disclaimer.po

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp