blob: b2920760772ad51841c837efe26102ee69359092 [file] [log] [blame]
Wei-Yu Chenad55cb82022-02-15 20:07:01 +08001# SPDX-FileCopyrightText: 2020 The Magma Authors.
2# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
3#
4# SPDX-License-Identifier: BSD-3-Clause
Wei-Yu Chen49950b92021-11-08 19:19:18 +08005
Wei-Yu Chen49950b92021-11-08 19:19:18 +08006import os
7import sys
8
9from grpc.tools import protoc
10
11
12def gen_prometheus_proto_py(proto_file_dir, output_dir):
13 # Function For fb-internal build tools - open source should use this file
14 # as a script
15 protoc.main(
16 (
17 '',
18 '-I' + proto_file_dir,
19 '--python_out=' + output_dir,
20 '--grpc_python_out=' + output_dir,
21 os.path.join(proto_file_dir, 'metrics.proto'),
22 ),
23 )
24
25
26if __name__ == '__main__':
27 # ./gen_prometheus_proto.py <magma root> <output_dir>
28 magma_root, out_dir = sys.argv[1], sys.argv[2]
29 file_dir = os.path.join(magma_root, 'proto_files/orc8r/protos/prometheus')
30 gen_prometheus_proto_py(file_dir, out_dir)
31