博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python VIL Realse
阅读量:6758 次
发布时间:2019-06-26

本文共 2220 字,大约阅读时间需要 7 分钟。

 

#!/usr/bin/python#-*- coding:utf-8 –*-import osimport sysimport reimport shutilimport xlrdimport xlwtfrom xlutils.copy import copy'''提取相关RELEASE信息,追加“SW Release Note.xls”运行命令 ./gen_release.py "Modified reason"'''def fun_genRelease():    list = []    curLine = ""    book = xlrd.open_workbook(r'./mergedir/SW Release Note.xls',formatting_info=True)    sheet = book.sheet_by_index(0)        newBook = copy(book)    newSheet = newBook.get_sheet(0)    list.append(sheet.nrows-1)    with open("./drivers/include/project.h", "r") as mFile:        proData = mFile.read()            with open("./aps/include/common_patch.h","r") as comFile:        comData = comFile.read()    modeId = re.search(".*DEFAULT_MODE_ID\s+(\d+).*",comData).group(1)            pat = re.compile(".*?(\d+).*\{.*\"((\d+)_.*)\",\s+&\w+\[\d+\],\s+/\*(.*?)\*/\s+&\w+\[\d+\],\s+/\*(.*)\*/.*")        list.append(re.search(".*CONFIG_APP_FOLDER_NAME.*\"(.*)\"", proData).group(1))    board = re.search(".*CONFIG_MODEL_BOARD_NAME\s+\"(\w+)\"",proData).group(1)        with open("./aps/customer/radisson/%s/adaptable/model_data.c" %board,"r") as modeFile:        modeList = modeFile.readlines()            for line in modeList:        if pat.search(line) and pat.search(line).group(1) == modeId:            curLine = line            break            list.append(pat.search(curLine).group(2))    list.append(pat.search(curLine).group(3))    list.append(pat.search(curLine).group(4))    list.append(pat.search(curLine).group(5))    list.append("LL" if "LL" in pat.search(curLine).group(2) else "NON LL")    list.append("" if len(sys.argv) ==1 else sys.argv[1])        with open("./aps/include/timestamp.h","r") as verFile:        verData = verFile.read()            list.append("%s%s" %(board,re.search(".*TIME_VERSION\s+\"(\w+)\".*",verData).group(1)))    list.append("")    list.append("")    list.append("bjornLee")        #写EXCEL    #for col in range(sheet.ncols):    col = 0    for cell in list:        newSheet.write(sheet.nrows,col,cell)        col = col+1        #newSheet.write(sheet.nrows,col,"test")    newBook.save(r'./mergedir/SW Release Note.xls')    print "\n",list,"\n"        def main():    fun_genRelease()    if __name__ == '__main__':    main()

 

转载地址:http://kjweo.baihongyu.com/

你可能感兴趣的文章
一个字符在字符串中出现最多的次数的打印
查看>>
图片的三级缓存
查看>>
js跨域问题解决方案
查看>>
(八)统一配置中心-Config
查看>>
I.MX6 Android CAN 命令行测试
查看>>
linux shell except tcl login ssh Automatic interaction
查看>>
iOS JSONModel解析数据成Model
查看>>
QQ空间抢车位刷钱方法汇总
查看>>
[LeetCode] Missing Number
查看>>
java.lang.IllegalStateException: Illegal access
查看>>
STL容器的效率比较
查看>>
Ckeditor使用总结
查看>>
人事面试100问题--巧妙应答
查看>>
【工具类】怎么进入阿里云docker仓库
查看>>
Ceres-Solver库入门
查看>>
悲惨而又丢人的创业经历:草根创业者含恨倾诉为什么失败
查看>>
理解WebKit和Chromium: WebKit, WebKit2, Chromium和Chrome介绍
查看>>
hanoi塔的递归算法
查看>>
C# 校验给定的ip地址是否合法
查看>>
lumen 登陆 注册 demo
查看>>