]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
CCAR: update V5_1_4_BR branch with the patch V5_1_4p1 committed in main branch V5_1_4_BR V5_1_4p2
authorcaremoli <caremoli>
Mon, 6 Dec 2010 17:26:59 +0000 (17:26 +0000)
committercaremoli <caremoli>
Mon, 6 Dec 2010 17:26:59 +0000 (17:26 +0000)
Examples/ast2/components.py
Examples/context.py
module_generator/astcompo.py
module_generator/aster_tmpl.py

index 68fc30fffa95400e06030e50adc36768539c6734..3a7570337a89986de739dc69eda5d122337d2f86 100644 (file)
@@ -29,7 +29,6 @@ execfile("../context.py")
 aster_root=os.path.join(aster_home,aster_version)
 
 fcompodir=os.path.join(os.getcwd(),"fcompo")
-myasterdir=os.path.join(os.getcwd(),"myaster","bibpyt")
 
 install_prefix="./install"
 appli_dir="appli"
index 2b4fdb567a73ae444b0ff9419d06ed54b921007e..cb63bc68b138296ee794a74470182476fcdb2904 100644 (file)
@@ -21,11 +21,11 @@ import os
 
 KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","/local/cchris/Salome/Install/KERNEL_V5")
 GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","/local/cchris/Salome/Install/GUI_V5")
-YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V5_1_main")
+YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V5")
 
 context={'update':1,
          "makeflags":"",
-         "prerequisites":"/local/cchris/.packages.d/envSalome5",
+         "prerequisites":"/local/cchris/.packages.d/envSalome51main",
          "kernel":KERNEL_ROOT_DIR,
         }
 
index 1df053d46927c1ef9f8ec1bd2eecf2084115e346..9e1e94de56c545f1820cc38e16181d6b279e5e00 100644 (file)
@@ -117,11 +117,15 @@ class ASTERComponent(Component):
     if self.kind == "lib":
       makefileItems["salomepython_PYTHON"]=[self.name+".py"]
     elif self.kind == "exe":
-      makefileItems["salomepython_PYTHON"]=[self.name+"_module.py",self.name+"_component.py","E_SUPERV.py"]
+      makefileItems["salomepython_PYTHON"]=[self.name+"_module.py",self.name+"_component.py"]
+      if self.version < (10,1,2):
+        makefileItems["salomepython_PYTHON"].append("E_SUPERV.py")
       makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
       makefileItems["salomeres_DATA"]=[self.name+"_config.txt"]
     elif self.kind == "cexe":
-      makefileItems["salomepython_PYTHON"]=[self.name+".py",self.name+"_container.py","E_SUPERV.py"]
+      makefileItems["salomepython_PYTHON"]=[self.name+".py",self.name+"_container.py"]
+      if self.version < (10,1,2):
+        makefileItems["salomepython_PYTHON"].append("E_SUPERV.py")
       makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
       makefileItems["salomeres_DATA"]=[self.name+"_config.txt"]
     return makefileItems
@@ -130,18 +134,19 @@ class ASTERComponent(Component):
   def makeexepath(self, gen):
     """standalone component: generate files for calculation code"""
 
-    #copy and patch E_SUPERV.py
-    fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
-    esuperv = fil.read()
-    fil.close()
+    fdict={}
 
     if self.version < (10,1,2):
       #patch to E_SUPERV.py
+      fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
+      esuperv = fil.read()
+      fil.close()
       esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv)
       esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv)
       esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv)
       esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv)
       esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv)
+      fdict["E_SUPERV.py"]=esuperv
 
     #use a specific main program (modification of config.txt file)
     fil = open(os.path.join(self.aster_dir, "config.txt"))
@@ -154,29 +159,27 @@ class ASTERComponent(Component):
                       'site-packages','salome','%s_component.py'%self.name)
     config = re.sub("Execution\/E_SUPERV.py", path, config)
 
-    fdict= {
-             "%s_component.py"%self.name:component.substitute(component=self.name),
-             "%s_config.txt" % self.name:config,
-             "E_SUPERV.py":esuperv,
-           }
+    fdict["%s_config.txt" % self.name] = config
+    fdict["%s_component.py" % self.name] = component.substitute(component=self.name)
+
     return fdict
 
   def makecexepath(self, gen):
     """specific container: generate files"""
 
-    #copy and patch E_SUPERV.py
-    fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
-    esuperv = fil.read()
-    fil.close()
+    fdict={}
 
     if self.version < (10,1,2):
       #patch to E_SUPERV.py
+      fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
+      esuperv = fil.read()
+      fil.close()
       esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv)
       esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv)
       esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv)
       esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv)
       esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv)
-
+      fdict["E_SUPERV.py"]=esuperv
 
     #use a specific main program
     fil = open(os.path.join(self.aster_dir, "config.txt"))
@@ -188,11 +191,9 @@ class ASTERComponent(Component):
                       'site-packages','salome','%s_container.py' % self.name)
     config = re.sub("Execution\/E_SUPERV.py", path, config)
 
-    fdict= {
-             "%s_container.py" % self.name:container,
-             "%s_config.txt" % self.name:config,
-             "E_SUPERV.py":esuperv,
-           }
+    fdict["%s_container.py" % self.name] = container
+    fdict["%s_config.txt" % self.name] = config
+
     return fdict
 
   def makeexeaster(self, gen):
@@ -228,11 +229,11 @@ class ASTERComponent(Component):
       outparams = ",".join(params)
       rvars = ",".join(datas)
 
-      service = asterEXEService.substitute(component=self.name, 
-                                           service=serv.name, 
+      service = asterEXEService.substitute(component=self.name,
+                                           service=serv.name,
                                            inparams=inparams,
-                                           outparams=outparams, 
-                                           body=serv.body, 
+                                           outparams=outparams,
+                                           body=serv.body,
                                            dvars=dvars, rvars=rvars)
       streams = []
       for name, typ, dep in serv.instream:
@@ -248,11 +249,20 @@ class ASTERComponent(Component):
       services.append(service)
       inits.append(init)
 
+    if self.version < (10,1,2):
+      importesuperv="from E_SUPERV import SUPERV"
+    else:
+      importesuperv="""sys.path=["%s"]+sys.path
+from Execution.E_SUPERV import SUPERV
+""" % os.path.join(self.aster_dir, "bibpyt")
+
     return asterEXECompo.substitute(component=self.name, module=gen.module.name,
-                                    servicesdef="\n".join(defs), 
-                                    servicesimpl="\n".join(services), 
+                                    servicesdef="\n".join(defs),
+                                    servicesimpl="\n".join(services),
                                     initservice='\n'.join(inits),
-                                    aster_dir=self.aster_dir)
+                                    aster_dir=self.aster_dir,
+                                    importesuperv=importesuperv,
+                                    )
 
   def makecexeaster(self, gen):
     """specific container: generate SALOME component source"""
@@ -286,11 +296,11 @@ class ASTERComponent(Component):
       outparams = ",".join(params)
       rvars = ",".join(datas)
 
-      service = asterCEXEService.substitute(component=self.name, 
-                                            service=serv.name, 
+      service = asterCEXEService.substitute(component=self.name,
+                                            service=serv.name,
                                             inparams=inparams,
-                                            outparams=outparams, 
-                                            body=serv.body, 
+                                            outparams=outparams,
+                                            body=serv.body,
                                             dvars=dvars, rvars=rvars)
       streams = []
       for name, typ, dep in serv.instream:
@@ -308,12 +318,21 @@ class ASTERComponent(Component):
       services.append(service)
       inits.append(init)
 
+    if self.version < (10,1,2):
+      importesuperv="from E_SUPERV import SUPERV"
+    else:
+      importesuperv="""sys.path=["%s"] +sys.path
+from Execution.E_SUPERV import SUPERV
+""" % os.path.join(self.aster_dir, "bibpyt")
+
     return asterCEXECompo.substitute(component=self.name, 
                                      module=gen.module.name,
                                      servicesdef="\n".join(defs), 
                                      servicesimpl="\n".join(services), 
                                      initservice='\n'.join(inits),
-                                     aster_dir=self.aster_dir)
+                                     aster_dir=self.aster_dir,
+                                     importesuperv=importesuperv,
+                                     )
 
   def getImpl(self):
     if self.kind == "cexe":
index b871375b4adb34a5f7dc37be0dc0aa8c9103aa8d..392259001fac5a87f7b454cc930196441774074d 100644 (file)
@@ -83,7 +83,7 @@ import calcium
 import dsccalcium
 import SALOME
 import linecache
-from E_SUPERV import SUPERV
+${importesuperv}
 
 try:
   import numpy