diff --git a/pym/update/update.py b/pym/update/update.py index 0ed233c..3db40c6 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -29,6 +29,7 @@ from calculate.lib.utils.colortext.palette import TextState from calculate.lib.utils.colortext import get_color_print from calculate.update.emerge_parser import RevdepPercentBlock from calculate.update.datavars import DataVarsUpdate +from calculate.update.update_info import UpdateInfo import re from collections import MutableSet @@ -743,8 +744,7 @@ class Update: """ Установить флаг: есть обновления """ - val = "on" if val else "off" - SystemIni().setVar('update', {'packages': val}) + UpdateInfo.set_update_ready(val) return True def _emerge_translate(self, s): diff --git a/pym/update/update_info.py b/pym/update/update_info.py index b713b91..8ab9fca 100644 --- a/pym/update/update_info.py +++ b/pym/update/update_info.py @@ -26,6 +26,8 @@ class UpdateInfo(object): """ Информационный объект о процессе обновления """ + section = "update" + varname = "updates" def __init__(self, dv=None): if dv is None: @@ -37,11 +39,16 @@ class UpdateInfo(object): def need_update(self): return self.update_ready() or self.check_for_dispatch() - def update_ready(self): + @classmethod + def update_ready(cls): """ Проверить есть ли обновления по ini.env """ - return SystemIni().getVar('update', 'packages') == u'on' + return SystemIni().getVar(cls.section, cls.varname) == u'on' + + def set_update_ready(self, value): + SystemIni().setVar(self.section, + {self.varname:"on" if value else "off"}) def check_for_dispatch(self): """