Browse Source

env.ini[update]packages -> updates

tags/3.2.2_beta4
Mike Khiretskiy 6 years ago
parent
commit
1d26be07e2
2 changed files with 11 additions and 4 deletions
  1. +2
    -2
      pym/update/update.py
  2. +9
    -2
      pym/update/update_info.py

+ 2
- 2
pym/update/update.py View File

@@ -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):


+ 9
- 2
pym/update/update_info.py View File

@@ -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):
"""


Loading…
Cancel
Save