Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listar arquivo PO obsoletos #136

Merged
merged 9 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/scripts/list-obsolete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
# List PO files that no longer have a corresponding page in Python docs

import os
import os.path
import sys
import subprocess

def run(cmd):
return subprocess.check_output(cmd, shell=True, text=True)

# Set POT root directory from command-line argument or hardcoded, then test it
pot_root = 'cpython/Doc/locales/pot/'

if len(sys.argv) > 1:
pot_root = sys.argv[0]

if not os.path.isdir(pot_root):
print(f'Unable to find the POT directory {pot_root}')
exit(1)

# List PO files tracked by git
po_files = run('git ls-files | grep .po | tr "\n" " "').split()

# Compare po vs pot, store po without corresponding pot
to_remove = []
for file in sorted(po_files):
pot = os.path.join(pot_root, file + 't')
if not os.path.isfile(pot):
to_remove.append(file)

# Exit if no obsolete, or print obsoletes files.
# If running in GitHub Actions, add a problem matcher to bring up the attention
if len(to_remove) == 0:
exit
else:
matcher = ""
if 'CI' in os.environ:
matcher = '::error::'
print(f'{matcher}The following files are absent in the documentation, hence they should be removed:\n')
for file in to_remove:
print(f'{matcher} ' + file)
print("")
exit(1)
File renamed without changes.
26 changes: 23 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ on:
- '3.12'
paths:
- '.github/workflows/check.yml'
- '.github/prepmsg.sh'
- '.github/scripts/prepmsg.sh'
- '.github/scripts/list-obsolete.py'
- 'Makefile'
- 'requirements.txt'
- '*.po'
Expand All @@ -20,7 +21,8 @@ on:
- '3.12'
paths:
- '.github/workflows/check.yml'
- '.github/prepmsg.sh'
- '.github/scripts/prepmsg.sh'
- '.github/scripts/list-obsolete.py'
- 'Makefile'
- 'requirements.txt'
- '*.po'
Expand Down Expand Up @@ -73,7 +75,7 @@ jobs:
- name: Prepare notification (only on error)
if: steps.build.outcome == 'failure'
id: prepare
run: .github/prepmsg.sh logs/build/err*.txt logs/notify.txt
run: .github/scripts/prepmsg.sh logs/build/err*.txt logs/notify.txt
env:
GITHUB_JOB: ${{ github.job }}
GITHUB_RUN_ID: ${{ github.run_id }}
Expand Down Expand Up @@ -205,3 +207,21 @@ jobs:
with:
name: compendium
path: compendium.po

# List PO files that no longer have a corresponding page in Python docs
list-obsolete:
runs-on: ubuntu-latest
steps:
- name: Check out ${{ github.repository }}
uses: actions/[email protected]

- name: Set up Python 3
uses: actions/[email protected]
with:
python-version: '3'

- name: Generate POT files
run: make pot

- name: List obsolete PO files, if any
run: python3 .github/scripts/list-obsolete.py
35 changes: 0 additions & 35 deletions distutils/_setuptools_disclaimer.po

This file was deleted.

Loading