Add cleanup upon update

This commit is contained in:
Labrys of Knossos 2018-12-19 19:27:52 -05:00
commit 70acfc22e7
2 changed files with 18 additions and 1 deletions

View file

@ -24,6 +24,7 @@ except ImportError:
sys.ext('Please install pywin32')
APP_ROOT = libs.util.module_path(parent=True)
SOURCE_ROOT = libs.util.module_path()
# init preliminaries
SYS_ARGV = sys.argv[1:]

View file

@ -15,6 +15,7 @@ from six.moves.urllib.request import urlretrieve
import core
from core import github_api as github, logger
import libs.util
class CheckVersion(object):
@ -79,7 +80,22 @@ class CheckVersion(object):
def update(self):
if self.updater.need_update():
return self.updater.update()
result = self.updater.update()
self.clean()
return result
@staticmethod
def clean():
# Clean libs
libs.util.git_clean(
remove_directories=True,
force=True,
ignore_rules=True,
paths=[
libs.LIB_ROOT,
core.SOURCE_ROOT,
],
)
class UpdateManager(object):