From 371097eb4d2a8e8f94368646da2eb7d2b5073ec7 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sun, 23 Feb 2020 07:54:58 +0100 Subject: [PATCH] Update Updater --- cps/static/js/reading/epub.js | 1 - cps/updater.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cps/static/js/reading/epub.js b/cps/static/js/reading/epub.js index bae9f72b..8b7fb075 100644 --- a/cps/static/js/reading/epub.js +++ b/cps/static/js/reading/epub.js @@ -42,5 +42,4 @@ var reader; alert(error); }); } - // reader.book.package.metadata.direction= "rtl"; wait for reader reader before changing reading direction })(); diff --git a/cps/updater.py b/cps/updater.py index 824e1314..7af8649c 100644 --- a/cps/updater.py +++ b/cps/updater.py @@ -193,7 +193,12 @@ class Updater(threading.Thread): exclude = ( os.sep + 'app.db', os.sep + 'calibre-web.log1', os.sep + 'calibre-web.log2', os.sep + 'gdrive.db', os.sep + 'vendor', os.sep + 'calibre-web.log', os.sep + '.git', os.sep + 'client_secrets.json', - os.sep + 'gdrive_credentials', os.sep + 'settings.yaml') + os.sep + 'gdrive_credentials', os.sep + 'settings.yaml', os.sep + 'venv', os.sep + 'virtualenv', + os.sep + 'access.log', os.sep + 'access.log1', os.sep + 'access.log2', + ) + additional_path = self.is_venv() + if additional_path: + exclude = exclude + (additional_path,) for root, dirs, files in os.walk(destination, topdown=True): for name in files: old_list.append(os.path.join(root, name).replace(destination, '')) @@ -229,6 +234,12 @@ class Updater(threading.Thread): logger.debug("Could not remove: %s", item_path) shutil.rmtree(source, ignore_errors=True) + def is_venv(self): + if (hasattr(sys, 'real_prefix')) or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): + return os.sep + os.path.relpath(sys.prefix,constants.BASE_DIR) + else: + return False + @classmethod def _nightly_version_info(cls): if is_sha1(constants.NIGHTLY_VERSION[0]) and len(constants.NIGHTLY_VERSION[1]) > 0: