improve repo cleaning script

This commit is contained in:
Arvid Norberg 2015-05-09 18:41:37 +00:00
parent 6557910c7f
commit 4b91b87ec5
1 changed files with 27 additions and 5 deletions

View File

@ -18,7 +18,18 @@ def clean():
'*.pyd',
'dist',
'build',
'.libs'
'.libs',
'*.cpp.orig',
'*.cpp.rej',
'*.hpp.orig',
'*.hpp.rej',
'*.hpp.gcov',
'*.cpp.gcov',
'Makefile.in',
'Makefile',
'lib*.a',
'Jamfile.rej',
'Jamfile.orig',
]
directories = [
@ -27,7 +38,14 @@ def clean():
'.',
'tools',
'src',
os.path.join('bindings', 'python')
os.path.join('src', 'kademlia'),
os.path.join('include', 'libtorrent'),
os.path.join('include', os.path.join('libtorrent', '_aux')),
os.path.join('include', os.path.join('libtorrent', 'kademlia')),
os.path.join('bindings', 'python'),
os.path.join('bindings', os.path.join('python', 'src')),
os.path.join('bindings', 'c'),
os.path.join('bindings', os.path.join('c', 'src'))
]
for d in directories:
@ -35,11 +53,15 @@ def clean():
path = os.path.join(d, f)
entries = glob.glob(path)
for p in entries:
print p
try:
shutil.rmtree(p)
except:
pass
print p
except Exception, e:
try:
os.remove(p)
print p
except Exception, e:
print p, e
if __name__ == "__main__":
clean()