1import sdk_pb2
2import sys
3
4if __name__ == '__main__':
5  argv = sys.argv[1:]
6  if not len(argv) == 4 or sorted([argv[0], argv[2]]) != ['-o', '-v']:
7    print('usage: gen_sdkinfo -v <version> -o <output-file>')
8    sys.exit(1)
9
10  for i in range(len(argv)):
11    if sys.argv[i] == '-o':
12      filename = sys.argv[i+1]
13    if sys.argv[i] == '-v':
14      version = int(sys.argv[i+1])
15
16  proto = sdk_pb2.SdkVersion()
17  proto.version = version
18  with open(filename, 'wb') as f:
19    f.write(proto.SerializeToString())
20