Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/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
| |
| 2 # | |
| 3 # Copyright 2016 Google Inc. | |
| 4 # | |
| 5 # Use of this source code is governed by a BSD-style license that can be | |
| 6 # found in the LICENSE file. | |
| 7 | |
| 8 | |
| 9 import argparse | |
| 10 import json | |
| 11 | |
| 12 | |
| 13 """Add the given hash to the includes section of the given isolated file.""" | |
| 14 | |
| 15 | |
| 16 def add_isolated_hash(isolated_file, hash_str): | |
| 17 with open(isolated_file) as f: | |
| 18 isolated = json.load(f) | |
| 19 isolated['includes'].append(hash_str) | |
| 20 with open(isolated_file, 'w') as f: | |
| 21 json.dump(isolated, f, sort_keys=True) | |
| 22 | |
| 23 | |
| 24 def main(): | |
| 25 parser = argparse.ArgumentParser() | |
| 26 parser.add_argument('--isolated_file', required=True) | |
| 27 parser.add_argument('--hash', required=True) | |
| 28 args = parser.parse_args() | |
| 29 add_isolated_hash(args.isolated_file, args.hash) | |
| 30 | |
| 31 | |
| 32 if __name__ == '__main__': | |
| 33 main() | |
| OLD | NEW |