entry point
()
| 924 | |
| 925 | |
| 926 | def main(): |
| 927 | """entry point""" |
| 928 | # check dependencies are met |
| 929 | try: |
| 930 | dependencies_met() |
| 931 | except UnmetDependency as exc: |
| 932 | LOG.err(exc) |
| 933 | return False |
| 934 | |
| 935 | time0 = time.time() |
| 936 | try: |
| 937 | opts = Options() |
| 938 | except YamlException as exc: |
| 939 | LOG.err(f'yaml error: {exc}') |
| 940 | return False |
| 941 | except ConfigException as exc: |
| 942 | LOG.err(f'config error: {exc}') |
| 943 | return False |
| 944 | except UndefinedException as exc: |
| 945 | LOG.err(f'dependencies error: {exc}') |
| 946 | return False |
| 947 | except OptionsException as exc: |
| 948 | LOG.err(f'options error: {exc}') |
| 949 | return False |
| 950 | |
| 951 | if opts.debug: |
| 952 | LOG.debug = opts.debug |
| 953 | LOG.dbg('\n\n') |
| 954 | options_time = time.time() - time0 |
| 955 | |
| 956 | if opts.check_version: |
| 957 | check_version() |
| 958 | |
| 959 | time0 = time.time() |
| 960 | ret, command = _exec_command(opts) |
| 961 | cmd_time = time.time() - time0 |
| 962 | |
| 963 | opts.debug_command() |
| 964 | LOG.dbg(f'done executing command \"{command}\"') |
| 965 | LOG.dbg(f'options loaded in {options_time}') |
| 966 | LOG.dbg(f'command executed in {cmd_time}') |
| 967 | |
| 968 | if ret and opts.conf.save(): |
| 969 | LOG.log('config file updated') |
| 970 | |
| 971 | LOG.dbg(f'return {ret}') |
| 972 | return ret |
| 973 | |
| 974 | |
| 975 | if __name__ == '__main__': |
no test coverage detected