1 | """ |
---|
2 | Entry point for command line usage -- see ccinit for usage information. |
---|
3 | """ |
---|
4 | |
---|
5 | scr = __name__ == '__main__' |
---|
6 | import sys |
---|
7 | if scr: |
---|
8 | import scope |
---|
9 | else: |
---|
10 | from . import scope |
---|
11 | |
---|
12 | |
---|
13 | def 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 | print( 'Running in python %s' % str( sys.version_info ) ) |
---|
30 | elif sys.argv[1] == '--unitTest': |
---|
31 | print( "Starting test suite 1" ) |
---|
32 | if scr: |
---|
33 | import simpleCheck |
---|
34 | else: |
---|
35 | from . import simpleCheck |
---|
36 | print( "Starting test suite 2" ) |
---|
37 | if scr: |
---|
38 | import examples.ex203 as ex203 |
---|
39 | else: |
---|
40 | from .examples import ex203 |
---|
41 | ex203.main( scope ) |
---|
42 | print( "Tests completed" ) |
---|
43 | else: |
---|
44 | x = scope.dreqUI(sys.argv[1:]) |
---|
45 | x.run() |
---|
46 | if len(scope.dreqQuery.errorLog.keys()) > 0: |
---|
47 | elog = scope.dreqQuery.errorLog |
---|
48 | print( 'ERRORS ENCOUNTERED IN scope.dreqQuery' ) |
---|
49 | for k in sorted( elog.keys() ): |
---|
50 | print ( '%s: %s' % (k,len(elog[k]) ) ) |
---|
51 | for m in sorted(list(elog[k])): |
---|
52 | print ( ' -- %s' % m ) |
---|
53 | |
---|
54 | if len(scope.volsum.table_utils.vrev.checkVar.errorLog.keys()) > 0: |
---|
55 | elog = scope.volsum.table_utils.vrev.checkVar.errorLog |
---|
56 | print( 'ERRORS ENCOUNTERED IN vrev.checkVar' ) |
---|
57 | for k in sorted( elog.keys() ): |
---|
58 | print ( '%s: %s' % (k,len(elog[k]) ) ) |
---|
59 | for m in sorted(list(elog[k])): |
---|
60 | print ( ' -- %s' % m ) |
---|
61 | if __name__ == '__main__': |
---|
62 | main_entry() |
---|