From: Ovidiu Mircescu Date: Fri, 16 Jul 2021 12:16:21 +0000 (+0200) Subject: A way to deal with environment modules. X-Git-Tag: V9_8_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb124eab28c2b51572fd4e86db08d2b6d85ce98f;p=tools%2Fyacsgen.git A way to deal with environment modules. --- diff --git a/Examples/ast1/components.py b/Examples/ast1/components.py index 1476bdc..f0f4424 100644 --- a/Examples/ast1/components.py +++ b/Examples/ast1/components.py @@ -69,4 +69,4 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/ast2/components.py b/Examples/ast2/components.py index b1f55e3..d6d93d8 100644 --- a/Examples/ast2/components.py +++ b/Examples/ast2/components.py @@ -74,4 +74,4 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/calcium1/components.py b/Examples/calcium1/components.py index 9c5a0f9..bf560c7 100644 --- a/Examples/calcium1/components.py +++ b/Examples/calcium1/components.py @@ -459,7 +459,8 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/calcium2/components.py b/Examples/calcium2/components.py index b1f4bc6..e21dd4d 100644 --- a/Examples/calcium2/components.py +++ b/Examples/calcium2/components.py @@ -457,7 +457,8 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/context.py b/Examples/context.py index dcbdeae..ec4c15c 100644 --- a/Examples/context.py +++ b/Examples/context.py @@ -37,6 +37,4 @@ context={'update':1, "geom":GEOM_ROOT_DIR, } - -aster_home=os.path.expanduser("~/Aster/V10.3/aster") -aster_version="STA10.3" +SYS_MODULES=[] diff --git a/Examples/cpp1/components.py b/Examples/cpp1/components.py index 9494381..22036bb 100644 --- a/Examples/cpp1/components.py +++ b/Examples/cpp1/components.py @@ -57,5 +57,6 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/cpp2/components.py b/Examples/cpp2/components.py index d4f5f60..22af9be 100644 --- a/Examples/cpp2/components.py +++ b/Examples/cpp2/components.py @@ -58,4 +58,5 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/cppgui1/components.py b/Examples/cppgui1/components.py index cd1726c..faa7b3b 100644 --- a/Examples/cppgui1/components.py +++ b/Examples/cppgui1/components.py @@ -118,8 +118,9 @@ modul=Module("cppcompos",components=[c1],prefix="./install", g=Generator(modul,context) g.generate() +#g.configure("-DTBB_INCLUDE_DIR=/opt/tbb/2018.u6/include -DTBB_ROOT=/opt/tbb/2018.u6/") g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/fort1/components.py b/Examples/fort1/components.py index 32b1c32..6ed0f32 100644 --- a/Examples/fort1/components.py +++ b/Examples/fort1/components.py @@ -43,5 +43,6 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/fort2/components.py b/Examples/fort2/components.py index 971cd24..cc3c788 100644 --- a/Examples/fort2/components.py +++ b/Examples/fort2/components.py @@ -43,5 +43,6 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/mpi1/components.py b/Examples/mpi1/components.py index 89185e4..c79f590 100644 --- a/Examples/mpi1/components.py +++ b/Examples/mpi1/components.py @@ -57,6 +57,7 @@ g.configure() g.make() g.install() g.make_appli("appli", - restrict=["KERNEL","GUI","YACS","JOBMANAGER"]) + restrict=["KERNEL","GUI","YACS","JOBMANAGER"], + sys_modules=SYS_MODULES) diff --git a/Examples/paco1/components.py b/Examples/paco1/components.py index 777c0aa..4527588 100644 --- a/Examples/paco1/components.py +++ b/Examples/paco1/components.py @@ -47,5 +47,6 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/paco2/components.py b/Examples/paco2/components.py index 7480cdd..6054c96 100644 --- a/Examples/paco2/components.py +++ b/Examples/paco2/components.py @@ -47,5 +47,6 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/paco3/components.py b/Examples/paco3/components.py index 63b9542..6b82066 100644 --- a/Examples/paco3/components.py +++ b/Examples/paco3/components.py @@ -92,5 +92,6 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/parahxx1/components.py b/Examples/parahxx1/components.py index 8b48fe2..db1abfb 100644 --- a/Examples/parahxx1/components.py +++ b/Examples/parahxx1/components.py @@ -58,4 +58,5 @@ g.make() g.install() g.make_appli("appli", restrict=["KERNEL","GUI","YACS","MED"], + sys_modules=SYS_MODULES ) diff --git a/Examples/pydoc1/components.py b/Examples/pydoc1/components.py index e0478e8..3013f53 100644 --- a/Examples/pydoc1/components.py +++ b/Examples/pydoc1/components.py @@ -49,6 +49,7 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/pygui1/components.py b/Examples/pygui1/components.py index d2d2fb9..bbb4491 100644 --- a/Examples/pygui1/components.py +++ b/Examples/pygui1/components.py @@ -109,9 +109,11 @@ modul=Module("pycompos",components=[c1],prefix="./install", g=Generator(modul,context) g.generate() +#g.configure("-DTBB_INCLUDE_DIR=/opt/tbb/2018.u6/include -DTBB_ROOT=/opt/tbb/2018.u6/") g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/pyth1/components.py b/Examples/pyth1/components.py index 68e8592..565000c 100644 --- a/Examples/pyth1/components.py +++ b/Examples/pyth1/components.py @@ -62,6 +62,7 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/pyth2/components.py b/Examples/pyth2/components.py index cab0b37..21e4296 100644 --- a/Examples/pyth2/components.py +++ b/Examples/pyth2/components.py @@ -58,5 +58,6 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR}, sys_modules=SYS_MODULES) diff --git a/Examples/types1/components.py b/Examples/types1/components.py index 65ff4d2..f9c59af 100644 --- a/Examples/types1/components.py +++ b/Examples/types1/components.py @@ -201,5 +201,9 @@ g.generate() g.configure() g.make() g.install() -g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR, "GEOM":GEOM_ROOT_DIR}) +g.make_appli("appli", restrict=["KERNEL"], + altmodules={"GUI":GUI_ROOT_DIR, + "YACS":YACS_ROOT_DIR, + "GEOM":GEOM_ROOT_DIR}, + sys_modules=SYS_MODULES) diff --git a/module_generator/gener.py b/module_generator/gener.py index 69afe86..cf24c5c 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -832,14 +832,17 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) os.makedirs(filename) self.makeFiles(content, filename) - def configure(self): + def configure(self, extra_params = None): """Execute the second build step (configure) with installation prefix as given by the prefix attribute of module""" + if extra_params is None: + extra_params = "" prefix = os.path.abspath(self.module.prefix) self.build_dir = "%s_build" % self.module.name makedirs(self.build_dir) - build_sh = "cd %s; cmake ../%s -DCMAKE_INSTALL_PREFIX:PATH=%s"%(self.build_dir, self.sourceDir(), prefix) + build_sh = "cd %s; cmake ../%s -DCMAKE_INSTALL_PREFIX:PATH=%s %s"%( + self.build_dir, self.sourceDir(), prefix, extra_params) ier = os.system(build_sh) if ier != 0: raise Invalid("configure has ended in error") @@ -860,7 +863,8 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) if ier != 0: raise Invalid("install has ended in error") - def make_appli(self, appliname, restrict=None, altmodules=None, resources=""): + def make_appli(self, appliname, restrict=None, altmodules=None, resources="", + sys_modules=None): """ Create a SALOME application containing the module and preexisting SALOME modules. @@ -874,6 +878,8 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) :param altmodules: can be used to add SALOME modules that cannot be managed with the precedent rule. This parameter is a dict with a module name as the key and the installation path as the value. :param resources: can be used to define an alternative resources catalog (path of the file). + :param sys_modules: list of system modules to be loaded with "module load" + command within the salome environment. For example, the following calls create a SALOME application with external modules and resources catalog in "appli" directory:: @@ -887,6 +893,8 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) """ makedirs(appliname) + if sys_modules is None: + sys_modules = [] rootdir, kerdir = os.path.split(self.kernel) @@ -952,9 +960,14 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) if os.path.isfile(resources): resources_spec='' % os.path.abspath(resources) + sys_modules_str = "" + for mod in sys_modules: + sys_modules_str += " \n".format(mod) + #create config_appli.xml file appli = application.substitute(prerequisites=prerequisites, context=salome_context, + env_modules=sys_modules_str, modules="\n".join(modules), resources=resources_spec) fil = open(os.path.join(appliname, "config_appli.xml"), 'w') diff --git a/module_generator/mod_tmpl.py b/module_generator/mod_tmpl.py index d7cd086..6a9d860 100644 --- a/module_generator/mod_tmpl.py +++ b/module_generator/mod_tmpl.py @@ -27,6 +27,9 @@ application=""" ${resources} + +${env_modules} + ${modules}