diff --git a/CHANGES.md b/CHANGES.md index 388a8545..13b4d7e3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -41,11 +41,13 @@ * Update qTip 2.2.1 to 2.2.2 * Update tablesorter 2.17.7 to 2.28.5 * Update jQuery 1.8.3 to 2.2.4 +* Add one time run to start up that deletes troublemaking compiled files [develop changelog] * Fix "too many redirects" or "no CSS/JS content" delivered +* Change restart/shutdown to use updated jQuery ### 0.12.5 (2017-01-16 16:22:00 UTC) diff --git a/SickBeard.py b/SickBeard.py index 85d22764..02af40da 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -38,6 +38,11 @@ if not (2, 7, 9) <= sys.version_info < (3, 0): print('Sorry, SickGear requires Python 2.7.9 or higher. Python 3 is not supported.') sys.exit(1) +try: + import _cleaner +except (StandardError, Exception): + pass + try: import Cheetah diff --git a/_cleaner.py b/_cleaner.py new file mode 100644 index 00000000..1cac221f --- /dev/null +++ b/_cleaner.py @@ -0,0 +1,33 @@ +# remove this file when no longer needed + +import os +import shutil + +parent_dir = os.path.abspath(os.path.dirname(__file__)) +cleaned_file = os.path.abspath(os.path.join(parent_dir, r'.cleaned.tmp')) +if not os.path.isfile(cleaned_file): + dead_dirs = [os.path.abspath(os.path.join(parent_dir, *d)) for d in [ + ('tornado',), + ('lib', 'feedcache'), + ('lib', 'jsonrpclib'), + ('lib', 'shove'), + ('lib', 'unrar2') + ]] + + 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()) diff --git a/gui/slick/interfaces/default/apiBuilder.tmpl b/gui/slick/interfaces/default/apiBuilder.tmpl index c3660035..44fb1233 100644 --- a/gui/slick/interfaces/default/apiBuilder.tmpl +++ b/gui/slick/interfaces/default/apiBuilder.tmpl @@ -8,7 +8,7 @@ sbRoot = "$sbRoot"; //--> - +