|
|
|
@ -325,6 +325,12 @@ class fileHeader(_terms):
|
|
|
|
|
self.params = {}
|
|
|
|
|
# некорректные параметры
|
|
|
|
|
incorrectParams = []
|
|
|
|
|
# Поиск строки запустка (#!/bin/bash и.т. д)
|
|
|
|
|
if comment or (fileType != False and fileType!="bin"):
|
|
|
|
|
reExecRes = self.reExecStr.search(self.body)
|
|
|
|
|
if reExecRes:
|
|
|
|
|
self.execStr = self.body[reExecRes.start():reExecRes.end()]
|
|
|
|
|
self.body = self.body[reExecRes.end():]
|
|
|
|
|
# Удаление Заголовка Calculate
|
|
|
|
|
if comment:
|
|
|
|
|
titleFirst = _("Modified")
|
|
|
|
@ -344,12 +350,6 @@ 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
|
|
|
|
@ -3288,14 +3288,18 @@ re.M|re.S)
|
|
|
|
|
|
|
|
|
|
def getTemplateType(self):
|
|
|
|
|
"""выдать тип шаблона (text, bin)"""
|
|
|
|
|
isBin = self.typeFileObj.isBinary(self.nameFileTemplate)
|
|
|
|
|
return self.getFileType(self.nameFileTemplate)
|
|
|
|
|
|
|
|
|
|
def getFileType(self, fileName):
|
|
|
|
|
"""выдать тип файла (text, bin)"""
|
|
|
|
|
isBin = self.typeFileObj.isBinary(fileName)
|
|
|
|
|
typeTemplate = "bin"
|
|
|
|
|
if isBin is True:
|
|
|
|
|
typeTemplate = "bin"
|
|
|
|
|
elif isBin is False:
|
|
|
|
|
typeTemplate = "text"
|
|
|
|
|
else:
|
|
|
|
|
self.setError(_("ERROR") + ": getTemplateType()")
|
|
|
|
|
self.setError(_("ERROR") + ": getFileType()")
|
|
|
|
|
self.setError(isBin)
|
|
|
|
|
return False
|
|
|
|
|
return typeTemplate
|
|
|
|
@ -4339,13 +4343,15 @@ re.M|re.S)
|
|
|
|
|
objHeadOld = fileHeader(nameFileConfig, self.textConfig,
|
|
|
|
|
objHeadNew.comment)
|
|
|
|
|
elif typeAppendTemplate in ("before", "after"):
|
|
|
|
|
objHeadOld = fileHeader(nameFileConfig, self.textConfig)
|
|
|
|
|
configFileType = self.getFileType(nameFileConfig)
|
|
|
|
|
objHeadOld = fileHeader(nameFileConfig, self.textConfig,
|
|
|
|
|
fileType=configFileType)
|
|
|
|
|
|
|
|
|
|
# Строка вызова скрипта (#!/bin/bash ...)
|
|
|
|
|
execStr = ""
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
execStr = objHeadNew.execStr
|
|
|
|
|
elif objHeadOld.execStr:
|
|
|
|
|
elif objHeadOld and objHeadOld.execStr:
|
|
|
|
|
execStr = objHeadOld.execStr
|
|
|
|
|
|
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
|