def createObjFiles(oname,oprog,odict,ocfg):
   # ~~ Assumes that the source filenames are in lower case ~~~~~~~~
   Root,Suffix = path.splitext(oname)

   # ~~ Directories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   chdir(odict['path'])
   ObjDir = path.join(path.dirname(odict['path']),ocfg)
   createDirectories(ObjDir)

   # ~~ Removes exisitng objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   if odict['type'] == 'M' :
      ModFile = path.join(ObjDir,Root + cfg['SYSTEM']['SFX_MOD'])
      if path.exists(ModFile): remove(ModFile)
   ObjFile = path.join(ObjDir,Root + cfg['SYSTEM']['SFX_OBJ'])
   if path.exists(ObjFile): remove(ObjFile)

   # ~~ creation of the module (according to makefile.wnt + systel.ini):
   # ~~ ifort.exe /c /Ot /names:uppercase /convert:big_endian /extend_source:132 /include:..\..\..\postel3d\postel3d_V5P9\1 declarations_postel3d.f
   cmd = cfg['COMPILER']['CMD_OBJ']
   incs = cfg['MODULES'][odict['libname']]['incs']
   cmd = cmd.replace('<incs>',incs)
   mods = ''
   for mod in HOMERES[oprog]['deps']:
      mods = mods + path.join(cfg['MODULES'][odict['libname']]['mods'].replace('<config>',cfg['MODULES'][mod]['path']),ocfg) + ' '
   #mods = mods + path.join(cfg['MODULES'][odict['libname']]['mods'].replace('<config>',cfg['MODULES'][odict['libname']]['path']),ocfg) + ' '
   cmd = cmd.replace('<mods>',mods)
   cmd = cmd.replace('<f95name>',oname)
   cmd = cmd.replace('<config>',ObjDir).replace('<root>',cfg['TELDIR'])

   if debug : print cmd
   failure = system(cmd)
   if not failure:
      if odict['type'] == 'M' :
         print '   - created ' + ObjFile + ' and ' + ModFile
         shutil.move(Root.lower()+cfg['SYSTEM']['SFX_OBJ'],ObjDir)
         shutil.move(Root.lower()+cfg['SYSTEM']['SFX_MOD'],ObjDir)
      else :
         print '   - created ' + ObjFile
         shutil.move(Root.lower()+cfg['SYSTEM']['SFX_OBJ'],ObjDir)
      odict['time'] = 1
      #and remove .f from objList
      return True
   else: return False
Example #2
0
import sys

from PyQt5.QtWidgets import QApplication

from utils import createDirectories
from gui.Form import Form

if __name__ == "__main__":
    createDirectories()
    app = QApplication(sys.argv)
    form = Form()
    form.show()
    sys.exit(app.exec_())
      print '\nNot able to get to find your configuration in the configuration file: ' + options.configFile + '\n'
      sys.exit()

   cfg = parseConfig_DoxygenTELEMAC(cfgname)[cfgname]

   debug = False

   # ~~ Scans all source files to build a relation database ~~
   print '\n\nScanning the source code\n\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
   fic,mdl,sbt,fct,prg,dep,all = scanSources(cfgname,cfg,False)

   # ~~ Scans all source files to update Doxygen ~~~~~~~~~~~~~~~~
   for mod in fic.keys():
      print '\nCreating the DOXYGEN Headers for ' + mod + '\n\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
      for ifile in fic[mod].keys():

         # ~~ Read the content of the source file ~~~~~~~~~~~~
         ilines = getFileContent(ifile)
         # ~~ Update its Doxygen content ~~~~~~~~~~~~~~~~~~~~~
         olines = createDOXYGEN(ilines,mod,len(fic[mod][ifile]),all)
         # ~~ Make sure the distination exists ~~~~~~~~~~~~~~~
         ofile = ifile.replace(cfg['TELDIR'],path.join(cfg['TELDIR'],cfgname))
         createDirectories(path.dirname(ofile))
         # ~~ Write the content of the source file ~~~~~~~~~~~
         putFileContent(ofile,olines)

   sys.exit()

         else:
            pc = path.join(path.join(pt,options.archiveName),cfgname)
            archive = path.join(pt,options.archiveName)

      dirs = ['sources','lib',cfgname]
      for mod in cfg['MODULES'].keys():
         print '... now extracting ' + mod
         pi = cfg['MODULES'][mod]['path']
         if not path.exists(pi):
            print '\nNot able to find the path: ' + pi + '\n'
            sys.exit()
         for d in dirs:
            pid = path.join(pi,d)
            if path.exists(pid) :
               po = pid.replace(pt,pc)
               createDirectories(po)
               copyFiles(pid,po)
               print '    +> '+pid

      dirs = ['bin','pytel']
      for d in dirs:
         print '... now extracting ' + d
         pid = path.join(pt,d)
         if path.exists(pid) :
            po = pid.replace(pt,pc)
            createDirectories(po)
            copyFiles(pid,po)
            print '    +> '+pid

      pid = path.join(pt,'config')
      if path.exists(pid):
   if options.configName == '':
      cfgname = cfgnames[0]
   if cfgname not in cfgnames:
      print '\nNot able to get to find your configurtaion in the configuration file: ' + options.configFile + '\n'
      print ' ... use instead:'
      for cfgname in cfgnames : print '    +> ',cfgname
      sys.exit()

   # still in lower case
   if options.rootDir != '': cfgs[cfgname]['root'] = path.abspath(options.rootDir)
   if options.version != '': cfgs[cfgname]['version'] = options.version
   if options.doxyDir == '':
      cfgs[cfgname].update({'doxydocs':path.join(cfgs[cfgname]['root'],cfgname)})
   else:
      cfgs[cfgname].update({'doxydocs':options.doxyDir})
   if not path.isdir(cfgs[cfgname]['doxydocs']): createDirectories(cfgs[cfgname]['doxydocs'])
   # parsing for proper naming
   cfg = parseConfig_DoxygenTELEMAC(cfgs[cfgname])
   print '\n\nScanning the source code for:\n\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
   print '    +> configuration: ' +  cfgname
   print '    +> root:          ' +  cfgs[cfgname]['root']
   print '    +> version        ' +  cfgs[cfgname]['version'] + '\n\n\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'

   # ~~ Scans all source files to build a relation database ~~
   fic,mdl,sbt,fct,prg,dep,all = scanSources(cfgname,cfg,BYPASS)

   # ~~ Scann all source files to update Doxygen ~~~~~~~~~~~~~~~~
   for mod in fic.keys():
      print '\nCreating the DOXYGEN headers for ' + mod + '\n\