X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=module_generator%2Fastcompo.py;h=f0c6f257c50ce8322deb9191589065820c478a69;hb=8b4424caa9bc6abdcd519333a0acc9533e3d2a63;hp=a99a6a5709640c963ee7128b0f7306e7d3ab6138;hpb=2aaaab50c28246ddb16e768bc31265a5054a2a9d;p=tools%2Fyacsgen.git diff --git a/module_generator/astcompo.py b/module_generator/astcompo.py index a99a6a5..f0c6f25 100644 --- a/module_generator/astcompo.py +++ b/module_generator/astcompo.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2014 EDF R&D +# Copyright (C) 2009-2021 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -26,15 +26,15 @@ """ import re, os, sys -from gener import Component, Invalid, makedirs +from module_generator.gener import Component, Invalid, makedirs -from pyth_tmpl import pyinitEXEService, pyinitCEXEService, pyinitService -import aster_tmpl -from aster_tmpl import asterCEXEService, asterEXEService -from aster_tmpl import asterService, asterEXECompo, asterCEXECompo, asterCompo -from aster_tmpl import comm, make_etude, cexe, exeaster -from aster_tmpl import container, component -from aster_tmpl import cmake_src_compo_aster, cmake_src_compo_aster_lib +from module_generator.pyth_tmpl import pyinitEXEService, pyinitCEXEService, pyinitService +from module_generator import aster_tmpl +from module_generator.aster_tmpl import asterCEXEService, asterEXEService +from module_generator.aster_tmpl import asterService, asterEXECompo, asterCEXECompo, asterCompo +from module_generator.aster_tmpl import comm, make_etude, cexe, exeaster +from module_generator.aster_tmpl import container, component +from module_generator.aster_tmpl import cmake_src_compo_aster, cmake_src_compo_aster_lib class ASTERComponent(Component): """ @@ -162,6 +162,22 @@ class ASTERComponent(Component): """standalone component: generate files for calculation code""" fdict={} + #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) : + 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 : + config = "# a completer:%s n'existe pas" % path_config + + fdict["%s_config.txt" % self.name] = config fdict["%s_component.py" % self.name] = component.substitute(component=self.name) return fdict @@ -204,7 +220,7 @@ from Execution.E_SUPERV import SUPERV if typ=="file":continue #files are not passed through service interface params.append(name) if typ == "pyobj": - datas.append('"%s":cPickle.loads(%s)' % (name, name)) + datas.append('"%s":pickle.loads(%s)' % (name, name)) else: datas.append('"%s":%s' % (name, name)) #ajout de l'adresse du composant @@ -218,7 +234,7 @@ from Execution.E_SUPERV import SUPERV if typ=="file":continue #files are not passed through service interface params.append(name) if typ == "pyobj": - datas.append('cPickle.dumps(j.g_context["%s"],-1)'%name) + datas.append('pickle.dumps(j.g_context["%s"],-1)'%name) else: datas.append('j.g_context["%s"]'%name) outparams = ",".join(params) @@ -267,7 +283,7 @@ from Execution.E_SUPERV import SUPERV if typ=="file":continue #files are not passed through service interface params.append(name) if typ == "pyobj": - datas.append('"%s":cPickle.loads(%s)' % (name, name)) + datas.append('"%s":pickle.loads(%s)' % (name, name)) else: datas.append('"%s":%s' % (name, name)) #ajout de l'adresse du composant @@ -280,7 +296,7 @@ from Execution.E_SUPERV import SUPERV for name, typ in serv.outport: params.append(name) if typ == "pyobj": - datas.append('cPickle.dumps(j.g_context["%s"],-1)'%name) + datas.append('pickle.dumps(j.g_context["%s"],-1)'%name) else: datas.append('j.g_context["%s"]'%name) outparams = ",".join(params) @@ -338,7 +354,7 @@ from Execution.E_SUPERV import SUPERV if typ=="file":continue #files are not passed through service interface params.append(name) if typ == "pyobj": - datas.append('"%s":cPickle.loads(%s)' % (name, name)) + datas.append('"%s":pickle.loads(%s)' % (name, name)) else: datas.append('"%s":%s' % (name, name)) #ajout de l'adresse du composant @@ -351,7 +367,7 @@ from Execution.E_SUPERV import SUPERV for name, typ in serv.outport: params.append(name) if typ == "pyobj": - datas.append('cPickle.dumps(j.g_context["%s"],-1)'%name) + datas.append('pickle.dumps(j.g_context["%s"],-1)'%name) else: datas.append('j.g_context["%s"]'%name) outparams = ",".join(params)