premiere-libtorrent/tools/clean.py

80 lines
1.4 KiB
Python
Raw Normal View History

#!/usr/bin/env python
2014-01-26 18:31:06 +01:00
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',
2017-12-29 10:50:48 +01:00
'build-aux',
'.deps',
2014-01-26 18:31:06 +01:00
'test_tmp_*',
'bjam_build.*.xml',
2014-03-27 07:22:12 +01:00
'*.exe',
'*.pdb',
2014-11-24 05:25:05 +01:00
'*.pyd',
'dist',
'build',
2015-05-09 20:41:37 +02:00
'.libs',
'*.cpp.orig',
'*.cpp.rej',
'*.hpp.orig',
'*.hpp.rej',
'*.hpp.gcov',
'*.cpp.gcov',
'Makefile.in',
'Makefile',
'lib*.a',
'Jamfile.rej',
'Jamfile.orig',
2017-12-29 10:50:48 +01:00
'autom4te.cache',
'configure',
'config.report',
'config.log',
'.lib',
2014-01-26 18:31:06 +01:00
]
2014-01-26 18:31:06 +01:00
directories = [
'examples',
'test',
'.',
2014-03-27 07:22:12 +01:00
'tools',
2014-11-24 05:25:05 +01:00
'src',
2017-12-10 22:46:08 +01:00
'simulation',
2015-05-09 20:41:37 +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'),
2017-12-10 22:46:08 +01:00
os.path.join('bindings', os.path.join('c', 'src')),
os.path.join('simulation', 'libsimulator')
2014-01-26 18:31:06 +01:00
]
2014-01-26 18:31:06 +01: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)
2015-05-09 20:41:37 +02:00
print p
except Exception, e:
try:
os.remove(p)
print p
except Exception, e:
print p, e
2014-01-26 18:31:06 +01:00
if __name__ == "__main__":
clean()