source: CMIP6dreq/trunk/dreqPy/dreqCmdl.py @ 738

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreq/trunk/dreqPy/dreqCmdl.py@738
Revision 738, 1.1 KB checked in by mjuckes, 4 years ago (diff)

for python3

Line 
1"""
2Entry point for command line usage -- see ccinit for usage information.
3"""
4
5scr = __name__ == '__main__'
6import sys
7if scr:
8  import scope
9else:
10  from . import scope
11
12
13def main_entry():
14  """
15   Wrapper for use with setuptools.
16  """
17  if len(sys.argv) == 1:
18      # Show command-line info and report that you must provide arguments
19      print( scope.dreqUI.__doc__ )
20      print( "\nERROR: Please provide command-line arguments." )
21      return
22
23  if sys.argv[1] == '-v':
24      if scr:
25        from packageConfig import __version__, __versionComment__
26      else:
27        from .packageConfig import __version__, __versionComment__
28      print( 'dreqPy version %s [%s]' % (__version__,__versionComment__) )
29  elif sys.argv[1] == '--unitTest':
30      print( "Starting test suite 1" )
31      if scr:
32        import simpleCheck
33      else:
34        from . import simpleCheck
35      print( "Starting test suite 2" )
36      if scr:
37        import examples.ex203
38      else:
39        from .examples import ex203
40      print( "Tests completed" )
41  else:
42     x = scope.dreqUI(sys.argv[1:])
43     x.run()
44
45if __name__ == '__main__':
46  main_entry()
Note: See TracBrowser for help on using the repository browser.