添加 'install.py'
This commit is contained in:
parent
a79620d141
commit
1c094aa322
|
@ -0,0 +1,49 @@
|
|||
import string
|
||||
|
||||
class MyTemplate (string.Template):
|
||||
delimiter ='@'
|
||||
def getPyVenv():
|
||||
tmplFileName = "D:\\project\\tools\\pyvenv.tmpl.cfg"
|
||||
fileName = "D:\\project\\tools\\pyvenv.cfg"
|
||||
|
||||
with open(tmplFileName,"r",encoding = 'utf-8') as fr:
|
||||
fileStr = MyTemplate(fr.read())
|
||||
dataStr = fileStr.substitute(Python_Path = "D:\\\\project\\\\tools\\\\python")
|
||||
with open (fileName,"w",encoding = "utf-8") as fw:
|
||||
fw.write(dataStr)
|
||||
fw.close()
|
||||
fr.close()
|
||||
|
||||
def getCmakeTools():
|
||||
tmplFileName = "D:\\project\\tools\\cmake-tools-kits.tmpl.json"
|
||||
fileName = "D:\\project\\tools\\cmake-tools-kits.json"
|
||||
|
||||
with open(tmplFileName,"r",encoding = 'utf-8') as fr:
|
||||
fileStr = MyTemplate(fr.read())
|
||||
dataStr = fileStr.substitute(Install_Path = "D:\\\\project\\\\explab")
|
||||
with open (fileName,"w",encoding = "utf-8") as fw:
|
||||
fw.write(dataStr)
|
||||
fw.close()
|
||||
fr.close()
|
||||
def getCSrcFile(cSrc_name):
|
||||
tmplCFileName = "D:\\project\\tools\\src_c_.tmpl.c"
|
||||
fileCName = "D:\\project\\tools\\" + cSrc_name + ".c"
|
||||
tmplIncFileName = "D:\\project\\tools\\inc_c_.tmpl.h"
|
||||
fileIncName = "D:\\project\\tools\\" + cSrc_name + ".h"
|
||||
with open(tmplCFileName,"r",encoding = 'utf-8') as fr:
|
||||
fileStr = MyTemplate(fr.read())
|
||||
dataStr = fileStr.substitute(fileName = cSrc_name,include_str="",macro_str ="",type_str="",variable_str="",function_str ="")
|
||||
with open (fileCName,"w",encoding = "utf-8") as fw:
|
||||
fw.write(dataStr)
|
||||
fw.close()
|
||||
fr.close()
|
||||
with open(tmplIncFileName,"r",encoding = 'utf-8') as fr:
|
||||
fileStr = MyTemplate(fr.read())
|
||||
dataStr = fileStr.substitute(macroName = cSrc_name.upper(),fileName = cSrc_name,include_str="",macro_str ="",type_str="",variable_str="",function_str ="")
|
||||
with open (fileIncName,"w",encoding = "utf-8") as fw:
|
||||
fw.write(dataStr)
|
||||
fw.close()
|
||||
fr.close()
|
||||
if __name__ == "__main__":
|
||||
# getCmakeTools();
|
||||
getCSrcFile("buzz")
|
Loading…
Reference in New Issue