genPanel.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import sys
import re
import shutil
import glob
'''
脚本使用说明
1. 执行命令./genPanel.py -a 分辨率 :代表生成这种分辨率的软件包
2. 如果想要编译特定的几个分辨率的软件,可在make radissonconfig中选择多个分辨率,然后执行命令./genPanel.py -b 即可
'''
cfgFileName = "radisson.config"
buildNowfile = "../BUILD_RECORD/BUILD_NOW.h"
g_ratioAMode = 0
g_ratioBMode = 0
def CreatebinDir():
global binDir
try:
fd = open(cfgFileName, "r")
data = fd.readlines()
for linedata in data:
if re.search("^CONFIG_CUSDEF_MI.*",linedata):
#获取字串linedata以“_”分开的第四个字串,linedata.split('_')返回一个列表
Customer = (linedata.split('_'))[3]
elif re.search("^CONFIG_CUSDEF_BD.*",linedata):
ChipType = (linedata.split('_'))[4]
BoardType = (linedata.split('_'))[5].split('=')[0]
BDCfg = ChipType+"_"+BoardType binDir = Customer+"_"+BDCfg
fd.close()
except IOError as err:
binDir = "binFile"
print('File Error: ' + str(err)) if os.path.exists(binDir):
shutil.rmtree(binDir)
os.mkdir(binDir) #编译某一分辨率的所有软件。
def RatioA(Resolution):
PANEL_floder_path = ("../CUS_FILE/PN").replace('"','')
for dirPath, dirNames, fileNames in os.walk(PANEL_floder_path):
break for panelName in dirNames:
#筛选符合需求的分辨率
if Resolution not in panelName:
continue
print "===Start Panel %s Please Wait ===" %panelName listSave = []
try:
cfgFile = open(buildFile,"r")
list = cfgFile.readlines()
for each in list:
if re.search("^#define PN_CUSDEF.*",each):
continue
else:
listSave.append(each) each = "#define PN_CUSDEF %s" %(panelName)
listSave.append(each)
listSave.append("\n") cfgFile = open(buildFile,"w")
cfgFile.writelines(listSave)
cfgFile.close()
except IOError as err:
print('File Error: ' + str(err))
os.system('make clean;./build_history.sh') #将生成的bin文件移进软件包目录
#glob模块返回一个完整的路径列表,而不是查找到的文件名
binPath=glob.glob(r"./mergedir/RR*.bin")
if len(binPath) != 0:
os.mkdir(panelName)
shutil.copy(binPath[0],panelName)
shutil.move(panelName,binDir)
else:
print "compile error!"
sys.exit() #编译make radissonconfig中选中的多个分辨率
def RatioB():
try:
panelSet = []
setStr = set()
cfgFile = open(buildFile,"r")
list = cfgFile.readlines()
for each in list:
if re.search("^#define PN_CUSDEF\d?(.*)",each):
setStr.add(re.search("^#define PN_CUSDEF\d?(.*)",each).group(1))
for line in setStr:
line1=line.strip()
panelSet.append(line1)
except IOError as err:
print('File Error: ' + str(err)) for panelName in panelSet:
print "===Start Panel %s Please Wait ===" %panelName listSave = []
try:
cfgFile = open(buildFile,"r")
list = cfgFile.readlines()
for each in list:
if re.search("^#define PN_CUSDEF .*",each):
continue
else:
listSave.append(each) each = "#define PN_CUSDEF %s" %(panelName)
listSave.append(each)
listSave.append("\n") cfgFile = open(buildFile,"w")
cfgFile.writelines(listSave)
cfgFile.close()
except IOError as err:
print('File Error: ' + str(err))
os.system('make clean;./build_history.sh') #将生成的bin文件移进软件包目录
binPath=glob.glob(r"./mergedir/RR*.bin")
if len(binPath) != 0:
os.mkdir(panelName)
shutil.copy(binPath[0],panelName)
shutil.move(panelName,binDir)
else:
print "compile error!"
sys.exit() def fun_parse_InputParam():
global g_ratioAMode
global g_ratioBMode
#获取脚本带入参数的长度
if len(sys.argv) < 2:
print "The number of parameters is wrong!"
sys.exit()
else:
#sys.argv[1]表示脚本带入的第一个的参数
opt1 = sys.argv[1]
opt2 = ["1366x768","1440x900","1024x768","1400x1050","1920x1080","1024x600","1280x1024","1280x800","1400x1050","1600x900","1680x1050","1920x1200","1600x1200"]
if opt1 == "-a" and len(sys.argv) == 3:
g_ratioAMode = 1
if sys.argv[2] not in opt2:
print("parameter2: unhandled option!")
sys.exit()
elif opt1 == "-b" and len(sys.argv) == 2:
g_ratioBMode = 1 else:
print("parameter error!")
sys.exit() if __name__ == "__main__": #处理脚本带入的参数
fun_parse_InputParam() #从BUILD_NOW.h中获取build_setting.h所在的目录名
try:
buildNow = open(buildNowfile,"r")
list = buildNow.readlines()
for line in list:
if re.search("^#define BUILD_NAME .*",line):
buildDir = re.search("^#define BUILD_NAME (.*)",line).group(1)
buildNow.close()
except IOError as err:
print('File Error: ' + str(err)) buildFile = "../BUILD_RECORD/"+buildDir+"/BUILD_SETTING.h" #创建软件包目录
CreatebinDir() if g_ratioAMode:
#编译某一分辨率的所有软件。
RatioA(sys.argv[2])
if g_ratioBMode:
#编译make radissonconfig中选中的多个分辨率
RatioB()
genPanel.py的更多相关文章
- python调用py中rar的路径问题。
1.python调用py,在py中的os.getcwd()获取的不是py的路径,可以通过os.path.split(os.path.realpath(__file__))[0]来获取py的路径. 2. ...
- Python导入其他文件中的.py文件 即模块
import sys sys.path.append("路径") import .py文件
- import renumber.py in pymol
cp renumber.py /usr/local/lib/python2.7/dist-packages/pymol import renumber or run /path/to/renumber ...
- python gettitle.py
#!/usr/bin/env python # coding=utf-8 import threading import requests import Queue import sys import ...
- 解决 odoo.py: error: option --addons-path: The addons-path 'local-addons/' does not seem to a be a valid Addons Directory!
情况说明 odoo源文件路径-/odoo-dev/odoo/: 我的模块插件路径 ~/odoo-dev/local-addons/my-module 在my-module中创建了__init__.py ...
- caffe机器学习自带图片分类器classify.py实现输出预测结果的概率及caffe的web_demo例子运行实例
caffe机器学习环境搭建及python接口编译参见我的上一篇博客:机器学习caffe环境搭建--redhat7.1和caffe的python接口编译 1.运行caffe图片分类器python接口 还 ...
- 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优
libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...
- MySqlNDB使用自带的ndb_setup.py安装集群
在用Mysql做集群时,使用Mysql的NDB版本更易于集群的扩展,稳定和数据的实时性. 我们可以使用Mysql自带的工具进行集群安装与管理:ndb_setup.py.位于Mysql的安装目录bin下 ...
- 将做好的py文件打包成模块,供别人安装调用
现在要将写完的3个py文件,打包. 步骤: 1.新建一个文件夹setup(名字随便取),在setup文件夹下,再新建一个文件夹financeapi. 2.将上面4个py文件拷贝至financeapi文 ...
随机推荐
- 使用git遇到的一些问题
上传github时忽略.DS_Store方法 这个文件在mac中是管理文件夹的位置之类的信息,所以并没有必要上传到git中,这个时候就需要用git.gitignore文件来忽略此类文件. 在默认情况下 ...
- 基于CentOS6.8版本配置真实域名的方法
前言:审核了15天的时间终于审核下来了,但是结果发现配置域名掉坑了,记录一下 (一)首先配置域名三步走 1.先到域名商网站解析你你的域名(我的是百度云) 2.接着修改linux的host指向 例如: ...
- ios 不支持-,-时间。
var date = "2000-08-29"; console.log(new Date(date).getTime());解决办法 date .replace(/-/g, ' ...
- vscode隐藏运行ts生成的js文件和map文件
在code-首选项-用户设置中放入以下代码,覆盖原有的 { "files.exclude": { "node_modules": true, "**/ ...
- 嵌入式-迅为iTOP-4418开发板Flash空间问题
我的4418开发板 是4G版本 16G存储空间的.u-boot和文件系统.内核都是光盘自带的,进入linux系统之后 我使用df -h命令看到的存储空间不对,我用U盘做了测试:u盘里面放1G的内容往a ...
- spring cloud(学习笔记) Enreka服务治理
服务治理是微服务架构最为核心和基础的模块,主要用来实现各个微服务实例的自动化注册和发现. 记录一下服务注册中心的搭建以及高可用注册中心的实现 1.首先创建两个基础 的spring boot工程,spr ...
- Hadoop之MapReduce思维导图
- Java -cp 命令行引用多个jar包的简单写法(Windows、Linux
1.Windows下用法 在Windows上,可以使用 用法:java your-jar-lib-folder/* your-main-class your-jar-lib-folder为存放一堆ja ...
- 【译】第六篇 SQL Server安全执行上下文和代码签名
本篇文章是SQL Server安全系列的第六篇,详细内容请参考原文. SQL Server决定主体是否有必要的执行代码权限的根本途径是其执行上下文规则.这一切都可能复杂一个主体有执行代码的权限,但是却 ...
- python scrapy 报错 DEBUG: Ignoring response 403
DEBUG: Ignoring response <403 http://movie.douban.com/top250>: HTTP status code is not handled ...