#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import sys from msgutils import MsgIni def main(): parser = argparse.ArgumentParser( description='Tool for generating/maintaining the per-message routing INI from the inputted message conf file(s)' ) parser.add_argument('conf', nargs='+') parser.add_argument('output', help='path to the message INI to create or update') args = parser.parse_args() if len(sys.argv) < 3: parser.print_help() else: msg_ini = MsgIni() try: for conf in args.conf: msg_ini.loadConf(conf, clear=False) output_dir = os.path.dirname(os.path.abspath(args.output)) os.makedirs(output_dir, exist_ok=True) msg_ini.merge_ini(args.output) except Exception as e: print('Error: %s' % e) sys.exit(1) if __name__ == "__main__": # calling main function main()