Skip to content

Commit

Permalink
make clean should not clean bypy build artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jun 28, 2021
1 parent 73f641c commit 90164df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,13 @@ def safe_remove(*entries: str) -> None:
'build', 'compile_commands.json', 'link_commands.json',
'linux-package', 'kitty.app', 'asan-launcher',
'kitty-profile', 'kitty/launcher')
exclude = ('.git',)
for root, dirs, files in os.walk('.', topdown=True):
dirs[:] = [d for d in dirs if d not in exclude]

def excluded(root: str, d: str) -> bool:
q = os.path.relpath(os.path.join(root, d), base).replace(os.sep, '/')
return q in ('.git', 'bypy/b')

for root, dirs, files in os.walk(base, topdown=True):
dirs[:] = [d for d in dirs if not excluded(root, d)]
remove_dirs = {d for d in dirs if d == '__pycache__' or d.endswith('.dSYM')}
for d in remove_dirs:
shutil.rmtree(os.path.join(root, d))
Expand Down

0 comments on commit 90164df

Please sign in to comment.