|
|
|
@ -16,7 +16,8 @@
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
import cl_utils
|
|
|
|
|
from cl_utils import convertStrListDict, fillstr, getpathenv, runOsCommand,\
|
|
|
|
|
pathJoin
|
|
|
|
|
import re
|
|
|
|
|
from cl_lang import lang
|
|
|
|
|
from cl_template import iniParser
|
|
|
|
@ -341,8 +342,7 @@ class DataVars(object):
|
|
|
|
|
_("Unable to find the alias '%s' of the file path for \
|
|
|
|
|
storage of variables templates")%location)
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
name_calculate_ini = name_calculate_ini.strip('/')
|
|
|
|
|
return os.path.join(self.Get('cl_chroot_path'),name_calculate_ini)
|
|
|
|
|
return pathJoin(self.Get('cl_chroot_path'), name_calculate_ini)
|
|
|
|
|
|
|
|
|
|
def __getSection(self, vname):
|
|
|
|
|
"""секция для записи в ini файл переменной
|
|
|
|
@ -388,7 +388,7 @@ storage of variables templates")%location)
|
|
|
|
|
# Получаем секцию конфигурационного файла
|
|
|
|
|
if not header:
|
|
|
|
|
header = self.__getSection(vname)
|
|
|
|
|
return config.setVar(header,{vname: cl_utils.convertStrListDict(val)})
|
|
|
|
|
return config.setVar(header,{vname: convertStrListDict(val)})
|
|
|
|
|
|
|
|
|
|
def __deleteVarValue(self, vname, location, header):
|
|
|
|
|
'''Удалить переменную в calculate.ini
|
|
|
|
@ -509,7 +509,7 @@ storage of variables templates")%location)
|
|
|
|
|
options = {}
|
|
|
|
|
for varName, value in allvars.items():
|
|
|
|
|
varName = varName.encode("UTF-8")
|
|
|
|
|
value=cl_utils.convertStrListDict(value.encode("UTF-8"))
|
|
|
|
|
value=convertStrListDict(value.encode("UTF-8"))
|
|
|
|
|
options[varName] = value
|
|
|
|
|
if options:
|
|
|
|
|
optionsInfo[section] = options
|
|
|
|
@ -555,7 +555,7 @@ storage of variables templates")%location)
|
|
|
|
|
# полученные из ini
|
|
|
|
|
for (k,v) in allvars.items():
|
|
|
|
|
k = k.encode("UTF-8")
|
|
|
|
|
value = cl_utils.convertStrListDict(v.encode("UTF-8"))
|
|
|
|
|
value = convertStrListDict(v.encode("UTF-8"))
|
|
|
|
|
self.Set(k, value, True)
|
|
|
|
|
importFileVars[k] = value
|
|
|
|
|
if i < 3:
|
|
|
|
@ -627,8 +627,8 @@ storage of variables templates")%location)
|
|
|
|
|
mlen_mode=len(mode)
|
|
|
|
|
plist=var.keys()
|
|
|
|
|
plist.sort()
|
|
|
|
|
br = cl_utils.fillstr("-",mlen_name) + " " +\
|
|
|
|
|
cl_utils.fillstr("-",mlen_mode) + " " + cl_utils.fillstr("-",10)
|
|
|
|
|
br = fillstr("-",mlen_name) + " " +\
|
|
|
|
|
fillstr("-",mlen_mode) + " " + fillstr("-",10)
|
|
|
|
|
cl_overriding.printSUCCESS(_("The list of variables:"))
|
|
|
|
|
cl_overriding.printSUCCESS(_("Variable name").center(mlen_name)+ " " +\
|
|
|
|
|
_("Mode") + " " +_("Value"))
|
|
|
|
@ -648,9 +648,9 @@ class glob_attr:
|
|
|
|
|
"""Вернуть результат выполнения команды ОС"""
|
|
|
|
|
if not env:
|
|
|
|
|
envDict = {}
|
|
|
|
|
env.update(os.environ.items() + [("PATH",cl_utils.getpathenv())] +\
|
|
|
|
|
env.update(os.environ.items() + [("PATH",getpathenv())] +\
|
|
|
|
|
env.items())
|
|
|
|
|
retCode, programOut = cl_utils.runOsCommand(cmd, None, ret_first, env,
|
|
|
|
|
retCode, programOut = runOsCommand(cmd, None, ret_first, env,
|
|
|
|
|
ret_list)
|
|
|
|
|
if not retCode:
|
|
|
|
|
return programOut
|
|
|
|
|