ATLAS Offline Software
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 
12 import PyUtils.acmdlib as acmdlib
13 import sys
14 
15 def 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 
49 if __name__ == "__main__":
50  sys.exit(main())
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
acmd.main
def main()
Definition: acmd.py:15