ATLAS Offline Software
Loading...
Searching...
No Matches
acmd.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
3# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4# @file PyUtils.acmd
5# @purpose main command line script for the general purpose athena scripts
6# @author Sebastien Binet
7# @date January 2010
8
9__author__ = "Sebastien Binet"
10__doc__ = "main command line script for the general purpose athena scripts"
11
12import PyUtils.acmdlib as acmdlib
13import sys
14
15def main():
16 import PyUtils.scripts # noqa: F401 (register all plugins)
17 import PyUtils.Logging as L
18 msg = L.logging.getLogger('Acmd')
19 msg.setLevel(L.logging.INFO)
20
21 # To avoid loading all plugins every time, first try to find
22 # a specific plugin that matches the first N arguments:
23 cmd = None
24 for i in range(1,len(sys.argv)):
25 cmd_name = '.'.join(sys.argv[1:i+1])
26 if acmdlib.Plugins.exists(cmd_name):
27 cmd = acmdlib.Plugins.load(cmd_name)
28 break
29
30 # Otherwise load all plugins and leave the rest to the parser:
31 if cmd is None:
32 acmdlib.Plugins.loadAll()
33
34 parser = acmdlib.ACMD_PARSER
35 args = parser.parse_args()
36
37 exitcode = 1
38 try:
39 exitcode = cmd.main(args)
40 except Exception:
41 exitcode = 1
42 print(sys.exc_info()[0])
43 print(sys.exc_info()[1])
44 raise
45
46 return exitcode
47
48
49if __name__ == "__main__":
50 sys.exit(main())
void print(char *figname, TCanvas *c1)
main()
Definition acmd.py:15