1
0
mirror of https://github.com/KanjiVG/kanjivg.git synced 2025-12-25 10:20:20 +01:00
Files
kanjivg/clean.py
Ben Bullock cbb107dd08 Stripped file related changes
This adds an ignore, and a cleanup for the stripped directory, and
adds the zip file of stripped files to the release. It quietens
kvg.py. It adds a note on the stripped file to README.md.
2024-08-08 10:10:17 +09:00

37 lines
867 B
Python
Executable File

#!/usr/bin/env python
# This script removes unnecessary files such as backups from Emacs or
# old release files.
import os, glob, shutil
# Print debugging information if set to a true value.
verbose = True
# These files are generated by updatepublic.sh but are not part of the
# repository.
badFiles = glob.glob('kanjivg*.xml*')
badFiles.extend(glob.glob('kanjivg*.zip'))
for file in badFiles:
if os.path.exists(file):
if verbose:
print("Removing %s" % (file) )
os.remove(file)
# Emacs and possibly other editors create files with a ~ at the end
# for backup purposes.
emacsBackups = glob.glob('kanji/*~')
emacsBackups.extend(glob.glob('*~'))
emacsBackups.extend(glob.glob('.git/*~'))
for file in emacsBackups:
if verbose:
print("Removing %s" % (file) )
os.remove(file)
stripped = 'stripped'
if os.path.exists(stripped):
shutil.rmtree(stripped)