Chromium Code Reviews| Index: scripts/slave/android/generate_whitelist_deps_step.py |
| diff --git a/scripts/slave/android/generate_whitelist_deps_step.py b/scripts/slave/android/generate_whitelist_deps_step.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..019e0cfee8eaffe7cd87e61781b3937c0edae013 |
| --- /dev/null |
| +++ b/scripts/slave/android/generate_whitelist_deps_step.py |
| @@ -0,0 +1,57 @@ |
| +#!/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!
|
| +# 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. |
| + |
| +"""This script is used to checkout Chromium source code with a custom set of |
| +DEPS entries. The DEPS entries are generated by consulting a script that is |
| +checked into the main Chromium repository.""" |
| + |
| +import argparse |
| +import logging |
| +import os |
| +import sys |
| + |
| +try: |
| + import json # pylint: disable=F0401 |
| +except ImportError: |
| + 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.
|
| + |
| +def deps_blacklist(path_to_whitelist_script, path_to_deps_file, method): |
| + local_vars = {} |
| + execfile(path_to_whitelist_script, {'os': os}, local_vars) |
| + deps_whitelist = local_vars['DepsWhitelist']() |
| + return deps_whitelist.__getattribute__(method)(path_to_deps_file) |
| + |
| +def main(): |
| + parser = argparse.ArgumentParser() |
| + parser.add_argument('--method', help='Method to use to fetch from whitelist.', |
| + required=True) |
| + parser.add_argument('--path-to-deps', help='Path to DEPS file.', |
| + required=True) |
| + parser.add_argument('--path-to-whitelist', help='Path to the whitelist file.', |
| + required=True) |
| + parser.add_argument('--output-json', help='Name of file to write output to.', |
| + 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.
|
| + parser.add_argument('verbose', action='store_true') |
| + opts = parser.parse_args() |
| + |
| + logging.getLogger().setLevel(logging.DEBUG if opts.verbose else logging.WARN) |
| + |
| + blacklist = deps_blacklist(opts.path_to_whitelist, opts.path_to_deps, |
| + opts.method) |
| + if (opts.output_json): |
| + output_dict = { |
| + 'blacklist' : blacklist |
| + } |
| + with open(opts.output_json, 'w') as output_json_file: |
| + json.dump(output_dict, output_json_file) |
| + else: |
| + print blacklist |
| + |
| + return 0 |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
| + |