Chromium Code Reviews| Index: infra/bots/add_isolated_input.py |
| diff --git a/infra/bots/add_isolated_input.py b/infra/bots/add_isolated_input.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..70bde6d7acf5087487de0b00d976eb7b72d8fb23 |
| --- /dev/null |
| +++ b/infra/bots/add_isolated_input.py |
| @@ -0,0 +1,33 @@ |
| +#!/usr/bin/env python |
|
rmistry
2016/03/03 16:02:30
Where is this script used?
borenet
2016/03/03 16:18:20
Nowhere yet. I was going to call this script from
|
| +# |
| +# Copyright 2016 Google Inc. |
| +# |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| + |
| +import argparse |
| +import json |
| + |
| + |
| +"""Add the given hash to the includes section of the given isolated file.""" |
| + |
| + |
| +def add_isolated_hash(isolated_file, hash_str): |
| + with open(isolated_file) as f: |
| + isolated = json.load(f) |
| + isolated['includes'].append(hash_str) |
| + with open(isolated_file, 'w') as f: |
| + json.dump(isolated, f, sort_keys=True) |
| + |
| + |
| +def main(): |
| + parser = argparse.ArgumentParser() |
| + parser.add_argument('--isolated_file', required=True) |
| + parser.add_argument('--hash', required=True) |
| + args = parser.parse_args() |
| + add_isolated_hash(args.isolated_file, args.hash) |
| + |
| + |
| +if __name__ == '__main__': |
| + main() |