Skip to content

Commit a757a4b

Browse files
committed
Remove left-over files and add a script to warn about new ones
1 parent 826d2eb commit a757a4b

File tree

2 files changed

+15
-102
lines changed

2 files changed

+15
-102
lines changed

library/binhex.po

-101
This file was deleted.

manage_translation.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ def recreate_tx_config():
6868
contents = contents.replace('./<lang>/LC_MESSAGES/', '')
6969
with open('.tx/config', 'w') as file:
7070
file.write(contents)
71+
warn_about_files_to_delete()
72+
73+
def warn_about_files_to_delete():
74+
files = list(_get_files_to_delete())
75+
if not files:
76+
return
77+
warn(f'Found {len(files)} file(s) to delete: {", ".join(files)}.')
78+
79+
def _get_files_to_delete():
80+
with open('.tx/config') as config_file:
81+
config = config_file.read()
82+
for file in Path().rglob('*.po'):
83+
if os.fsdecode(file) not in config:
84+
yield os.fsdecode(file)
7185

7286

7387
def _clone_cpython_repo(version: str):
@@ -178,7 +192,7 @@ def language_switcher(entry: ResourceLanguageStatistics) -> bool:
178192

179193

180194
if __name__ == "__main__":
181-
RUNNABLE_SCRIPTS = ('fetch', 'recreate_tx_config')
195+
RUNNABLE_SCRIPTS = ('fetch', 'recreate_tx_config', 'warn_about_files_to_delete')
182196

183197
parser = ArgumentParser()
184198
parser.add_argument('cmd', choices=RUNNABLE_SCRIPTS)

0 commit comments

Comments
 (0)