|
|
|
@ -44,6 +44,79 @@ class writeLog:
|
|
|
|
|
formatter="%(asctime)s - %(levelname)s - %(message)s")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DataVars(cl_datavars.DataVars):
|
|
|
|
|
|
|
|
|
|
flagNotFoundVar = False
|
|
|
|
|
|
|
|
|
|
def Get(self, *args, **kwargs):
|
|
|
|
|
try:
|
|
|
|
|
valVars = cl_datavars.DataVars.Get(self, *args, **kwargs)
|
|
|
|
|
except self.DataVarsError, e:
|
|
|
|
|
valVars = ""
|
|
|
|
|
self.flagNotFoundVar = True
|
|
|
|
|
return valVars
|
|
|
|
|
|
|
|
|
|
def Set(self, *args, **kwargs):
|
|
|
|
|
try:
|
|
|
|
|
valVars = cl_datavars.DataVars.Set(self, *args, **kwargs)
|
|
|
|
|
except self.DataVarsError, e:
|
|
|
|
|
valVars = ""
|
|
|
|
|
self.flagNotFoundVar = True
|
|
|
|
|
return valVars
|
|
|
|
|
|
|
|
|
|
class template(cl_template.template):
|
|
|
|
|
|
|
|
|
|
def getApplyHeadTemplate(self, *args, **kwargs):
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ([], False)
|
|
|
|
|
filesApply, objHeadNew =\
|
|
|
|
|
cl_template.template.getApplyHeadTemplate(self, *args, **kwargs)
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ([], False)
|
|
|
|
|
else:
|
|
|
|
|
return filesApply, objHeadNew
|
|
|
|
|
|
|
|
|
|
def getApplyHeadDir(self, *args, **kwargs):
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ("", False, [])
|
|
|
|
|
pathDir, objHeadDir, createdDirs =\
|
|
|
|
|
cl_template.template.getApplyHeadDir(self, *args, **kwargs)
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ("", False, [])
|
|
|
|
|
else:
|
|
|
|
|
return pathDir, objHeadDir, createdDirs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class templateClt(cl_template.templateClt):
|
|
|
|
|
|
|
|
|
|
def getApplyHeadTemplate(self, *args, **kwargs):
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ([], False)
|
|
|
|
|
filesApply, objHeadNew =\
|
|
|
|
|
cl_template.templateClt.getApplyHeadTemplate(self, *args, **kwargs)
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ([], False)
|
|
|
|
|
else:
|
|
|
|
|
return filesApply, objHeadNew
|
|
|
|
|
|
|
|
|
|
def getApplyHeadDir(self, *args, **kwargs):
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ("", False, [])
|
|
|
|
|
pathDir, objHeadDir, createdDirs =\
|
|
|
|
|
cl_template.templateClt.getApplyHeadDir(self, *args, **kwargs)
|
|
|
|
|
if self.objVar.flagNotFoundVar:
|
|
|
|
|
self.objVar.flagNotFoundVar = False
|
|
|
|
|
return ("", False, [])
|
|
|
|
|
else:
|
|
|
|
|
return pathDir, objHeadDir, createdDirs
|
|
|
|
|
|
|
|
|
|
class color_print(old_color_print, writeLog):
|
|
|
|
|
"""Класс для переопределения печати сообщений"""
|
|
|
|
|
_printObj = old_color_print()
|
|
|
|
@ -78,12 +151,12 @@ class color_print(old_color_print, writeLog):
|
|
|
|
|
self.logger.error(arg[0])
|
|
|
|
|
self._printObj.printNotOK(*arg, **argv)
|
|
|
|
|
|
|
|
|
|
class DataVarsObject(cl_datavars.DataVars):
|
|
|
|
|
class DataVarsObject(DataVars):
|
|
|
|
|
"""Класс переменных для десктопа"""
|
|
|
|
|
packagePath = "/usr/lib/calculate-2.2"
|
|
|
|
|
|
|
|
|
|
def __init__(self, nameProgram):
|
|
|
|
|
cl_datavars.DataVars.__init__(self)
|
|
|
|
|
DataVars.__init__(self)
|
|
|
|
|
self.nameProgram = nameProgram
|
|
|
|
|
|
|
|
|
|
def findPathVars(self):
|
|
|
|
@ -114,7 +187,7 @@ class shareUpdateConfigs(color_print, writeLog):
|
|
|
|
|
"""Получаем флаг обновления и
|
|
|
|
|
|
|
|
|
|
установленные программы работающие с шаблонами"""
|
|
|
|
|
clVars = cl_datavars.DataVars()
|
|
|
|
|
clVars = DataVars()
|
|
|
|
|
clVars.flIniFile()
|
|
|
|
|
flagUpdate = clVars.Get("cl_autoupdate_set") in self._tupleOn
|
|
|
|
|
return flagUpdate, clVars.GetList("cl_merges")
|
|
|
|
@ -178,7 +251,7 @@ class updateUserConfigs(shareUpdateConfigs):
|
|
|
|
|
clVars.Set("ur_login", userName, True)
|
|
|
|
|
clVars.Set("cl_action", "desktop", True)
|
|
|
|
|
clVars.Set("cl_belong_pkg", nameProgram, True)
|
|
|
|
|
clTempl = cl_template.template(clVars, printWarning=False)
|
|
|
|
|
clTempl = template(clVars, printWarning=False)
|
|
|
|
|
dirsFiles = clTempl.applyTemplates()
|
|
|
|
|
if dirsFiles is False:
|
|
|
|
|
self.printERROR(\
|
|
|
|
@ -322,13 +395,13 @@ class updateSystemConfigs(shareUpdateConfigs):
|
|
|
|
|
if nameProg == "calculate-install":
|
|
|
|
|
configFiles = self.scanProtectDirs(configPath)
|
|
|
|
|
if configFiles:
|
|
|
|
|
cltObject = cl_template.templateClt(clVars)
|
|
|
|
|
cltObject = templateClt(clVars)
|
|
|
|
|
cltObject.filterApplyTemplates = configFiles
|
|
|
|
|
clTempl = cl_template.template(clVars, cltObj=cltObject,
|
|
|
|
|
printWarning=False)
|
|
|
|
|
clTempl = template(clVars, cltObj=cltObject,
|
|
|
|
|
printWarning=False)
|
|
|
|
|
else:
|
|
|
|
|
clTempl = cl_template.template(clVars, cltObj=False,
|
|
|
|
|
printWarning=False)
|
|
|
|
|
clTempl = template(clVars, cltObj=False,
|
|
|
|
|
printWarning=False)
|
|
|
|
|
dirsFiles = clTempl.applyTemplates()
|
|
|
|
|
nameAndVerPkg = nameProg + "-"+clVars.Get("cl_ver")
|
|
|
|
|
if dirsFiles is False:
|
|
|
|
|