|
|
|
@ -2371,6 +2371,10 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
self.programVersion = "%s %s"%(_nameProgram, _versionProgram)
|
|
|
|
|
# Словарь измененных директорий
|
|
|
|
|
self.changeDirs = {}
|
|
|
|
|
# Словарь директорий с количесвом файлов шаблонов
|
|
|
|
|
self.dictTemplates = {}
|
|
|
|
|
# Общее количество шаблонов
|
|
|
|
|
self.allTemplates = 0
|
|
|
|
|
|
|
|
|
|
# Преобразование восьмеричного в целое (ввод строка, вывод число)
|
|
|
|
|
def __octToInt(self, strOct):
|
|
|
|
@ -3251,6 +3255,25 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
|
|
|
|
|
def applyProfiles(self):
|
|
|
|
|
"""Применяет профили к конфигурационным файлам"""
|
|
|
|
|
|
|
|
|
|
def createDictTemplates(path, prefix, dictTemplates):
|
|
|
|
|
"""Создает словарь {"директория":"кол-во шаблонов" ...}
|
|
|
|
|
|
|
|
|
|
и считает общее количество шаблонов
|
|
|
|
|
"""
|
|
|
|
|
# Количество шаблонов
|
|
|
|
|
self.allTemplates += 1
|
|
|
|
|
dirTemplate = os.path.split(path)[0]
|
|
|
|
|
while(True):
|
|
|
|
|
if dirTemplate in dictTemplates.keys():
|
|
|
|
|
dictTemplates[dirTemplate] += 1
|
|
|
|
|
else:
|
|
|
|
|
dictTemplates[dirTemplate] = 1
|
|
|
|
|
if dirTemplate == prefix:
|
|
|
|
|
break
|
|
|
|
|
dirTemplate = os.path.split(dirTemplate)[0]
|
|
|
|
|
return dictTemplates
|
|
|
|
|
|
|
|
|
|
if not self.objVar.defined("cl_profile_path"):
|
|
|
|
|
self.setError (_("not defined Var: ") + "cl_profile_path")
|
|
|
|
|
return False
|
|
|
|
@ -3264,6 +3287,10 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
self.filesApply = []
|
|
|
|
|
# Номер применяемого шаблона
|
|
|
|
|
self.numberProcessProf = 0
|
|
|
|
|
# Словарь директорий с количеством файлов шаблонов
|
|
|
|
|
self.dictTemplates = {}
|
|
|
|
|
# Количество шаблонов
|
|
|
|
|
self.allTemplates = 0
|
|
|
|
|
if self._servDir:
|
|
|
|
|
tmpDirsProfiles = []
|
|
|
|
|
for dirP in dirsProfiles:
|
|
|
|
@ -3274,15 +3301,16 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
else:
|
|
|
|
|
tmpDirsProfiles.append(False)
|
|
|
|
|
dirsProfiles = tmpDirsProfiles
|
|
|
|
|
#scanObj = processingTemplates()
|
|
|
|
|
|
|
|
|
|
#scanObj.processingFile = lambda *x: x[1]
|
|
|
|
|
# Считаем количество файлов
|
|
|
|
|
#for dirTemplate in dirsProfiles:
|
|
|
|
|
|
|
|
|
|
# тестовое значение количества профилей
|
|
|
|
|
numberAllProfiles = 1000
|
|
|
|
|
self.numberAllProfiles(numberAllProfiles)
|
|
|
|
|
|
|
|
|
|
scanObj = processingTemplates()
|
|
|
|
|
scanObj.processingFile = lambda x,y: createDictTemplates(x, y,\
|
|
|
|
|
self.dictTemplates)
|
|
|
|
|
# Считаем количество шаблонов
|
|
|
|
|
for dirTemplate in dirsProfiles:
|
|
|
|
|
scanObj.scanningTemplates(dirTemplate,
|
|
|
|
|
skipFile=self.filesFilter,
|
|
|
|
|
skipDir=self.dirsFilter)
|
|
|
|
|
self.numberAllProfiles(self.allTemplates)
|
|
|
|
|
for dirTemplate in dirsProfiles:
|
|
|
|
|
if self.scanningTemplates(dirTemplate,
|
|
|
|
|
skipFile=self.filesFilter,
|
|
|
|
@ -3346,6 +3374,9 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
if self.getError():
|
|
|
|
|
self.setError(_("Incorrect profile: " ) + dirInfoFile)
|
|
|
|
|
return False
|
|
|
|
|
# Добавление количества файлов в пропущенной директории
|
|
|
|
|
if path in self.dictTemplates.keys():
|
|
|
|
|
self.numberProcessProf += self.dictTemplates[path]
|
|
|
|
|
return None
|
|
|
|
|
newDir = self._baseDir + path.partition(prefix)[2]
|
|
|
|
|
newDir = "/".join(map(lambda x:x.split("?")[0],\
|
|
|
|
@ -3356,6 +3387,9 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
self.changeDirs)
|
|
|
|
|
# Фильтрация профилей по названию директории
|
|
|
|
|
if pathDir in self.dirsFilter:
|
|
|
|
|
# Добавление количества файлов в пропущенной директории
|
|
|
|
|
if path in self.dictTemplates.keys():
|
|
|
|
|
self.numberProcessProf += self.dictTemplates[path]
|
|
|
|
|
return None
|
|
|
|
|
if objHeadDir:
|
|
|
|
|
if isinstance(objHeadDir, dirHeader):
|
|
|
|
@ -3381,6 +3415,9 @@ class profile(_file, _terms, xmlShare, processingTemplates):
|
|
|
|
|
self.setError(_("Incorrect profile: " ) +\
|
|
|
|
|
dirInfoFile)
|
|
|
|
|
return False
|
|
|
|
|
# Добавление количества файлов в пропущенной директории
|
|
|
|
|
if path in self.dictTemplates.keys():
|
|
|
|
|
self.numberProcessProf += self.dictTemplates[path]
|
|
|
|
|
return None
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|