Revert "[M120 Migration]Fix for crash during chrome exit"
[platform/framework/web/chromium-efl.git] / tools / protoc_wrapper / protoc_convert.py
1 # Copyright 2019 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Helper script for use by GN to encode/decode proto files. The protoc tool
6 requires using stdin/stdout for the --encode/--decode options, but that form
7 of processing is not supported by GN.
8 """
9
10 import argparse
11 import subprocess
12
13 def Main():
14   parser = argparse.ArgumentParser()
15   parser.add_argument('--protoc', help='Path to protoc compiler.')
16   parser.add_argument('--infile', required=True,
17                       help='Path to input file that will be used as stdin.')
18   parser.add_argument('--outfile', required=True,
19                       help='Path to output file that will be used as stdout.')
20   args, passthrough_args = parser.parse_known_args()
21
22   stdin = open(args.infile, 'r')
23   stdout = open(args.outfile, 'w')
24
25   subprocess.check_call([args.protoc] + passthrough_args, stdin=stdin,
26       stdout=stdout)
27
28
29 if __name__ == '__main__':
30   Main()