Changeset 738


Ignore:
Timestamp:
18/08/16 02:16:05 (3 years ago)
Author:
mjuckes
Message:

for python3

Location:
CMIP6dreq/trunk
Files:
3 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreq/trunk/dreqPy/dreqCmdl.py

    r725 r738  
    33""" 
    44 
    5 import scope, sys 
     5scr = __name__ == '__main__' 
     6import sys 
     7if scr: 
     8  import scope 
     9else: 
     10  from . import scope 
     11 
    612 
    713def main_entry(): 
     
    1622 
    1723  if sys.argv[1] == '-v': 
    18       from packageConfig import __version__, __versionComment__ 
     24      if scr: 
     25        from packageConfig import __version__, __versionComment__ 
     26      else: 
     27        from .packageConfig import __version__, __versionComment__ 
    1928      print( 'dreqPy version %s [%s]' % (__version__,__versionComment__) ) 
    2029  elif sys.argv[1] == '--unitTest': 
    2130      print( "Starting test suite 1" ) 
    22       import simpleCheck 
     31      if scr: 
     32        import simpleCheck 
     33      else: 
     34        from . import simpleCheck 
    2335      print( "Starting test suite 2" ) 
    24       import examples.ex203 
     36      if scr: 
     37        import examples.ex203 
     38      else: 
     39        from .examples import ex203 
    2540      print( "Tests completed" ) 
    2641  else: 
  • CMIP6dreq/trunk/dreqPy/examples/ex002.py

    r626 r738  
    88      import dreq 
    99    else: 
    10       print 'No dreq.py in specified directory' 
     10      print ( 'No dreq.py in specified directory' ) 
    1111      sys.exit(0) 
    1212  else: 
    13     print 'Specified directoty does not exist' 
     13    print  ('Specified directoty does not exist' ) 
    1414    sys.exit(0) 
    1515else: 
     
    2121 
    2222dcppLinks = [x for x in dq.coll['requestLink'].items if x.mip == 'DCPP'] 
    23 print 'Request links found for DCPP: %s' % len( dcppLinks ) 
     23print ('Request links found for DCPP: %s' % len( dcppLinks ) ) 
    2424 
    2525dcppRequestedGroups = set( [dq.inx.uid[x.refid] for x in dcppLinks] ) 
    26 print 'Request groups found for DCPP: %s' % len( dcppRequestedGroups ) 
     26print ('Request groups found for DCPP: %s' % len( dcppRequestedGroups ) ) 
    2727 
    2828dcppRequestedCmorVars = set() 
     
    3030   for x in dq.inx.iref_by_sect[vg.uid].a['requestVar']: 
    3131       dcppRequestedCmorVars.add( dq.inx.uid[x].vid ) 
    32 print 'Requested CMOR Variables found for DCPP: %s' % len( dcppRequestedCmorVars ) 
     32print ('Requested CMOR Variables found for DCPP: %s' % len( dcppRequestedCmorVars ) ) 
    3333 
  • CMIP6dreq/trunk/dreqPy/examples/ex101.py

    r626 r738  
    66 
    77ver = doc.getElementsByTagName('pav:version')[0] 
    8 print ver.firstChild.data 
     8print ( ver.firstChild.data ) 
  • CMIP6dreq/trunk/dreqPy/examples/ex102.py

    r626 r738  
    99    xmlf = fn 
    1010  else: 
    11     print 'File %s not found' % fn 
     11    print ( 'File %s not found' % fn ) 
    1212    sys.exit(0) 
    1313else: 
     
    2626    dcppLinks.append( item ) 
    2727    requestedGroups.add( item.getAttribute( 'refid' ) ) 
    28 print 'Request links found for DCPP: %s' % len( dcppLinks ) 
    2928 
    30 print 'Request groups found for DCPP: %s' % len( requestedGroups ) 
     29print ( 'Request links found for DCPP: %s' % len( dcppLinks ) ) 
     30 
     31print ( 'Request groups found for DCPP: %s' % len( requestedGroups ) ) 
    3132 
    3233sect = doc.getElementsByTagName( 'requestVar' )[0] 
     
    3637    cmorVars.add(  item.getAttribute( 'vid' ) ) 
    3738 
    38 print 'CMOR variables requested by DCPP: %s' % len(cmorVars) 
     39print ( 'CMOR variables requested by DCPP: %s' % len(cmorVars) ) 
  • CMIP6dreq/trunk/dreqPy/examples/ex202.py

    r634 r738  
    77      import scope 
    88    else: 
    9       print 'No scope.py in specified directory' 
     9      print ( 'No scope.py in specified directory' ) 
    1010      sys.exit(0) 
    1111  else: 
    12     print 'Specified directoty does not exist' 
     12    print  ('Specified directoty does not exist' ) 
    1313    sys.exit(0) 
    1414else: 
  • CMIP6dreq/trunk/dreqPy/scope.py

    r717 r738  
    2525  mlg = mlog3() 
    2626else: 
    27   from utilP2 import mlog 
    28   mlg = mlog() 
     27  from utilP2 import util 
     28  mlg = util.mlog() 
    2929 
    3030class c1(object): 
     
    978978 
    979979    v0 = self.sc.volByMip( self.adict['m'], pmax=pmax, intersection=self.intersection, adsCount=adsCount, exptid=eid ) 
    980     #mlg.prnt ( '%7.2fTb' % (v0*2.*1.e-12) ) 
    981980    mlg.prnt ( 'getVolByMip: %s [%s]' % (v0,makeTables.vfmt(v0*2.)) ) 
    982981    cc = collections.defaultdict( int ) 
  • CMIP6dreq/trunk/dreqPy/simpleCheck.py

    r717 r738  
    1 from __init__ import DOC_DIR 
     1from .__init__ import DOC_DIR 
    22import string, os, sys, collections 
    33 
     
    7979class check1(checkbase): 
    8080  def _ch01_importDreq(self): 
    81     import dreq 
     81    from . import dreq 
    8282    print ( 'Dreq software import checked' ) 
    8383    self.ok = True 
    8484 
    8585  def _ch02_importSample(self): 
    86     import dreq 
     86    from . import dreq 
    8787    self.dq = dreq.loadDreq( manifest='%s/dreqManifest.txt' % self.docdir  ) 
    8888    print ( 'Dreq sample load checked' ) 
     
    9191  def _ch03_linkCheck(self): 
    9292    nn = 0 
    93     import dreq 
     93    from . import dreq 
    9494    self.dq = dreq.loadDreq( manifest='%s/dreqManifest.txt' % self.docdir  ) 
    9595    for section in self.dq.coll : 
  • CMIP6dreq/trunk/setup.py

    r474 r738  
    88 
    99NAME = "dreqPy" 
    10 PACKAGES = find_packages(exclude=["tests*"]) 
     10python2 = True 
     11if sys.version_info[0] == 3: 
     12  PACKAGES = find_packages(exclude=["tests*","dreqPy.utilP2"]) 
     13  python2 = False 
     14else: 
     15  PACKAGES = find_packages(exclude=["tests*"]) 
     16 
    1117META_PATH = os.path.join("dreqPy", "packageConfig.py") 
    1218KEYWORDS = ["CMIP6"] 
Note: See TracChangeset for help on using the changeset viewer.