Merge branch 'feature/ChangeCleaner' into develop

This commit is contained in:
JackDandy 2018-09-23 23:20:08 +01:00
commit d974e2a65f
2 changed files with 27 additions and 0 deletions

View file

@ -28,6 +28,7 @@
[develop changelog]
* Fix sorting results
* Change remove deprecated files
### 0.17.6 (2018-09-22 09:45:00 UTC)

View file

@ -4,6 +4,32 @@ import os
import shutil
parent_dir = os.path.abspath(os.path.dirname(__file__))
cleaned_file = os.path.abspath(os.path.join(parent_dir, '.cleaned004.tmp'))
test = os.path.abspath(os.path.join(parent_dir, 'lib', 'requests', 'packages'))
if not os.path.isfile(cleaned_file) or os.path.exists(test):
dead_dirs = [os.path.abspath(os.path.join(parent_dir, *d)) for d in [
('lib', 'requests', 'packages'),
('lib', 'pynma')
]]
for dirpath, dirnames, filenames in os.walk(parent_dir):
for dead_dir in filter(lambda x: x in dead_dirs, [os.path.abspath(os.path.join(dirpath, d)) for d in dirnames]):
try:
shutil.rmtree(dead_dir)
except (StandardError, Exception):
pass
for filename in [fn for fn in filenames if os.path.splitext(fn)[-1].lower() in ('.pyc', '.pyo')]:
try:
os.remove(os.path.abspath(os.path.join(dirpath, filename)))
except (StandardError, Exception):
pass
with open(cleaned_file, 'wb') as fp:
fp.write('This file exists to prevent a rerun delete of *.pyc, *.pyo files')
fp.flush()
os.fsync(fp.fileno())
cleaned_file = os.path.abspath(os.path.join(parent_dir, '.cleaned003.tmp'))
test = os.path.abspath(os.path.join(parent_dir, 'lib', 'imdb'))
if not os.path.isfile(cleaned_file) or os.path.exists(test):