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):
         po = pid.replace(pt,pc)
         createDirectories(po)
         copyFile(options.configFile,po)
         print '... finally copying ' + options.configFile

      print '\n... now packaging ' + cfgname
      zip(cfgname,pc,cfg['ZIPPER'])

      print '\n... now cleaning '
      removeDirectories(pc)

   if options.archiveName != '':
      print '\n... now packaging ' + cfgname + ' into ' + archive
      zip(path.basename(archive),archive,cfg['ZIPPER']) # /!\ use the last cfg value

      print '\n... now cleaning ' + archive
      removeDirectories(archive)

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   print '\n\nMy work is done\n\n'

   sys.exit()
def runCAS(cfgName,cfg,codeName,casFile,options):

   # ~~~~ Read the DICO File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   dicoFile = path.join(path.join(cfg['MODULES'][codeName]['path'],'lib'),codeName+cfg['TELVER']+'.dico')
   frgb,dico = scanDICO(dicoFile)
   iFS,oFS = getIOFilesSubmit(frgb,dico)

   # ~~ Read the principal CAS File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   if not path.exists(casFile):
      print '... inexistent CAS file: ',casFile
      return None    # /!\ should you stop or carry on ?
   cas,lang = processCAS(casFile,frgb)
   if not checkConsistency(cas,dico,frgb,cfg):
      print '... inconsistent CAS file: ',casFile
      print '    +> you may be using an inappropriate configuration:',cfgName
      print '    +> or may be wishing for scalar mode while using parallel'
      return None   # /!\ should you stop or carry on ?

   # ~~ Handling Directories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   CASDir = path.dirname(casFile)
   TMPDir = processTMP(casFile)

   # ~~ Read the included CAS File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cplages,defaut = getKeyWord('COUPLING WITH',cas,dico,frgb)
   #/!\ having done the loop this way it will not check for DELWAQ
   COUPLAGE = {}
   for cplage in cplages:
      for mod in cfg['MODULES'].keys():
         if mod in cplage.lower():

            # ~~~~ Extract the CAS File name ~~~~~~~~~~~~~~~~~~~~~~~
            casFilePlage,defaut = getKeyWord(mod.upper()+' STEERING FILE',cas,dico,frgb)
            if casFilePlage == []: casFilePlage = defaut
            casFilePlage = path.join(CASDir,casFilePlage[0])
            if not path.isfile(casFilePlage):
               print '... missing coupling CAS file for',mod,': ',casFilePlage
               return None   # /!\ should you stop or carry on ?

            # ~~~~ Read the DICO File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            dicoFilePlage = path.join(path.join(cfg['MODULES'][mod]['path'],'lib'),mod+cfg['TELVER']+'.dico')
            frgbPlage,dicoPlage = scanDICO(dicoFilePlage)
            iFSPlage,oFSPlage = getIOFilesSubmit(frgbPlage,dicoPlage)

            # ~~ Read the coupled CAS File ~~~~~~~~~~~~~~~~~~~~~~~~~
            casPlage,lang = processCAS(casFilePlage,frgbPlage)
            if not checkConsistency(casPlage,dicoPlage,frgbPlage,cfg):
               print '... inconsistent CAS file: ',casFilePlage
               return None   # /!\ should you stop or carry on ?

            COUPLAGE.update({mod:{}})
            COUPLAGE[mod].update({'cas':casPlage,'frgb':frgbPlage,'iFS':iFSPlage,'oFS':oFSPlage,'dico':dicoPlage})

   # ~~ Handling sortie file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sortiefile = None
   if options.sortieFile:
      # define the filename (basename) of the sortie file
      sortiefile =  path.basename(TMPDir)+'.sortie'

   # ~~ Handling all input files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   # >>> Placing yourself where the CAS File is
   chdir(CASDir)
   # >>> Copy INPUT files into TMPDir
   if not processLIT(cas,iFS,TMPDir): sys.exit()
   for mod in COUPLAGE.keys():
      if not processLIT(COUPLAGE[mod]['cas'],COUPLAGE[mod]['iFS'],TMPDir): sys.exit()
   # >>> Placing yourself into the TMPDir
   chdir(TMPDir)
   # >>> Creating LNG file
   processCONFIG(lang)

   # ~~ Handling Executable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   # >>> Names for the executable set
      #> names within TMPDir
   f90File = iFS['FICHIER FORTRAN'].split(';')[1]
      #> aggregation of PRINCI files
   for mod in COUPLAGE.keys():
      f90FilePlage = COUPLAGE[mod]['iFS']['FICHIER FORTRAN'].split(';')[1]
      if path.isfile(f90FilePlage):
         putFileContent(f90File,getFileContent(f90File)+['']+getFileContent(f90FilePlage))
         remove(f90FilePlage)
   objFile = path.splitext(f90File)[0] + cfg['SYSTEM']['SFX_OBJ']
      #> default executable name
   exeFile = path.join(path.join(cfg['MODULES'][codeName]['path'],cfgName),codeName+cfg['TELVER']+cfg['SYSTEM']['SFX_EXE'])
      #> user defined executable name
   useFile = exeFile
   value,defaut = getKeyWord('FICHIER FORTRAN',cas,dico,frgb)
   if value != []:
      useFile = path.join(CASDir,path.splitext(value[0])[0]+cfg['SYSTEM']['SFX_EXE'])
      if path.exists(useFile) and cfg['REBUILD'] > 0: remove(useFile)
      #> default command line compilation and linkage
   if not path.exists(path.join(path.join(cfg['MODULES'][codeName]['path'],cfgName),codeName+cfg['TELVER']+'.cmdo')):
      print '\nNot able to find your OBJECT command line: ' + path.join(cfgName,codeName+cfg['TELVER']+'.cmdo') + '\n'
      print ' ... you have to compile this module at least: '
      print '    +> ',codeName
      sys.exit()
   objCmd = getFileContent(path.join(path.join(cfg['MODULES'][codeName]['path'],cfgName),codeName+cfg['TELVER']+'.cmdo'))[0]
   if not path.exists(path.join(path.join(cfg['MODULES'][codeName]['path'],cfgName),codeName+cfg['TELVER']+'.cmdx')):
      print '\nNot able to find your OBJECT command line: ' + path.join(cfgName,codeName+cfg['TELVER']+'.cmdx') + '\n'
      print ' ... you have to compile this module at least: '
      print '    +> ',codeName
      sys.exit()
   exeCmd = getFileContent(path.join(path.join(cfg['MODULES'][codeName]['path'],cfgName),codeName+cfg['TELVER']+'.cmdx'))[0]
   # >>> Compiling the executable if required
   if not processExecutable(useFile,objFile,f90File,objCmd,exeCmd,CASDir): sys.exit()

   # >>> Rename executable because of firewall issues ~~~~~~~~~~~~~~
   runCmd = path.join(TMPDir,'out_'+path.basename(useFile))
   shutil.move(path.basename(useFile),runCmd)

   if not options.compileonly:

   # ~~ Handling the parallelisation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ncsize = getNCSIZE(cas,dico,frgb)
      
      if ncsize > 1:
      # >>> MPI configuration
         # ~~> Executable                  /!\ you need one if ncsize > 1
         mpiCmd = ''
         if cfg.has_key('MPI'):
            if cfg['MPI'].has_key('EXEC'):
               mpiCmd = cfg['MPI']['EXEC']
         if mpiCmd == '':
            print '... I do not know how to run MPI, can you help ?'
            return None   # /!\ should you stop or carry on ?
         # ~~> Assign the mpi_telemac.conf
         hosts = ''
         if cfg.has_key('MPI'):
            if cfg['MPI'].has_key('HOSTS'):
               hosts = cfg['MPI']['HOSTS']
         # ~~> MPI Command line
         mpiCmd = mpiCmd.replace('<wdir>','-wdir '+TMPDir)   # /!\ Make sure TMPDir works in UNC convention
         mpiCmd = mpiCmd.replace('<ncsize>','-n '+str(ncsize))
         mpiCmd = mpiCmd.replace('<hosts>',hosts)
         mpiCmd = mpiCmd.replace('<exename>',runCmd)
         runCmd = mpiCmd

      # >>> Parallel tools
         # ~~> Default path
         PARDir = path.join(cfg['MODULES']['parallel']['path'],cfgName)
         # ~~> User path
         if cfg.has_key('PARALLEL'):
            if cfg['PARALLEL'].has_key('PATH'):
               PARDir = cfg['PARALLEL']['PATH'].replace('<root>',cfg['TELDIR']).replace('<config>',path.join(cfg['MODULES']['parallel']['path'],cfgName))
         # ~~> Creating PARA file and the mpi_telemac.conf
         processPARALLEL(ncsize,TMPDir+sep)  # /!\ Make sure TMPDir works in UNC convention

      # >>> Running the partionning
      if ncsize > 1:
         # ~~> PARTEL Executable
         exeCmd = path.join(PARDir,'partel'+cfg['SYSTEM']['SFX_EXE'])
         # ~~> Run PARTEL
         CONLIM = getCONLIM(cas,iFS)      # no check on existence
         runPartition(exeCmd,cas,CONLIM,iFS,ncsize)
         for mod in COUPLAGE.keys():
            CONLIM = getCONLIM(COUPLAGE[mod]['cas'],COUPLAGE[mod]['iFS'])
            runPartition(exeCmd,COUPLAGE[mod]['cas'],CONLIM,COUPLAGE[mod]['iFS'],ncsize)

      # >>> Running the Executable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      print runCmd
      if not runCode(runCmd,sortiefile): sys.exit()

      # >>> Handling the recollection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      if ncsize > 1:
         # ~~> GRETEL Executable
         exeCmd = path.join(PARDir,'gretel_autop'+cfg['SYSTEM']['SFX_EXE'])
         # ~~> Run GRETEL
         GLOGEO = getGLOGEO(cas,iFS)      # no check on existence
         runRecollection(exeCmd,cas,GLOGEO,oFS,ncsize)
         for mod in COUPLAGE.keys():
            GLOGEO = getGLOGEO(COUPLAGE[mod]['cas'],COUPLAGE[mod]['iFS'])
            runRecollection(exeCmd,COUPLAGE[mod]['cas'],GLOGEO,COUPLAGE[mod]['oFS'],ncsize)

   # ~~ Handling all output files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      if not processECR(cas,oFS,CASDir,TMPDir,sortiefile,ncsize): sys.exit()
      for mod in COUPLAGE.keys():
         if not processECR(COUPLAGE[mod]['cas'],COUPLAGE[mod]['oFS'],CASDir,TMPDir,'',ncsize): sys.exit()

   # ~~ Handling Directories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   chdir(CASDir)
   if options.tmpdirectory or options.compileonly: removeDirectories(TMPDir)

   return sortiefile