Windows: Always use the depot_tools SVN version instead of the system SVN version.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1392 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
bbe793d9b1
commit
4892da5d72
|
@ -48,14 +48,25 @@ def get_svn_info(path):
|
||||||
rev = 'None'
|
rev = 'None'
|
||||||
if path[0:4] == 'http' or os.path.exists(path):
|
if path[0:4] == 'http' or os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
stream = os.popen('svn info --xml '+path)
|
if sys.platform == 'win32':
|
||||||
tree = ET.ElementTree(ET.fromstring(stream.read()))
|
# Force use of the SVN version bundled with depot_tools.
|
||||||
entry = tree.getroot().find('entry')
|
svn = 'svn.bat'
|
||||||
url = entry.find('url').text
|
else:
|
||||||
rev = entry.attrib['revision']
|
svn = 'svn'
|
||||||
|
(stream_in, stream_out, stream_err) = os.popen3(svn+' info --xml '+path)
|
||||||
|
err = stream_err.read()
|
||||||
|
if err == '':
|
||||||
|
tree = ET.ElementTree(ET.fromstring(stream_out.read()))
|
||||||
|
entry = tree.getroot().find('entry')
|
||||||
|
url = entry.find('url').text
|
||||||
|
rev = entry.attrib['revision']
|
||||||
|
else:
|
||||||
|
raise Exception("Failed to execute svn info:\n"+err+"\n")
|
||||||
except IOError, (errno, strerror):
|
except IOError, (errno, strerror):
|
||||||
sys.stderr.write('Failed to read svn info: '+strerror+"\n")
|
sys.stderr.write('Failed to read svn info: '+strerror+"\n")
|
||||||
raise
|
raise
|
||||||
|
except:
|
||||||
|
raise
|
||||||
return {'url': url, 'revision': rev}
|
return {'url': url, 'revision': rev}
|
||||||
|
|
||||||
def download_and_extract(src, target, contents_prefix):
|
def download_and_extract(src, target, contents_prefix):
|
||||||
|
@ -299,6 +310,9 @@ if not os.path.exists(depot_tools_dir):
|
||||||
# checkout depot_tools
|
# checkout depot_tools
|
||||||
run('svn checkout '+depot_tools_url+' '+depot_tools_dir, download_dir)
|
run('svn checkout '+depot_tools_url+' '+depot_tools_dir, download_dir)
|
||||||
|
|
||||||
|
# Add depot_tools to the system path
|
||||||
|
sys.path.insert(1, depot_tools_dir)
|
||||||
|
|
||||||
# check if the "chromium" directory exists
|
# check if the "chromium" directory exists
|
||||||
chromium_dir = os.path.join(download_dir, 'chromium')
|
chromium_dir = os.path.join(download_dir, 'chromium')
|
||||||
if not os.path.exists(chromium_dir):
|
if not os.path.exists(chromium_dir):
|
||||||
|
|
|
@ -23,14 +23,25 @@ def get_svn_info(path):
|
||||||
rev = 'None'
|
rev = 'None'
|
||||||
if path[0:4] == 'http' or os.path.exists(path):
|
if path[0:4] == 'http' or os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
stream = os.popen('svn info --xml '+path)
|
if sys.platform == 'win32':
|
||||||
tree = ET.ElementTree(ET.fromstring(stream.read()))
|
# Force use of the SVN version bundled with depot_tools.
|
||||||
entry = tree.getroot().find('entry')
|
svn = 'svn.bat'
|
||||||
url = entry.find('url').text
|
else:
|
||||||
rev = entry.attrib['revision']
|
svn = 'svn'
|
||||||
|
(stream_in, stream_out, stream_err) = os.popen3(svn+' info --xml '+path)
|
||||||
|
err = stream_err.read()
|
||||||
|
if err == '':
|
||||||
|
tree = ET.ElementTree(ET.fromstring(stream_out.read()))
|
||||||
|
entry = tree.getroot().find('entry')
|
||||||
|
url = entry.find('url').text
|
||||||
|
rev = entry.attrib['revision']
|
||||||
|
else:
|
||||||
|
raise Exception("Failed to execute svn info:\n"+err+"\n")
|
||||||
except IOError, (errno, strerror):
|
except IOError, (errno, strerror):
|
||||||
sys.stderr.write('Failed to read svn info: '+strerror+"\n")
|
sys.stderr.write('Failed to read svn info: '+strerror+"\n")
|
||||||
raise
|
raise
|
||||||
|
except:
|
||||||
|
raise
|
||||||
return {'url': url, 'revision': rev}
|
return {'url': url, 'revision': rev}
|
||||||
|
|
||||||
def get_revision(path = '.'):
|
def get_revision(path = '.'):
|
||||||
|
|
Loading…
Reference in New Issue