Merge branch 'manual_cleaning' of https://github.com/Luflosi/kitty

This commit is contained in:
Kovid Goyal 2019-06-24 08:36:52 +05:30
commit ba1c093d18
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -780,17 +780,6 @@ Categories=System;TerminalEmulator;
def clean():
os.chdir(os.path.dirname(os.path.abspath(__file__)))
if os.path.exists('.git'):
for f in subprocess.check_output(
'git ls-files --others --ignored --exclude-from=.gitignore'.split()
).decode('utf-8').splitlines():
if f.startswith('logo/kitty.iconset') or f.startswith('dev/'):
continue
os.unlink(f)
if os.sep in f and not os.listdir(os.path.dirname(f)):
os.rmdir(os.path.dirname(f))
return
# Not a git checkout, clean manually
def safe_remove(*entries):
for x in entries:
@ -801,7 +790,9 @@ def clean():
os.unlink(x)
safe_remove('build', 'compile_commands.json', 'linux-package', 'kitty.app')
for root, dirs, files in os.walk('.'):
exclude = ('.git',)
for root, dirs, files in os.walk('.', topdown=True):
dirs[:] = [d for d in dirs if d not in exclude]
remove_dirs = {d for d in dirs if d == '__pycache__'}
[(shutil.rmtree(os.path.join(root, d)), dirs.remove(d)) for d in remove_dirs]
for f in files: