2015-07-11 07:51:30 +02:00
|
|
|
#!/usr/bin/env python
|
2018-06-16 16:12:18 +02:00
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
2015-07-11 07:51:30 +02:00
|
|
|
|
2014-01-26 18:31:06 +01:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import glob
|
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
|
2014-01-26 18:31:06 +01:00
|
|
|
def clean():
|
2018-06-12 11:43:13 +02:00
|
|
|
to_delete = [
|
|
|
|
'session_stats',
|
|
|
|
'libtorrent_logs*',
|
|
|
|
'round_trip_ms.log',
|
|
|
|
'dht.log',
|
|
|
|
'upnp.log',
|
|
|
|
'natpmp.log',
|
|
|
|
'bin',
|
|
|
|
'build-aux',
|
|
|
|
'.deps',
|
|
|
|
'test_tmp_*',
|
2018-10-19 14:35:19 +02:00
|
|
|
'bjam_build.*.xml',
|
2018-06-12 11:43:13 +02:00
|
|
|
'*.exe',
|
|
|
|
'*.pdb',
|
|
|
|
'*.pyd',
|
|
|
|
'dist',
|
|
|
|
'build',
|
|
|
|
'.libs',
|
|
|
|
'*.cpp.orig',
|
|
|
|
'*.cpp.rej',
|
|
|
|
'*.hpp.orig',
|
|
|
|
'*.hpp.rej',
|
2019-09-14 19:31:31 +02:00
|
|
|
'*.gcov',
|
|
|
|
'*.gcno',
|
|
|
|
'*.gcda',
|
2018-06-12 11:43:13 +02:00
|
|
|
'Makefile.in',
|
|
|
|
'Makefile',
|
|
|
|
'lib*.a',
|
|
|
|
'Jamfile.rej',
|
|
|
|
'Jamfile.orig',
|
|
|
|
'*.o',
|
|
|
|
'*.lo',
|
|
|
|
'autom4te.cache',
|
|
|
|
'configure',
|
|
|
|
'config.report',
|
|
|
|
'config.log',
|
|
|
|
'.lib',
|
|
|
|
]
|
2015-07-11 07:51:30 +02:00
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
directories = [
|
|
|
|
'examples',
|
|
|
|
'test',
|
|
|
|
'.',
|
|
|
|
'tools',
|
|
|
|
'src',
|
|
|
|
'simulation',
|
2019-04-06 19:02:31 +02:00
|
|
|
'fuzzers',
|
2018-06-12 11:43:13 +02:00
|
|
|
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')
|
|
|
|
]
|
2015-07-11 07:51:30 +02:00
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
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)
|
2018-10-26 00:47:23 +02:00
|
|
|
except Exception:
|
2018-06-12 11:43:13 +02:00
|
|
|
try:
|
|
|
|
os.remove(p)
|
|
|
|
print(p)
|
|
|
|
except Exception as e:
|
|
|
|
print(p, e)
|
2015-07-11 07:51:30 +02:00
|
|
|
|
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
clean()
|