Salome HOME
A way to deal with environment modules.
[tools/yacsgen.git] / Examples / types1 / components.py
index df1ca2e4a6f95567eb9e5bad244a0314ca3a7aa9..f9c59af7798267dbf002d73c7b60787d54ea2d2d 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2009-2013  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
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 
 from module_generator import Generator,Module,Service,CPPComponent,PYComponent,add_type,add_module
 
-#overload module GEOM definition
-idldefs="""
-#include "GEOM_Gen.idl"
-"""
-makefiledefs="""
-#module GEOM
-GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome
-GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome
-GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM
-GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome
-SALOME_LIBS += ${GEOM_LIBS}
-SALOME_IDL_LIBS += ${GEOM_IDL_LIBS}
-SALOME_INCLUDES += ${GEOM_INCLUDES}
-IDL_INCLUDES += ${GEOM_IDL_INCLUDES}
-"""
-configdefs="""
-if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then
-  AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR})
-else
-  AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
-fi
-"""
-add_module("GEOM",idldefs,makefiledefs,configdefs)
-
 #overload GEOM_Object definition
 add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
 
@@ -173,7 +149,7 @@ c1=CPPComponent("compo1",services=[
 pydefs="""import SALOME_TYPES"""
 
 pybody="""
-print a,b,c,d,d2,d3,e,f,g
+print (a,b,c,d,d2,d3,e,f,g)
 aa=SALOME_TYPES.Parameter(name="a",value="45.")
 ab=[]
 ac=[1,2,3]
@@ -183,11 +159,11 @@ ad3=[[[[1,2,3]]]]
 ae=["aaa","bbb"]
 af=SALOME_TYPES.ParametricInput(inputVarList=ae,outputVarList=ae, inputValues=[[[[1,2,3]]]],specificParameters=[])
 ag=SALOME_TYPES.ParametricOutput(outputValues=[[[[1,2,3]]]], specificOutputInfos=[], returnCode=1, errorMessage="error")
-print aa,ab,ac,ad,ad2,ad3,ae,af,ag
+print (aa,ab,ac,ad,ad2,ad3,ae,af,ag)
 """
 
 s2pybody="""
-print "service s2 python component"
+print ("service s2 python component")
 aa=a
 a.Register()
 """
@@ -222,9 +198,12 @@ c2=PYComponent("compo2",services=[
 
 g=Generator(Module("mymodule",components=[c1,c2],prefix="./install"),context)
 g.generate()
-g.bootstrap()
 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)