]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
A way to deal with environment modules.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 16 Jul 2021 12:16:21 +0000 (14:16 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 16 Jul 2021 12:16:21 +0000 (14:16 +0200)
22 files changed:
Examples/ast1/components.py
Examples/ast2/components.py
Examples/calcium1/components.py
Examples/calcium2/components.py
Examples/context.py
Examples/cpp1/components.py
Examples/cpp2/components.py
Examples/cppgui1/components.py
Examples/fort1/components.py
Examples/fort2/components.py
Examples/mpi1/components.py
Examples/paco1/components.py
Examples/paco2/components.py
Examples/paco3/components.py
Examples/parahxx1/components.py
Examples/pydoc1/components.py
Examples/pygui1/components.py
Examples/pyth1/components.py
Examples/pyth2/components.py
Examples/types1/components.py
module_generator/gener.py
module_generator/mod_tmpl.py

index 1476bdc371964a1701f5ba18807cdd4131fbd642..f0f4424d0dce8d44beaa784d61d5615ff87c7e35 100644 (file)
@@ -69,4 +69,4 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
 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)
index b1f55e39f381e968fef7e374e4749de64ea8971c..d6d93d8a0624b73d32fda0d7c057a544173034a0 100644 (file)
@@ -74,4 +74,4 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
 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)
index 9c5a0f9fa39aab58842feec6d70c61facf497826..bf560c78fdf2331b96590c5b4be2944a4e61bc8f 100644 (file)
@@ -459,7 +459,8 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
 
 
 
 
index b1f4bc637503677b52830d03322d9b8400d69a26..e21dd4d05a6b8d4a252eb1a8b9321ba528a3cd61 100644 (file)
@@ -457,7 +457,8 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
 
 
 
 
index dcbdeaee47a0d0815088e538763e345468e72441..ec4c15c89a24d183dbb5a9bde12db101f7af2563 100644 (file)
@@ -37,6 +37,4 @@ context={'update':1,
          "geom":GEOM_ROOT_DIR,
         }
 
          "geom":GEOM_ROOT_DIR,
         }
 
-
-aster_home=os.path.expanduser("~/Aster/V10.3/aster")
-aster_version="STA10.3"
+SYS_MODULES=[]
index 9494381d3827ab2511131a11c69cc7ff23e815a8..22036bb3fee6ce03dc80d56a043cee0e46ab1976 100644 (file)
@@ -57,5 +57,6 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index d4f5f60abcc5945ea974da771b3934ead5b1ea1e..22af9bebc48eec6d7fdc9e784ff9b08ea205ba9f 100644 (file)
@@ -58,4 +58,5 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
index cd1726c65c9cdf9f01bad3e25721f7213d2fe072..faa7b3bed2d11f566653a03e61fed02ef1081bb2 100644 (file)
@@ -118,8 +118,9 @@ modul=Module("cppcompos",components=[c1],prefix="./install",
 
 g=Generator(modul,context)
 g.generate()
 
 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.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)
 
 
index 32b1c321a2103e532cc9959283df952c5b53d23d..6ed0f32b9fb8a745f3ce6b34bdd8bc8e3a535f1c 100644 (file)
@@ -43,5 +43,6 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 971cd24efda32243ade6356526d3b562bbf6a94f..cc3c7888fa14870e85ff5e5c947a33be031aa72b 100644 (file)
@@ -43,5 +43,6 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 89185e4b4c62ad98d6b3ac9184b19c6173dd75eb..c79f590b5bbb28d0cba6cd5bae7b4fe47c064671 100644 (file)
@@ -57,6 +57,7 @@ g.configure()
 g.make()
 g.install()
 g.make_appli("appli",
 g.make()
 g.install()
 g.make_appli("appli",
-             restrict=["KERNEL","GUI","YACS","JOBMANAGER"])
+             restrict=["KERNEL","GUI","YACS","JOBMANAGER"],
+             sys_modules=SYS_MODULES)
 
 
 
 
index 777c0aa8817f8f22195f5bfb53b7812f1b536ca2..452758830cad67785f62a08adf88e120ec350741 100644 (file)
@@ -47,5 +47,6 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 7480cdd7d4562f92bfe4e00ed3c8067260d80573..6054c960a0172880f1e3d1a01449fc02cb1f9543 100644 (file)
@@ -47,5 +47,6 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 63b954275521d5055326f55694e8f47c091167ad..6b82066af147d0cd54fbc73713d41482bd240b88 100644 (file)
@@ -92,5 +92,6 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 8b48fe221b3b9f56197a9621743a5f9370215798..db1abfb254f234d97c3ecee985a700c9f73ed2d6 100644 (file)
@@ -58,4 +58,5 @@ g.make()
 g.install()
 g.make_appli("appli",
              restrict=["KERNEL","GUI","YACS","MED"],
 g.install()
 g.make_appli("appli",
              restrict=["KERNEL","GUI","YACS","MED"],
+             sys_modules=SYS_MODULES
             )
             )
index e0478e812a260c9084a4416ffb3ab9c58ccc359f..3013f5344181f77ecac4ff1a694b34638c1a24a7 100644 (file)
@@ -49,6 +49,7 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
 
 
index d2d2fb97226a71a22b31b7e9931d522b3a8e3229..bbb449153f22e164b8b2af5ac8fa4605c1d13c63 100644 (file)
@@ -109,9 +109,11 @@ modul=Module("pycompos",components=[c1],prefix="./install",
 
 g=Generator(modul,context)
 g.generate()
 
 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.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)
 
 
 
 
index 68e8592d94c5319630598f6d23eeadebe58e1bf4..565000cd58a557f3b40a2db217319a6c71d2c723 100644 (file)
@@ -62,6 +62,7 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
 
 
index cab0b376cb68c74bc33e2035cf65fd6bca89f81d..21e42961add225d37c8c06a31c6dedf0aaa94e68 100644 (file)
@@ -58,5 +58,6 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 65ff4d29e924acaf743dd7b92c024b91402cdce4..f9c59af7798267dbf002d73c7b60787d54ea2d2d 100644 (file)
@@ -201,5 +201,9 @@ g.generate()
 g.configure()
 g.make()
 g.install()
 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)
 
 
index 69afe86801936f64a13733901a0bd0247935ae2b..cf24c5c5be25aac9b20ee8f2e17afd2a6e501cf7 100644 (file)
@@ -832,14 +832,17 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
           os.makedirs(filename)
         self.makeFiles(content, filename)
 
           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"""
     """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)
     
     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")
     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")
 
     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.
 
     """
    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 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::
 
 
    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)
 
     """
     makedirs(appliname)
+    if sys_modules is None:
+        sys_modules = []
 
     rootdir, kerdir = os.path.split(self.kernel)
 
 
     rootdir, kerdir = os.path.split(self.kernel)
 
@@ -952,9 +960,14 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
     if os.path.isfile(resources):
       resources_spec='<resources path="%s" />' % os.path.abspath(resources)
 
     if os.path.isfile(resources):
       resources_spec='<resources path="%s" />' % os.path.abspath(resources)
 
+    sys_modules_str = ""
+    for mod in sys_modules:
+        sys_modules_str += "  <env_module name='{}'/>\n".format(mod)
+
     #create config_appli.xml file
     appli = application.substitute(prerequisites=prerequisites,
                                    context=salome_context,
     #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')
                                    modules="\n".join(modules),
                                    resources=resources_spec)
     fil = open(os.path.join(appliname, "config_appli.xml"), 'w')
index d7cd0869d194e104f7ef3c0668b1a6917fb8103d..6a9d860acfdd49fda16463a5bb57cd61d92cbe66 100644 (file)
@@ -27,6 +27,9 @@ application="""
 <prerequisites path="${prerequisites}"/>
 <context path="${context}"/>
 ${resources}
 <prerequisites path="${prerequisites}"/>
 <context path="${context}"/>
 ${resources}
+<env_modules>
+${env_modules}
+</env_modules>
 <modules>
 ${modules}
 </modules>
 <modules>
 ${modules}
 </modules>