|
|
|
@ -324,7 +324,7 @@ class fileHeader(_terms):
|
|
|
|
|
# Параметры описанные в заголовке файла шаблона
|
|
|
|
|
self.params = {}
|
|
|
|
|
# некорректные параметры
|
|
|
|
|
incorrectParams = set([])
|
|
|
|
|
incorrectParams = []
|
|
|
|
|
# Удаление Заголовка Calculate
|
|
|
|
|
if comment:
|
|
|
|
|
titleFirst = _("Modified")
|
|
|
|
@ -344,7 +344,12 @@ class fileHeader(_terms):
|
|
|
|
|
reS = reCalcHeader.search(text)
|
|
|
|
|
if reS:
|
|
|
|
|
self.body = text[reS.end():]
|
|
|
|
|
|
|
|
|
|
# Поиск строки запустка (#!/bin/bash и.т. д)
|
|
|
|
|
if fileType != "bin":
|
|
|
|
|
reExecRes = self.reExecStr.search(self.body)
|
|
|
|
|
if reExecRes:
|
|
|
|
|
self.execStr = self.body[reExecRes.start():reExecRes.end()]
|
|
|
|
|
self.body = self.body[reExecRes.end():]
|
|
|
|
|
if fileType != False:
|
|
|
|
|
if fileType=="bin":
|
|
|
|
|
self.params["format"] = fileType
|
|
|
|
@ -407,11 +412,7 @@ class fileHeader(_terms):
|
|
|
|
|
self.comment = self._getComment()
|
|
|
|
|
self.fileType = self._getType()
|
|
|
|
|
self.typeAppend = self._getAppend()
|
|
|
|
|
reExecRes = self.reExecStr.search(self.body)
|
|
|
|
|
if reExecRes:
|
|
|
|
|
self.execStr = self.body[reExecRes.start():reExecRes.end()]
|
|
|
|
|
self.body = self.body[reExecRes.end():]
|
|
|
|
|
if not incorrectParams:
|
|
|
|
|
if not incorrectParams and self.params:
|
|
|
|
|
incorrectParams = set(self.params.keys()) - set(self.allowParam)
|
|
|
|
|
if incorrectParams:
|
|
|
|
|
self.headerTerm = False
|
|
|
|
@ -4337,6 +4338,16 @@ re.M|re.S)
|
|
|
|
|
if objHeadNew.comment:
|
|
|
|
|
objHeadOld = fileHeader(nameFileConfig, self.textConfig,
|
|
|
|
|
objHeadNew.comment)
|
|
|
|
|
elif typeAppendTemplate in ("before", "after"):
|
|
|
|
|
objHeadOld = fileHeader(nameFileConfig, self.textConfig)
|
|
|
|
|
|
|
|
|
|
# Строка вызова скрипта (#!/bin/bash ...)
|
|
|
|
|
execStr = ""
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
execStr = objHeadNew.execStr
|
|
|
|
|
elif objHeadOld.execStr:
|
|
|
|
|
execStr = objHeadOld.execStr
|
|
|
|
|
|
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
|
formatTemplate = objHeadNew.fileType
|
|
|
|
|
typeAppendTemplate = objHeadNew.typeAppend
|
|
|
|
@ -4361,9 +4372,8 @@ re.M|re.S)
|
|
|
|
|
self.setError(_("False template") + ": " +\
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
return False
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.textConfig = objHeadNew.execStr+title+\
|
|
|
|
|
self.textTemplate
|
|
|
|
|
if execStr:
|
|
|
|
|
self.textConfig = execStr + title + self.textTemplate
|
|
|
|
|
else:
|
|
|
|
|
self.textConfig = title + self.textTemplate
|
|
|
|
|
self.saveConfFile()
|
|
|
|
@ -4442,10 +4452,8 @@ re.M|re.S)
|
|
|
|
|
tmpTemplate = self.textTemplate + self.textConfig
|
|
|
|
|
else:
|
|
|
|
|
tmpTemplate = self.textTemplate + "\n" + self.textConfig
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.textConfig = objHeadNew.execStr + title + tmpTemplate
|
|
|
|
|
elif objHeadOld and objHeadOld.execStr:
|
|
|
|
|
self.textConfig = objHeadOld.execStr + title + tmpTemplate
|
|
|
|
|
if execStr:
|
|
|
|
|
self.textConfig = execStr + title + tmpTemplate
|
|
|
|
|
else:
|
|
|
|
|
self.textConfig = title + tmpTemplate
|
|
|
|
|
|
|
|
|
@ -4464,10 +4472,8 @@ re.M|re.S)
|
|
|
|
|
tmpTemplate = self.textConfig + self.textTemplate
|
|
|
|
|
else:
|
|
|
|
|
tmpTemplate = self.textConfig + "\n" + self.textTemplate
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.textConfig = objHeadNew.execStr + title + tmpTemplate
|
|
|
|
|
elif objHeadOld and objHeadOld.execStr:
|
|
|
|
|
self.textConfig = objHeadOld.execStr + title + tmpTemplate
|
|
|
|
|
if execStr:
|
|
|
|
|
self.textConfig = execStr + title + tmpTemplate
|
|
|
|
|
else:
|
|
|
|
|
self.textConfig = title + tmpTemplate
|
|
|
|
|
self.saveConfFile()
|
|
|
|
@ -4508,14 +4514,6 @@ re.M|re.S)
|
|
|
|
|
if not self.textConfig or\
|
|
|
|
|
not reNoClean.search(self.textConfig):
|
|
|
|
|
self.textConfig = ""
|
|
|
|
|
#if objHeadNew.execStr:
|
|
|
|
|
#self.textConfig = objHeadNew.execStr + \
|
|
|
|
|
#title + objTemplNew.getConfig().encode("UTF-8")
|
|
|
|
|
#else:
|
|
|
|
|
#self.textConfig = title +\
|
|
|
|
|
#objTemplNew.getConfig().encode("UTF-8")
|
|
|
|
|
#self.saveConfFile()
|
|
|
|
|
#return True
|
|
|
|
|
|
|
|
|
|
objHeadOld = fileHeader(nameFileConfig, self.textConfig,
|
|
|
|
|
objTemplNew._comment)
|
|
|
|
@ -4550,11 +4548,8 @@ re.M|re.S)
|
|
|
|
|
data.insert(1,title)
|
|
|
|
|
self.textConfig = "\n".join(data)
|
|
|
|
|
else:
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.textConfig = objHeadNew.execStr + title +\
|
|
|
|
|
objTemplOld.getConfig().encode("UTF-8")
|
|
|
|
|
elif objHeadOld.execStr:
|
|
|
|
|
self.textConfig = objHeadOld.execStr + title +\
|
|
|
|
|
if execStr:
|
|
|
|
|
self.textConfig = execStr + title +\
|
|
|
|
|
objTemplOld.getConfig().encode("UTF-8")
|
|
|
|
|
else:
|
|
|
|
|
self.textConfig = title +\
|
|
|
|
|