예제 #1
0
파일: init.py 프로젝트: LCPQ/irpf90
def init():

  global initialized
  if initialized:
     return

  # Create directories
  for dir in [ irpf90_t.irpdir, irpf90_t.mandir ]:
    try:
      wd = os.getcwd()
      os.chdir(dir)
      os.chdir(wd)
    except OSError:
      os.mkdir(dir)

  for dir in command_line.include_dir:
    dir = irpf90_t.irpdir+dir
    try:
      wd = os.getcwd()
      os.chdir(dir)
      os.chdir(wd)
    except OSError:
      os.mkdir(dir)

  # Create makefile
  makefile.create()
  
  # Copy current files in the irpdir
  for dir in ['./']+command_line.include_dir:
    try:
      os.stat(dir)
    except:
      print dir,'not in dir'
      continue
    for filename in os.listdir(dir):
      filename = dir+filename
      if not filename.startswith(".") and not os.path.isdir(filename):
        try:
          file  = open(filename,"r")
        except IOError:
          if command_line.do_warnings:
              print "Warning : Unable to read file %s."%(filename)
        else:
          buffer = file.read()
          file.close()
          if not util.same_file(irpf90_t.irpdir+filename,buffer):
            file = open(irpf90_t.irpdir+filename,"w")
            file.write(buffer)
            file.close()

  initialized = True
예제 #2
0
파일: init.py 프로젝트: v1j4y/irpf90
def init():

  global initialized
  if initialized:
     return

  # Create directories
  for dir in [ irpf90_t.irpdir, irpf90_t.mandir ]:
    try:
      wd = os.getcwd()
      os.chdir(dir)
      os.chdir(wd)
    except OSError:
      os.mkdir(dir)

  # Create makefile
  makefile.create()
  
  # Copy current files in the irpdir
  for filename in os.listdir(os.getcwd()):
    if not filename[0].startswith(".") and not os.path.isdir(filename):
      try:
        file  = open(filename,"r")
      except IOError:
        print "Warning : Unable to read file %s."%(filename)
      else:
        buffer = file.readlines()
        file.close()
        if not util.same_file(irpf90_t.irpdir+filename,buffer):
          file  = open(filename,"r")
          buffer = file.read()
          file.close()
          file = open(irpf90_t.irpdir+filename,"w")
          file.write(buffer)
          file.close()

  initialized = True
예제 #3
0
파일: irpf90.py 프로젝트: v1j4y/irpf90
def main():
  from command_line import command_line

  vim.install()

  if command_line.do_help:
    command_line.usage()

  if command_line.do_version:
    from version import version
    print version

  from init import init
  if command_line.do_init:
    init()

  if command_line.do_preprocess:
    init()
    from preprocessed_text import preprocessed_text
    for filename,text in preprocessed_text:
      if filename in command_line.preprocessed:
        for line in text:
          print line.text


  if command_line.do_touch:
    from variables import variables
    for var in command_line.touched:
      if var not in variables:
        print "%s is not an IRP entity"%(var,)
      else:
        print "%s touches the following entities:"%(var,)
        parents = variables[var].parents
        parents.sort()
        for x in parents:
          print "- %s"%(x,)

  if not command_line.do_run:
    return


  init()

  import irp_stack
  irp_stack.create()

  import makefile
  makefile.create()

  from modules import modules, write_module
  for m in modules.keys():
    write_module(modules[m])

  makefile.run()

  import touches
  touches.create()

  import create_man
  create_man.run()

  if command_line.do_profile:
    import profile
    profile.run()
예제 #4
0
def main():

  vim.install()

  if command_line.do_help:
    command_line.usage()

  if command_line.do_version:
    from version import version
    print version

  from init import init
  if command_line.do_init:
    init()

  if command_line.do_preprocess:
    init()
    from preprocessed_text import preprocessed_text
    for filename,text in preprocessed_text:
      if filename in command_line.preprocessed:
        for line in text:
          print line.text


  if command_line.do_touch:
    from variables import variables
    for var in command_line.touched:
      if var not in variables:
        print "%s is not an IRP entity"%(var,)
      else:
        print "Touching %s invalidates the following entities:"%(var,)
        parents = variables[var].parents
        parents.sort()
        for x in parents:
          print "- %s"%(x,)

  if command_line.do_codelet:
     import profile
     profile.build_rdtsc()
     import codelet
     codelet.run()

  if not command_line.do_run:
     return

  init()

  import irp_stack
  irp_stack.create()

  import makefile
  makefile.create()

  from modules import modules, write_module
  for m in modules.keys():
    write_module(modules[m])

  makefile.run()

  import touches
  touches.create()

#  import checkpoint
#  checkpoint.create()

  import create_man
  create_man.run()

  if command_line.do_profile:
    import profile
    profile.run()

  if command_line.do_openmp:
    import locks
    locks.create()