天下

记录修行的印记

为QT编译写的py脚本

#!/usr/bin/python
#
coding:utf-8
import os,sys,string

argc 
= len(sys.argv)
nResult 
= 0

dirname 
= os.path.basename(os.getcwd())
proj
= dirname + ".pro"
file_exe 
= dirname


if argc==2:
    para
=sys.argv[1]
    
if para == "--help" or para=="-h":
        sys.exit(
"Usage:mk [rebuild|clean]")
    
if para=="clean":
        cmd
="make clean 2>/dev/null"
        
print cmd
        os.system(cmd)
        cmd
="rm -f Makefile"
        
print cmd
        os.system(cmd)
        cmd
="rm -f "+proj
        
print cmd
        os.system(cmd)
        cmd 
= "rm -f " + file_exe
        
print cmd
        os.system(cmd)
        sys.exit(
"mk clean completed!")
    
if para== "rebuild":
        cmd 
= "mk clean"
        
print cmd
        os.system(cmd)
        cmd 
= "mk"
        
print cmd
        os.system(cmd)
        sys.exit()

if not os.path.isfile(proj):
    cmd 
= "qmake -project"
    
print cmd
    os.system(cmd)

cmd 
= "qmake "+proj
print cmd
os.system(cmd)

cmd
="make"
print cmd
nResult 
= os.system(cmd)

print("\n---------------")
if nResult==0:
    
print("build Success")
else:
    
print("build Failure")

posted on 2011-09-22 10:26 天下 阅读(385) 评论(0)  编辑 收藏 引用 所属分类: Python


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2011年9月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

导航

统计

常用链接

留言簿(4)

随笔分类(378)

随笔档案(329)

链接

最新随笔

搜索

最新评论