mirror of
https://github.com/mupen64plus/mupen64plus-ui-python.git
synced 2025-04-02 10:51:53 -04:00
clean __pycache__ dir
This commit is contained in:
parent
1c6983a611
commit
3bd350d52f
1 changed files with 10 additions and 3 deletions
13
setup.py
13
setup.py
|
@ -257,7 +257,7 @@ def set_rthook():
|
|||
|
||||
|
||||
class clean_local(Command):
|
||||
pats = ['*.py[co]', '*_ui.py', '*_rc.py']
|
||||
pats = ['*.py[co]', '*_ui.py', '*_rc.py', '__pycache__']
|
||||
excludedirs = ['.git', 'build', 'dist']
|
||||
user_options = []
|
||||
|
||||
|
@ -269,13 +269,20 @@ class clean_local(Command):
|
|||
|
||||
def run(self):
|
||||
for e in self._walkpaths('.'):
|
||||
os.remove(e)
|
||||
if os.path.isdir(e):
|
||||
shutil.rmtree(e)
|
||||
else:
|
||||
os.remove(e)
|
||||
|
||||
def _walkpaths(self, path):
|
||||
for root, _dirs, files in os.walk(path):
|
||||
for root, dirs, files in os.walk(path):
|
||||
if any(root == join(path, e) or root.startswith(
|
||||
join(path, e, '')) for e in self.excludedirs):
|
||||
continue
|
||||
for d in dirs:
|
||||
fpath = join(root, d)
|
||||
if any(fnmatch(d, p) for p in self.pats):
|
||||
yield fpath
|
||||
for e in files:
|
||||
fpath = join(root, e)
|
||||
if any(fnmatch(fpath, p) for p in self.pats):
|
||||
|
|
Loading…
Add table
Reference in a new issue