blob: f0a0ec9225cbc21dac4492aba10adf42316a8534 [file] [log] [blame]
Wei-Yu Chen49950b92021-11-08 19:19:18 +08001"""
2Copyright 2020 The Magma Authors.
3
4This source code is licensed under the BSD-style license found in the
5LICENSE file in the root directory of this source tree.
6
7Unless required by applicable law or agreed to in writing, software
8distributed under the License is distributed on an "AS IS" BASIS,
9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10See the License for the specific language governing permissions and
11limitations under the License.
12"""
13import os
14import sys
15
16from grpc.tools import protoc
17
18
19def gen_prometheus_proto_py(proto_file_dir, output_dir):
20 # Function For fb-internal build tools - open source should use this file
21 # as a script
22 protoc.main(
23 (
24 '',
25 '-I' + proto_file_dir,
26 '--python_out=' + output_dir,
27 '--grpc_python_out=' + output_dir,
28 os.path.join(proto_file_dir, 'metrics.proto'),
29 ),
30 )
31
32
33if __name__ == '__main__':
34 # ./gen_prometheus_proto.py <magma root> <output_dir>
35 magma_root, out_dir = sys.argv[1], sys.argv[2]
36 file_dir = os.path.join(magma_root, 'proto_files/orc8r/protos/prometheus')
37 gen_prometheus_proto_py(file_dir, out_dir)
38