Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
|
iannucci
2013/05/20 19:41:38
WDYT about having this script live in the repo tha
mkosiba (inactive)
2013/05/21 10:56:07
works for me!
| |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """This script is used to checkout Chromium source code with a custom set of | |
| 7 DEPS entries. The DEPS entries are generated by consulting a script that is | |
| 8 checked into the main Chromium repository.""" | |
| 9 | |
| 10 import argparse | |
| 11 import logging | |
| 12 import os | |
| 13 import sys | |
| 14 | |
| 15 try: | |
| 16 import json # pylint: disable=F0401 | |
| 17 except ImportError: | |
| 18 import simplejson as json | |
|
iannucci
2013/05/20 19:41:38
We don't need this dance any more, since we should
mkosiba (inactive)
2013/05/21 10:56:07
Done.
| |
| 19 | |
| 20 def deps_blacklist(path_to_whitelist_script, path_to_deps_file, method): | |
| 21 local_vars = {} | |
| 22 execfile(path_to_whitelist_script, {'os': os}, local_vars) | |
| 23 deps_whitelist = local_vars['DepsWhitelist']() | |
| 24 return deps_whitelist.__getattribute__(method)(path_to_deps_file) | |
| 25 | |
| 26 def main(): | |
| 27 parser = argparse.ArgumentParser() | |
| 28 parser.add_argument('--method', help='Method to use to fetch from whitelist.', | |
| 29 required=True) | |
| 30 parser.add_argument('--path-to-deps', help='Path to DEPS file.', | |
| 31 required=True) | |
| 32 parser.add_argument('--path-to-whitelist', help='Path to the whitelist file.', | |
| 33 required=True) | |
| 34 parser.add_argument('--output-json', help='Name of file to write output to.', | |
| 35 default=None) | |
|
iannucci
2013/05/20 19:41:38
Technically, None is the default for default :)
mkosiba (inactive)
2013/05/21 10:56:07
Done.
| |
| 36 parser.add_argument('verbose', action='store_true') | |
| 37 opts = parser.parse_args() | |
| 38 | |
| 39 logging.getLogger().setLevel(logging.DEBUG if opts.verbose else logging.WARN) | |
| 40 | |
| 41 blacklist = deps_blacklist(opts.path_to_whitelist, opts.path_to_deps, | |
| 42 opts.method) | |
| 43 if (opts.output_json): | |
| 44 output_dict = { | |
| 45 'blacklist' : blacklist | |
| 46 } | |
| 47 with open(opts.output_json, 'w') as output_json_file: | |
| 48 json.dump(output_dict, output_json_file) | |
| 49 else: | |
| 50 print blacklist | |
| 51 | |
| 52 return 0 | |
| 53 | |
| 54 | |
| 55 if __name__ == '__main__': | |
| 56 sys.exit(main()) | |
| 57 | |
| OLD | NEW |