Multiple ant scripts running from Python
I have many inter-dependant Java projects kept inside a folder named 'Source'. Each project has build.xml also. I need to run all build.xml one by one from python. I was trying the following:
import subprocess
import os
def callBuild(str, counter):
proc = subprocess.check_output(["start", "cmd", "/k", "ant -v -d -f "+str], shell=True)
return
path = 'D:/ar/Source'
for subdir, dirs, files in os.walk(path):
for file in files:
filepath = subdir + os.sep + file
if filepath.endswith("build.xml"):
print (filepath)
count+=1
callBuild(filepath, count)
I am getting all ant scripts executed but I need to close the cmd prompt running ant script one by one to get the next ant task started. (It's like first ant script 1 gets run then close that command prompt and the ant script 2 gets run and so on.)
But I want all ant scripts to be run one after the other without manually closing the cmd prompt. How can I acheive this? I want the cmd prompt to remain open if the ant script running on it fails.
链接地址: http://www.djcxy.com/p/44336.html上一篇: ANT SQL任务中的自动提交问题
下一篇: 从Python运行多个ant脚本