1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#!/usr/bin/env python3
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import shutil
import glob
def clean():
to_delete = [
'session_stats',
'libtorrent_logs*',
'round_trip_ms.log',
'dht.log',
'upnp.log',
'natpmp.log',
'bin',
'build-aux',
'.deps',
'test_tmp_*',
'bjam_build.*.xml',
'*.exe',
'*.pdb',
'*.pyd',
'dist',
'build',
'.libs',
'*.cpp.orig',
'*.cpp.rej',
'*.hpp.orig',
'*.hpp.rej',
'*.gcov',
'*.gcno',
'*.gcda',
'lib*.a',
'Jamfile.rej',
'Jamfile.orig',
'*.o',
'*.lo',
'autom4te.cache',
'configure',
'config.report',
'config.log',
'.lib',
'CMakeFiles',
'CMakeCache.txt',
'checking_benchmark',
'cpu_benchmark',
]
directories = [
'examples',
'test',
'.',
'tools',
'src',
'simulation',
'fuzzers',
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')),
os.path.join('simulation', 'libsimulator')
]
for d in directories:
for f in to_delete:
path = os.path.join(d, f)
entries = glob.glob(path)
for p in entries:
try:
shutil.rmtree(p)
print(p)
except Exception as e:
print(p, e)
try:
os.remove(p)
print(p)
except Exception as e:
print(p, e)
if __name__ == "__main__":
clean()
|