예제 #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Docstring: replace
"""
import os, os.path, sys, checkenv

libdir = checkenv.chk_sufficient()
prgname, prgdir = checkenv.get_names(__file__)


###########   M A I N   #######################################################
def main():
    """ Main part for doing the work
  """
    dbg.entersub()
    dbg.dprint(0, "Example to show usage of dbg and cfg:\n", " cfg.data:",
               cfg.data, "cfg.keys():", list(cfg.keys()))
    dbg.leavesub()


###########   D E F A U L T   I N I T   #######################################
if __name__ == "__main__":
    from mydebug.py3dbg import dbg
    from myconf.py3cfg import init_cfg
    cfg = init_cfg(prgname, prgdir, libdir, dbg)
    exec(cfg.imports)
    exec(cfg.usage)
    main()
예제 #2
0
        path = os.path.join(top, nm)
        dbg.dprint(4,path)
        #if nm.startswith(prgname) and '_' not in nm and nm.endswith('.py') :
        if nm == prgname+'.py' :
          fullname = os.path.join(top, nm)
          dbg.dprint(2,"found", fullname )
          ##### Execute the first found python prog and 
          from subprocess import Popen
          dbg.setlvl()
          if "--DEBUG" in sys.argv[1:] or "--DEBUG+" in sys.argv[1:]:
            dbg.dprint(0,  py,fullname, ' '.join(prgargs[0:]),"\n")   
          p = Popen([py] + [fullname] + prgargs[0:])
          p.wait()
          #dbg.leavesub()
          return
        
  ##### Nothing found      
  print(prgname, "could not be found")
  
##############################################################################
### ----------------------------------------------------
if __name__ == "__main__":
  from mydebug.py3dbg import dbg
  from myconf.py3cfg  import init_cfg
  cfg = init_cfg(rshort,realdir,libdir,dbg)
  #dbg.dprint(0,type(cfg), cfg.data.pythons)
  import myfile.search
  py = myfile.search.get_latest_python3(sys.argv,cfg['data']['pythons'])
  main()