-
大小: 52.75MB文件类型: .gz金币: 1下载: 0 次发布日期: 2022-12-12
- 语言: 其他
- 标签: google depot_tools
资源简介
2018年4月27日翻墻下载,最新版本的depot_tools工具——Linux/Mac版本
代码片段和文件信息
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
“““Wraps gclient calls with annotated output.
Note that you will have to use -- to stop option parsing for gclient flags.
To run ‘gclient sync --gclientfile=.gclient‘ and annotate got_v8_revision:
‘annotated_gclient.py --revision-mapping=‘{“src/v8“: “got_v8_revision“}‘ --
sync --gclientfile=.gclient‘
“““
import contextlib
import json
import optparse
import os
import subprocess
import sys
import tempfile
@contextlib.contextmanager
def temp_filename(suffix=‘‘ prefix=‘tmp‘):
output_fd output_file = tempfile.mkstemp(suffix=suffix prefix=prefix)
os.close(output_fd)
yield output_file
try:
os.remove(output_file)
except OSError as e:
print ‘Error cleaning up temp file %s: %s‘ % (output_file e)
def parse_got_revision(filename revision_mapping):
result = {}
with open(filename) as f:
data = json.load(f)
for path info in data[‘solutions‘].iteritems():
# gclient json paths always end with a slash
path = path.rstrip(‘/‘)
if path in revision_mapping:
propname = revision_mapping[path]
result[propname] = info[‘revision‘]
return result
def emit_buildprops(got_revisions):
for prop revision in got_revisions.iteritems():
print ‘@@@SET_BUILD_PROPERTY@%s@%s@@@‘ % (prop json.dumps(revision))
def main():
parser = optparse.OptionParser(
description=(‘Runs gclient and annotates the output with any ‘
‘got_revisions.‘))
parser.add_option(‘--revision-mapping‘ default=‘{}‘
help=‘json dict of directory-to-property mappings.‘)
parser.add_option(‘--suffix‘ default=‘gclient‘
help=‘tempfile suffix‘)
opts args = parser.parse_args()
revision_mapping = json.loads(opts.revision_mapping)
if not args:
parser.error(‘Must provide arguments to gclient.‘)
if any(a.startswith(‘--output-json‘) for a in args):
parser.error(‘Can\‘t call annotated_gclient with --output-json.‘)
with temp_filename(opts.suffix) as f:
cmd = [‘gclient‘]
cmd.extend(args)
cmd.extend([‘--output-json‘ f])
p = subprocess.Popen(cmd)
p.wait()
if p.returncode == 0:
revisions = parse_got_revision(f revision_mapping)
emit_buildprops(revisions)
return p.returncode
if __name__ == ‘__main__‘:
sys.exit(main())
- 上一篇:游戏策划案学习资料
- 下一篇:征信与大数据 移动互联时代如何重塑“信用体系”
相关资源
- GoogleChrome Windows x64
- GoogleNews-vectors-negative300.bin 压缩包3/
- Google软件测试之道_中文
- 谷歌街景(StreetView)原理
- Google SketchUp Pro 8.0实用教程 中文版.
- Google_Earth_Pro.7z
- Tensorflow 实战Google深度学习框架高清完
- google plugin for eclipse 4.3 最新离线安装
- SRE Google运维解密
- 自己训练的googlenet inception v1 v3模型
- google安装包google安装包
- depot_tools谷歌更新于2019.8.3,禁止了
- Google chrome 80.0.3987.163 64 位
- SRE Google运维解密
- 谷歌地球中文版官方 Google Earth(谷歌
- Google GMS包
- kubernetes实战pdf高清晰版带目录
- Tensorflow实战Google深度学习框架.zip
- SRE Google运维解密 中文版 pdf
- Google API开发详解:Google Maps与Google
- Octotree 2.4.6 谷歌浏览器GitHub插件 最新
- 谷歌云PC客户端
- facebook、google和naver第三方登录
- Google地图经纬度与平面坐标的相互转
- 仿百度/google搜索引擎
- google-gson-2.1-release
- chrome Google 翻译 2.0.7 插件 .crx
- 利用google地图根据地址批量获取经纬
- google chrome残留卸载
- google软件测试之道258014
评论
共有 条评论