标签:
需要工具如下:
输入命令,切换到manifest目录
cd manifest
git tag 列出android各个分支版本
下载android-4.4系统源码,输入下面命令,如果要下载其他版本源码,checkout git tag列出的版本号即可
git checkout android-4.4.2_r1
import xml.dom.minidom
import os
from subprocess import call
#downloaded source path
rootdir = "F:/anroid4.4"
#git program path
git = "C:/Program Files/Git/bin/git.exe"
dom = xml.dom.minidom.parse("F:/anroid4.4/default.xml")
root = dom.documentElement
prefix = git + " clone https://android.googlesource.com/"
suffix = ".git"
if not os.path.exists(rootdir):
os.mkdir(rootdir)
for node in root.getElementsByTagName("project"):
os.chdir(rootdir)
d = node.getAttribute("path")
last = d.rfind("/")
if last != -1:
d = rootdir + "/" + d[:last]
if not os.path.exists(d):
os.makedirs(d)
os.chdir(d)
cmd = prefix + node.getAttribute("name") + suffix
call(cmd)
标签:
原文地址:http://www.cnblogs.com/try-catch/p/4552797.html