]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
Merge branch 'master' into omu/pleiade8084 (cmake support)
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Mon, 8 Sep 2014 13:29:19 +0000 (15:29 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Mon, 8 Sep 2014 13:29:19 +0000 (15:29 +0200)
* master:
  Fix some documentation issues
  Version update: 7.4.1
  Replace "runSession" calls by "salome shell".
  Update documentation in "Examples"
  Add a test for most of the examples.
  Fixed regression when creating executable components.
  Fix localhost resource in an example schema.
  Build script added for every example.
  Examples updated for the new API which generates modules for cmake.
  Autotools replaced by cmake in generated modules.

Conflicts:
module_generator/astcompo.py

module_generator/astcompo.py

index d5a001975bfabcfa24d0e98bfba0e1efca5885dc..a6dadbdab34520e5ce5ba70b88f50278ecfb1381 100644 (file)
@@ -68,6 +68,7 @@ class ASTERComponent(Component):
     self.python_path = python_path or []
     self.argv = argv or []
     self.exe_path = exe_path
+    self.aster_version_type = aster_version_type
     Component.__init__(self, name, services, impl="ASTER", libs=libs, 
                              rlibs=rlibs, kind=kind)
 
@@ -117,19 +118,19 @@ class ASTERComponent(Component):
       
     return aster_python_path
 
-  def getConfig(self, gen):
-    """Content of the config.txt file
-    """
-    path_compo=os.path.join(os.path.abspath(gen.module.prefix),'lib',
-                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
-                      'site-packages','salome','%s_component.py'%self.name)
-    conf="""ENV_SH         | env     | -     | $ASTER_VERSION_DIR/share/aster/profile.sh
-BINELE         | bin     | -     | $ASTER_VERSION_DIR/share/aster/elements
-SRCPY          | src     | -     | %s
-ARGPYT         | exec    | -     | %s
-""" % (self.getAsterPythonPath(), path_compo)
-    
-    return conf
+#  def getConfig(self, gen):
+#    """Content of the config.txt file
+#    """
+#    path_compo=os.path.join(os.path.abspath(gen.module.prefix),'lib',
+#                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
+#                      'site-packages','salome','%s_component.py'%self.name)
+#    conf="""ENV_SH         | env     | -     | $ASTER_VERSION_DIR/share/aster/profile.sh
+#BINELE         | bin     | -     | $ASTER_VERSION_DIR/share/aster/elements
+#SRCPY          | src     | -     | %s
+#ARGPYT         | exec    | -     | %s
+#""" % (self.getAsterPythonPath(), path_compo)
+#    
+#    return conf
 
   def makeCompo(self, gen):
     """drive the generation of SALOME module files and code files
@@ -140,13 +141,13 @@ ARGPYT         | exec    | -     | %s
     gen.aster = self.aster_dir
 
     #get ASTER version
-    f = os.path.join(self.aster_dir, self.getAsterPythonPath(), 'Accas', 'properties.py')
-    self.version=(0,0,0)
-    if os.path.isfile(f):
-      mydict = {}
-      execfile(f, mydict)
-      v,r,p = mydict['version'].split('.')
-      self.version=(int(v),int(r),int(p))
+#    f = os.path.join(self.aster_dir, self.getAsterPythonPath(), 'Accas', 'properties.py')
+#    self.version=(0,0,0)
+#    if os.path.isfile(f):
+#      mydict = {}
+#      execfile(f, mydict)
+#      v,r,p = mydict['version'].split('.')
+#      self.version=(int(v),int(r),int(p))
 
     if self.kind == "lib":
       f = self.name+".py"
@@ -189,36 +190,36 @@ ARGPYT         | exec    | -     | %s
 
     fdict={}
 
-    if self.version < (10,1,2):
+#    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
+#      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)
-    config = ""
-    path_config = os.path.join(self.aster_dir, "config.txt")
-    if os.path.exists(path_config) :
+#    config = ""
+#    path_config = os.path.join(self.aster_dir, "config.txt")
+#    if os.path.exists(path_config) :
       # old aster version - old mechanism kept for compatibility
-      fil = open(path_config)
-      config = fil.read()
-      fil.close()
-      config = re.sub(" profile.sh", os.path.join(self.aster_dir, "profile.sh"), config)
-      path=os.path.join(os.path.abspath(gen.module.prefix),'lib',
-                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
-                      'site-packages','salome','%s_component.py'%self.name)
-      config = re.sub("Execution\/E_SUPERV.py", path, config)
-    else :
+#      fil = open(path_config)
+#      config = fil.read()
+#      fil.close()
+#      config = re.sub(" profile.sh", os.path.join(self.aster_dir, "profile.sh"), config)
+#      path=os.path.join(os.path.abspath(gen.module.prefix),'lib',
+#                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
+#                      'site-packages','salome','%s_component.py'%self.name)
+#      config = re.sub("Execution\/E_SUPERV.py", path, config)
+#    else :
       # getConfig doesn't work with older versions of aster
-      config = self.getConfig(gen)
+#      config = self.getConfig(gen)
 
-    fdict["%s_config.txt" % self.name] = config
+#    fdict["%s_config.txt" % self.name] = config
     fdict["%s_component.py" % self.name] = component.substitute(component=self.name)
 
     return fdict
@@ -228,48 +229,55 @@ ARGPYT         | exec    | -     | %s
 
     fdict={}
 
-    if self.version < (10,1,2):
+#    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
+#      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
-    config = ""
-    path_config = os.path.join(self.aster_dir, "config.txt")
-    if os.path.exists(path_config) :
+#    config = ""
+#    path_config = os.path.join(self.aster_dir, "config.txt")
+#    if os.path.exists(path_config) :
       # old aster version - old mechanism kept for compatibility
-      fil = open(path_config)
-      config = fil.read()
-      fil.close()
-      config = re.sub(" profile.sh", os.path.join(self.aster_dir, "profile.sh"), config)
-      path=os.path.join(os.path.abspath(gen.module.prefix),'lib',
-                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
-                      'site-packages','salome','%s_container.py' % self.name)
-      config = re.sub("Execution\/E_SUPERV.py", path, config)
-    else :
+#      fil = open(path_config)
+#      config = fil.read()
+#      fil.close()
+#      config = re.sub(" profile.sh", os.path.join(self.aster_dir, "profile.sh"), config)
+#      path=os.path.join(os.path.abspath(gen.module.prefix),'lib',
+#                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
+#                      'site-packages','salome','%s_container.py' % self.name)
+#      config = re.sub("Execution\/E_SUPERV.py", path, config)
+#    else :
       # getConfig doesn't work with older versions of aster
-      config = self.getConfig(gen)
+#      config = self.getConfig(gen)
 
     fdict["%s_container.py" % self.name] = container
-    fdict["%s_config.txt" % self.name] = config
+#    fdict["%s_config.txt" % self.name] = config
 
     return fdict
 
   def getImportESuperv(self):
-    importesuperv=""
-    if self.version < (10,1,2):
-      importesuperv="from E_SUPERV import SUPERV"
-    else :
-      importesuperv="""sys.path=["%s"]+sys.path
+    importesuperv="""
+VERS="%s"
+import os.path as osp
+from asrun.run import AsRunFactory
+from asrun.config import AsterConfig
+
+run = AsRunFactory()
+path = run.get_version_path(VERS)
+cfg = AsterConfig(osp.join(path, 'config.txt'))
+pypath = cfg['REPPY'][0]
+
+sys.path.insert(0, pypath)
 from Execution.E_SUPERV import SUPERV
-""" % self.getAsterPythonPath()
+""" % self.aster_version_type
     return importesuperv