Never delete any files in the .git directory when cleaning manually
This is how results can be removed from os.walk(), according to https://docs.python.org/3/library/os.html#os.walk.
This commit is contained in:
parent
0e1a423889
commit
3ea3a85694
4
setup.py
4
setup.py
@ -790,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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user