Changeset 735


Ignore:
Timestamp:
17/08/16 21:45:16 (4 years ago)
Author:
mjuckes
Message:

dual python imports ....

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/dreqCmdl.py

    r734 r735  
    33""" 
    44 
    5 ## this enable python3 cleanly (replacing "import scope") 
    6 ## but does not work as __main__ 
     5scr = __name__ == '__main__' 
    76import sys 
    8 from . import scope 
     7if scr: 
     8  import scope 
     9else: 
     10  from . import scope 
     11 
    912 
    1013def main_entry(): 
     
    1922 
    2023  if sys.argv[1] == '-v': 
    21       from .packageConfig import __version__, __versionComment__ 
     24      if scr: 
     25        from packageConfig import __version__, __versionComment__ 
     26      else: 
     27        from .packageConfig import __version__, __versionComment__ 
    2228      print( 'dreqPy version %s [%s]' % (__version__,__versionComment__) ) 
    2329  elif sys.argv[1] == '--unitTest': 
    2430      print( "Starting test suite 1" ) 
    25       import simpleCheck 
     31      if scr: 
     32        import simpleCheck 
     33      else: 
     34        from . import simpleCheck 
    2635      print( "Starting test suite 2" ) 
    27       from .examples import ex203 
     36      if scr: 
     37        import examples.ex203 
     38      else: 
     39        from .examples import ex203 
    2840      print( "Tests completed" ) 
    2941  else: 
Note: See TracChangeset for help on using the changeset viewer.