]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
Merge branch 'pre/V8_5_BR' V9_2_0a2 V9_2_0b1
authorPaul RASCLE <paul.rascle@edf.fr>
Tue, 16 Oct 2018 09:05:01 +0000 (11:05 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Tue, 16 Oct 2018 09:05:01 +0000 (11:05 +0200)
Conflicts:
Examples/exec.sh

49 files changed:
Examples/ast1/components.py
Examples/ast2/components.py
Examples/calcium1/components.py
Examples/calcium2/components.py
Examples/cpp1/components.py
Examples/cpp2/components.py
Examples/cppgui1/components.py
Examples/cppgui1/cppcomposGUI.cxx
Examples/fort1/components.py
Examples/fort2/components.py
Examples/hxx1/test_compohxx.py
Examples/paco1/components.py
Examples/paco2/components.py
Examples/paco3/components.py
Examples/pydoc1/components.py
Examples/pygui1/components.py
Examples/pygui1/pycomposGUI.py
Examples/pyth1/bidul.py
Examples/pyth1/components.py
Examples/pyth2/components.py
Examples/test_compo.py
Examples/types1/components.py
Examples/types1/coupling.xml
module_generator/__init__.py
module_generator/astcompo.py
module_generator/aster_tmpl.py
module_generator/cata_tmpl.py
module_generator/compat.py
module_generator/cpp_tmpl.py
module_generator/cppcompo.py
module_generator/doc_tmpl.py
module_generator/fcompo.py
module_generator/gener.py
module_generator/gui_tmpl.py
module_generator/hxx_para_tmpl.py
module_generator/hxx_tmpl.py
module_generator/hxx_tmpl_gui.py
module_generator/hxxcompo.py
module_generator/hxxparacompo.py
module_generator/mod_tmpl.py
module_generator/mpi_tmpl.py
module_generator/mpicompo.py
module_generator/paco_tmpl.py
module_generator/pacocompo.py
module_generator/pycompo.py
module_generator/pyth_tmpl.py
module_generator/yacsgen_version.py
module_generator/yacstypes.py
script/hxx2salome.py

index ff447501f0716fba24a38eb72cf0c2789289ffd5..bd8740c45c6714309e02969a701623592e99175f 100644 (file)
@@ -23,7 +23,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,ASTERComponent,Service,F77Component
 
 aster_root=os.path.join(aster_home,aster_version)
index 7932c7764ff83361d34e6fc5289e807958827a19..941c2b3760c789b15a43ee1c3914a3821d6de0dc 100644 (file)
@@ -23,7 +23,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,ASTERComponent,Service,F77Component
 
 aster_root=os.path.join(aster_home,aster_version)
index 8311e462f9d57ac9c658a66fbabe90a72b541c55..995e50609cf0532229dd7a3bbea4a83c705d0e07 100644 (file)
@@ -19,7 +19,7 @@
 
 import os
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component
 from module_generator import Library
 
@@ -243,8 +243,8 @@ defs="""
 body="""
 #b1
 info,name= calcium.cp_cd(component)
-print "name=",name
-print "info=",info
+print ("name=",name)
+print ("info=",info)
 
 dep=calcium.CP_ITERATION
 
@@ -253,7 +253,7 @@ val=numpy.zeros(10,'d')
 val[0]=7.7
 val[5]=a*b
 nval=10
-print "--------> Appel calcium.cp_edb",val
+print ("--------> Appel calcium.cp_edb",val)
 info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val)
 info=calcium.cp_edb(component, dep, 0., 2, "ba", nval,val)
 info=calcium.cp_edb(component, dep, 0., 3, "ba", nval,val)
@@ -264,124 +264,124 @@ val=calcium.stringArray(3,8)
 val[0]="coucouc"
 val[1]="bonjour"
 val[2]="salut"
-print "--------> Appel calcium.cp_ech",val
+print ("--------> Appel calcium.cp_ech",val)
 info=calcium.cp_ech(component, dep, 0., 1, "bb", 3,val)
 
 #int
 val=numpy.zeros(10,'i')
 val[0]=1
 val[1]=3
-print "--------> Appel calcium.cp_een",val
+print ("--------> Appel calcium.cp_een",val)
 info=calcium.cp_een(component, dep, 0., 1, "bc", 3,val)
 
 val=numpy.zeros(10,'F')
 val[0]=1+2j
 val[1]=3+2j
-print "--------> Appel calcium.cp_ecp",val
+print ("--------> Appel calcium.cp_ecp",val)
 info=calcium.cp_ecp(component, dep, 0., 1, "bd", 3,val)
 
 val=numpy.zeros(10,'f')
 val[0]=1.3
 val[1]=3.2
-print "--------> Appel calcium.cp_ere",val
+print ("--------> Appel calcium.cp_ere",val)
 info=calcium.cp_ere(component, dep, 0., 1, "be", 3,val)
 
 val=numpy.zeros(10,'i')
 val[0]=True
 val[1]=False
 val[2]=False
-print "--------> Appel calcium.cp_elo",val
+print ("--------> Appel calcium.cp_elo",val)
 info=calcium.cp_elo(component, dep, 0., 1, "bf", 3,val)
 
 val=numpy.zeros(10,'l')
 val[0]=1
 val[1]=3
 val[2]=333
-print "--------> Appel calcium.cp_eln",val
+print ("--------> Appel calcium.cp_eln",val)
 info=calcium.cp_eln(component, dep, 0., 1, "bg", 3,val)
 
 val=numpy.zeros(10,'i')
 val[0]=1
 val[1]=3
 val[2]=4
-print "--------> Appel calcium.cp_een",val
+print ("--------> Appel calcium.cp_een",val)
 info=calcium.cp_een(component, dep, 0., 1, "bh", 3,val)
 
 val=numpy.zeros(10,'l')
 val[0]=1
 val[1]=3
 val[2]=333
-print "--------> Appel calcium.cp_elg",val
+print ("--------> Appel calcium.cp_elg",val)
 info=calcium.cp_elg(component, dep, 0., 1, "bi", 3,val)
-print "info=",info
+print ("info=",info)
 
 #read
 val=numpy.zeros(10,'d')
-print "--------> Appel calcium.cp_ldb"
+print ("--------> Appel calcium.cp_ldb")
 info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.array(["","","",], dtype='S13')
-print "--------> Appel calcium.cp_lch"
+print ("--------> Appel calcium.cp_lch")
 info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
-print mval,val
-print val.dtype
+print (mval,val)
+print (val.dtype)
 
 val=numpy.array(["            ","  ","  ",], dtype='S13')
-print "--------> Appel calcium.cp_lch"
+print ("--------> Appel calcium.cp_lch")
 info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
-print mval,val
-print val.dtype
+print (mval,val)
+print (val.dtype)
 
 val=calcium.stringArray(3,8)
-print "--------> Appel calcium.cp_lch"
+print ("--------> Appel calcium.cp_lch")
 info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
-print mval,val
-print val[0]
-print val[1]
-print val[2]
+print (mval,val)
+print (val[0])
+print (val[1])
+print (val[2])
 
 val=numpy.zeros(10,'i')
-print "--------> Appel calcium.cp_len"
+print ("--------> Appel calcium.cp_len")
 info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ac", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'F')
-print "--------> Appel calcium.cp_lcp"
+print ("--------> Appel calcium.cp_lcp")
 info,tt,ii,mval=calcium.cp_lcp(component, dep, 0.,1., 1, "ad", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'f')
-print "--------> Appel calcium.cp_lre"
+print ("--------> Appel calcium.cp_lre")
 info,tt,ii,mval=calcium.cp_lre(component, dep, 0.,1., 1, "ae", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'i')
-print "--------> Appel calcium.cp_llo"
+print ("--------> Appel calcium.cp_llo")
 info,tt,ii,mval=calcium.cp_llo(component, dep, 0.,1., 1, "af", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'l')
-print "--------> Appel calcium.cp_lln"
+print ("--------> Appel calcium.cp_lln")
 info,tt,ii,mval=calcium.cp_lln(component, dep, 0.,1., 1, "ag", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'i')
-print "--------> Appel calcium.cp_len"
+print ("--------> Appel calcium.cp_len")
 info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ah", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'l')
-print "--------> Appel calcium.cp_llg"
+print ("--------> Appel calcium.cp_llg")
 info,tt,ii,mval=calcium.cp_llg(component, dep, 0.,1., 1, "ai", 3,val)
-print "info=",info
-print mval,val
+print ("info=",info)
+print (mval,val)
 
 info=calcium.cp_fini(component,"aa",1)
-print "info=",info
+print ("info=",info)
 
 info=calcium.cp_effi(component,"aa",3)
-print "info=",info
+print ("info=",info)
 
 import time
 time.sleep(15)
@@ -389,7 +389,7 @@ time.sleep(15)
 c=a+b
 d=a-b
 err=calcium.cp_fin(component,calcium.CP_ARRET)
-print "err=",err
+print ("err=",err)
 """
 c2=PYComponent("compo2",services=[
           Service("s1",inport=[("a","double"),("b","double")],
index e89b9bc9dc8604032f40b50cd9972547ba0e97ca..30537eda08e501824622372aa6dce0d9bf66373d 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component
 from module_generator import Library
 
@@ -242,8 +242,8 @@ defs="""
 body="""
 #b1
 info,name= calcium.cp_cd(component)
-print "name=",name
-print "info=",info
+print ("name=",name)
+print ("info=",info)
 dep=calcium.CP_TEMPS
 
 #double
@@ -251,7 +251,7 @@ val=numpy.zeros(10,'d')
 val[0]=7.7
 val[5]=a*b
 nval=10
-print "--------> Appel calcium.cp_edb",val
+print ("--------> Appel calcium.cp_edb",val)
 info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val)
 info=calcium.cp_edb(component, dep, 1., 2, "ba", nval,val)
 info=calcium.cp_edb(component, dep, 2., 3, "ba", nval,val)
@@ -262,124 +262,124 @@ val=calcium.stringArray(3,8)
 val[0]="coucouc"
 val[1]="bonjour"
 val[2]="salut"
-print "--------> Appel calcium.cp_ech",val
+print ("--------> Appel calcium.cp_ech",val)
 info=calcium.cp_ech(component, dep, 0., 1, "bb", 3,val)
 
 #int
 val=numpy.zeros(10,'i')
 val[0]=1
 val[1]=3
-print "--------> Appel calcium.cp_een",val
+print ("--------> Appel calcium.cp_een",val)
 info=calcium.cp_een(component, dep, 0., 1, "bc", 3,val)
 
 val=numpy.zeros(10,'F')
 val[0]=1+2j
 val[1]=3+2j
-print "--------> Appel calcium.cp_ecp",val
+print ("--------> Appel calcium.cp_ecp",val)
 info=calcium.cp_ecp(component, dep, 0., 1, "bd", 3,val)
 
 val=numpy.zeros(10,'f')
 val[0]=1.3
 val[1]=3.2
-print "--------> Appel calcium.cp_ere",val
+print ("--------> Appel calcium.cp_ere",val)
 info=calcium.cp_ere(component, dep, 0., 1, "be", 3,val)
 
 val=numpy.zeros(10,'i')
 val[0]=True
 val[1]=False
 val[2]=False
-print "--------> Appel calcium.cp_elo",val
+print ("--------> Appel calcium.cp_elo",val)
 info=calcium.cp_elo(component, dep, 0., 1, "bf", 3,val)
 
 val=numpy.zeros(10,'l')
 val[0]=1
 val[1]=3
 val[2]=333
-print "--------> Appel calcium.cp_eln",val
+print ("--------> Appel calcium.cp_eln",val)
 info=calcium.cp_eln(component, dep, 0., 1, "bg", 3,val)
 
 val=numpy.zeros(10,'i')
 val[0]=1
 val[1]=3
 val[2]=4
-print "--------> Appel calcium.cp_een",val
+print ("--------> Appel calcium.cp_een",val)
 info=calcium.cp_een(component, dep, 0., 1, "bh", 3,val)
 
 val=numpy.zeros(10,'l')
 val[0]=1
 val[1]=3
 val[2]=333
-print "--------> Appel calcium.cp_elg",val
+print ("--------> Appel calcium.cp_elg",val)
 info=calcium.cp_elg(component, dep, 0., 1, "bi", 3,val)
-print "info=",info
+print ("info=",info)
 
 #read
 val=numpy.zeros(10,'d')
-print "--------> Appel calcium.cp_ldb"
+print ("--------> Appel calcium.cp_ldb")
 info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.array(["","","",], dtype='S13')
-print "--------> Appel calcium.cp_lch"
+print ("--------> Appel calcium.cp_lch")
 info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
-print mval,val
-print val.dtype
+print (mval,val)
+print (val.dtype)
 
 val=numpy.array(["            ","  ","  ",], dtype='S13')
-print "--------> Appel calcium.cp_lch"
+print ("--------> Appel calcium.cp_lch")
 info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
-print mval,val
-print val.dtype
+print (mval,val)
+print (val.dtype)
 
 val=calcium.stringArray(3,8)
-print "--------> Appel calcium.cp_lch"
+print ("--------> Appel calcium.cp_lch")
 info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
-print mval,val
-print val[0]
-print val[1]
-print val[2]
+print (mval,val)
+print (val[0])
+print (val[1])
+print (val[2])
 
 val=numpy.zeros(10,'i')
-print "--------> Appel calcium.cp_len"
+print ("--------> Appel calcium.cp_len")
 info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ac", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'F')
-print "--------> Appel calcium.cp_lcp"
+print ("--------> Appel calcium.cp_lcp")
 info,tt,ii,mval=calcium.cp_lcp(component, dep, 0.,1., 1, "ad", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'f')
-print "--------> Appel calcium.cp_lre"
+print ("--------> Appel calcium.cp_lre")
 info,tt,ii,mval=calcium.cp_lre(component, dep, 0.,1., 1, "ae", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'i')
-print "--------> Appel calcium.cp_llo"
+print ("--------> Appel calcium.cp_llo")
 info,tt,ii,mval=calcium.cp_llo(component, dep, 0.,1., 1, "af", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'l')
-print "--------> Appel calcium.cp_lln"
+print ("--------> Appel calcium.cp_lln")
 info,tt,ii,mval=calcium.cp_lln(component, dep, 0.,1., 1, "ag", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'i')
-print "--------> Appel calcium.cp_len"
+print ("--------> Appel calcium.cp_len")
 info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ah", 3,val)
-print mval,val
+print (mval,val)
 
 val=numpy.zeros(10,'l')
-print "--------> Appel calcium.cp_llg"
+print ("--------> Appel calcium.cp_llg")
 info,tt,ii,mval=calcium.cp_llg(component, dep, 0.,1., 1, "ai", 3,val)
-print "info=",info
-print mval,val
+print ("info=",info)
+print (mval,val)
 
 info=calcium.cp_fint(component,"aa",0.5)
-print "info=",info
+print ("info=",info)
 
 info=calcium.cp_efft(component,"aa",1.5)
-print "info=",info
+print ("info=",info)
 
 import time
 time.sleep(15)
@@ -387,7 +387,7 @@ time.sleep(15)
 c=a+b
 d=a-b
 err=calcium.cp_fin(component,calcium.CP_ARRET)
-print "err=",err
+print ("err=",err)
 """
 c2=PYComponent("compo2",services=[
           Service("s1",inport=[("a","double"),("b","double")],
index 70048043a695f0fcbf642cd98bad6d9eb8541ff1..cbdd7ffc53299537b91b82666281c0ebb0ed58b2 100644 (file)
@@ -20,7 +20,7 @@
 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
 
 cwd=os.getcwd()
index dc937520ee4f944c87787b9e141918cf0d377451..cf00113150110cb025638d98e0b31c15388b13fc 100644 (file)
@@ -20,7 +20,7 @@
 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
 
 cwd=os.getcwd()
index 1e96db18c589691b0ec293968cb2e86df513f398..39c98c5ac35666f254b1fa69e57b4a78a8628185 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 
 import os
 from module_generator import *
@@ -41,12 +41,12 @@ public:
   virtual bool Load(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile& theStream, const char* theURL, bool isMultiFile){return 0;};
   virtual bool LoadASCII(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile& theStream, const char* theURL, bool isMultiFile){return 0;};
   virtual void Close(SALOMEDS::SComponent_ptr IORSComponent){};
-  virtual char* ComponentDataType(){return "cppcompos";};
+  virtual char* ComponentDataType(){return (char*)"cppcompos";};
   virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString, CORBA::Boolean isMultiFile, CORBA::Boolean isASCII){return 0;};
   virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, const char* aLocalPersistentID, CORBA::Boolean isMultiFile,
                                        CORBA::Boolean isASCII){return 0;};
   virtual bool  CanPublishInStudy(CORBA::Object_ptr theIOR){return 0;};
-  virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,SALOMEDS::SObject_ptr theSObject,CORBA::Object_ptr theObject,
+  virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::SObject_ptr theSObject,CORBA::Object_ptr theObject,
                                                const char* theName){return 0;};
   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject){return 0;};
   virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID){return 0;};
index e7dec692ae88a86f077dbc1bc8ff6d9f13dc2f16..47d5ce6702d9e554599cfeb3f05fef58ad2795e9 100644 (file)
@@ -24,6 +24,7 @@
 #include <SUIT_Study.h>
 #include <SalomeApp_Application.h>
 #include <SALOME_LifeCycleCORBA.hxx>
+#include <SALOME_KernelServices.hxx>
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(cppcompos)
@@ -100,10 +101,7 @@ bool cppcomposGUI::activateModule( SUIT_Study* theStudy )
   setMenuShown( true );
   setToolShown( true );
 
-  SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
-  CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
-  SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(theStudy->id());
+  SALOMEDS::Study_var aDSStudy = KERNEL::getStudyServant();
 
   SALOMEDS::SComponent_var aFather = aDSStudy->FindComponent("cppcompos");
   if (aFather->_is_nil())
@@ -117,7 +115,7 @@ bool cppcomposGUI::activateModule( SUIT_Study* theStudy )
       aStudyBuilder->DefineComponentInstance(aFather, engine);
     }
   CORBA::Boolean valid;
-  engine->DumpPython(aDSStudy,1,0,valid);
+  engine->DumpPython(1,0,valid);
 
   return bOk;
 }
index 0a7e91b26c4d086690bb4c249a3a0f699255b817..539f27e43c20612f765685ca1a3b7fde69ad4f53 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,Service,F77Component
 from module_generator import Library
 
index 68c1953fe0a9abcb920133108f97cff166fc0ac4..cf646896dc267d3ac0d044878c3ff0f58dc345bb 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,Service,F77Component
 
 cwd=os.getcwd()
index a67be5691010d6739b92dbe9e721d901ed1de55e..6af0552d34c43ddb566b66144e72984bb5e9af93 100644 (file)
 import SALOME
 import salome
 salome.salome_init()
-print "Test du composant CALCUL genere par hxx2salome"
+print("Test du composant CALCUL genere par hxx2salome")
 import hxxcompos_ORB
 myCalc = salome.lcc.FindOrLoadComponent("FactoryServer", "CALCUL")
-print "10+15 = ",myCalc.add(10,15)
-print "10x15 = ",myCalc.mul(10,15)
+print("10+15 = ",myCalc.add(10,15))
+print("10x15 = ",myCalc.mul(10,15))
 #print "6!    = ",myCalc.fact(6)
 res1,res2 = myCalc.sqr2(12.0)
-print "12*12 = ",res1," ",res2
+print("12*12 = ",res1," ",res2)
 j=1
 i1,i2,i3 = myCalc.return_3_int(j)
 assert (i1 == j+1),'Erreur dans la fonction return_3_int'
 assert (i2 == j+2),'Erreur dans la fonction return_3_int'
 assert (i3 == j+3),'Erreur dans la fonction return_3_int'
-print 'return_3_int : ',j,' ',i1,' ',i2,' ',i3
-print "True && True  = ",myCalc.And(True,True)
-print "True && False = ",myCalc.And(True,False)
-print "True || False = ",myCalc.Or(True,False)
+print('return_3_int : ',j,' ',i1,' ',i2,' ',i3)
+print("True && True  = ",myCalc.And(True,True))
+print("True && False = ",myCalc.And(True,False))
+print("True || False = ",myCalc.Or(True,False))
 from math import fabs
 assert (fabs(res1-144.0)<1.0e-6 ), 'Erreur dans la fonction myCalc.sqr2 : 12*12 = '+str(res1)
 assert ( myCalc.And(True,True)==True ) , 'Erreur dans la fonction And(True,True)'
 assert ( myCalc.And(True,False)==False ) , 'Erreur dans la fonction And(True,False)'
 assert ( myCalc.Or(True,False)==True ) , 'Erreur dans la fonction Or(True,False)'
-print "Fin test hxx2salome/001/A1"
+print("Fin test hxx2salome/001/A1")
 #
 myCoco = salome.lcc.FindOrLoadComponent("FactoryServerI", "ICOCO")
 #
 liste_champs = myCoco.getInputFieldsNames()
 nb_champs=len(liste_champs)
-print "Nombre de champs = ",nb_champs
+print("Nombre de champs = ",nb_champs)
 assert  nb_champs == 2 , 'erreur dans le nombre de champs, different de 2!'
 #
-print "Champ 1 (SourceField) : ",liste_champs[0]
-print "Champ 2 (TargetField) : ",liste_champs[1]
+print("Champ 1 (SourceField) : ",liste_champs[0])
+print("Champ 2 (TargetField) : ",liste_champs[1])
 assert liste_champs[0] == "SourceField", 'erreur dans le nom du champ 1'
 assert liste_champs[1] == "TargetField", 'erreur dans le nom du champ 2'
 #
-print "Fin test hxx2salome/ICOCO/A1"
+print("Fin test hxx2salome/ICOCO/A1")
 myCoco1 = salome.lcc.FindOrLoadComponent("FactoryServerI1", "ICOCO")
 myCoco2 = salome.lcc.FindOrLoadComponent("FactoryServerI2", "ICOCO")
 #
@@ -57,5 +57,5 @@ myCoco1.solve()  #to test with 5.1.5
 f=myCoco1.getOutputField("SourceField")
 myCoco2.printField(f)
 #
-print "##################################"
-print "Fin test hxx2salome/ICOCO/A2"
+print("##################################")
+print("Fin test hxx2salome/ICOCO/A2")
index 1ed69ecc07a31537dec5050cd7c1b037004e52bf..a7be2dd4a4ce86c111ef24d069d3a3f6f5509ae7 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../pacocontext.py")
+exec(compile(open("../pacocontext.py").read(), "../pacocontext.py", 'exec'))
 from module_generator import Generator,Module,Service,PACOComponent
 
 cwd=os.getcwd()
index ff65bfdfa81fed5fe1d008c197892ff38992b462..8fd959ab57da528b45b12df94def58a685b8c6af 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../pacocontext.py")
+exec(compile(open("../pacocontext.py").read(), "../pacocontext.py", 'exec'))
 from module_generator import Generator,Module,Service,PACOComponent
 
 cwd=os.getcwd()
index eab10df341be6435ee70125df5d7ccc535d53e94..a3f4ab98f37662dab760df9199d88a2bde31d1ea 100644 (file)
@@ -21,7 +21,7 @@
 import os
 
 #import context from ..
-execfile("../pacocontext.py")
+exec(compile(open("../pacocontext.py").read(), "../pacocontext.py", 'exec'))
 from module_generator import Generator,Module,Service,PACOComponent
 
 cwd=os.getcwd()
index f56fd8fccdcd2fc6b8890e59bd1702dcc5434730..6a8fc904024f003b192613af17898e4c9ae17f85 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 
 from module_generator import *
 
index 44912810e608f1c8c1833f1baad7c62d4b87f967..6b13e7a30a5e1b6c7a7e6a9804b4784754191752 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 
 from module_generator import *
 
@@ -48,7 +48,7 @@ class A(SALOME_DriverPy.SALOME_DriverPy_i):
     def createObject( self, study, name ):
       "Create object.  "
       try:
-        print study,name
+        print (study,name)
         builder = study.NewBuilder()
         father = study.FindComponent( "pycompos" )
         if father is None:
index e2e3d61d37d853d813b171243eb92016fbe7804f..7917100853f8eacb00b1fc1f0e1f0196c3dc76fc 100644 (file)
@@ -107,8 +107,8 @@ def CreateObject():
     name = "%s_%d" % ( default_name, __objectid__ )
     if not name: return
     getEngine().createObject( _getStudy(), name )
-    print getEngine().s1(4,5)
-    print getEngine().ComponentDataType()
+    print(getEngine().s1(4,5))
+    print(getEngine().ComponentDataType())
     sg.updateObjBrowser( True )
 
 class DemoImpl(QtWidgets.QDialog):
@@ -125,7 +125,7 @@ class DemoImpl(QtWidgets.QDialog):
 # called when GUI action is activated
 # action ID is passed as parameter
 def OnGUIEvent( commandID ):
-  print "pycompos.OnGUIEvent(): command = %d" % commandID
+  print("pycompos.OnGUIEvent(): command = %d" % commandID)
   if commandID==941:
     widget=QMainWindow(sgPyQt.getDesktop())
     web = QWebView(widget)
index 285e064c4eb0d4f690754c0912ca7fe2d158cf68..2d09ee2b957402ca8ebdc570e7e541bf35be9de7 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 def f():
-  print "coucou"
+  print("coucou")
index 2a9d235512ad90406099c468241fc356e58af556..ea2b40c41280a3bc326e22ef2e72d855dcf225d9 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,Service,PYComponent
 
 cwd=os.getcwd()
@@ -35,11 +35,11 @@ body="""
       val=numpy.zeros(10,'d')
       val[5]=a*b
       nval=10
-      print "--------> Appel calcium.cp_edb"
+      print ("--------> Appel calcium.cp_edb")
       info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val)
       val=numpy.zeros(10,'d')
       info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", nval,val)
-      print mval,val
+      print (mval,val)
       bidul.f()
       c=a+b
       d=a-b
index 6cb4a4c5feac725524d0a9852536bb16f84597e6..3f695e0a4013874499f23b7c169a1e3235fece1f 100644 (file)
@@ -20,7 +20,7 @@
 import os
 
 #import context from ..
-execfile("../context.py")
+exec(compile(open("../context.py").read(), "../context.py", 'exec'))
 from module_generator import Generator,Module,Service,PYComponent
 
 cwd=os.getcwd()
@@ -32,11 +32,11 @@ body="""
       val=numpy.zeros(10,'d')
       val[5]=a*b
       nval=10
-      print "--------> Appel calcium.cp_edb"
+      print ("--------> Appel calcium.cp_edb")
       info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val)
       val=numpy.zeros(10,'d')
       info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", nval,val)
-      print mval,val
+      print (mval,val)
       c=a+b
       d=a-b
       err=calcium.cp_fin(component,calcium.CP_ARRET)
index 02dd33f66c46e440e320f2fda0dfcaad59c0b1e0..1349bf505b006a9511c86108d491c72ee6ad5d68 100755 (executable)
@@ -17,7 +17,7 @@ class TestCompo(unittest.TestCase):
     #start salome and connect to it
     try:
       salome_module.main(["start", "-t"])
-    except SystemExit, e:
+    except SystemExit as e:
       pass
     import runSession
     runSession.configureSession()
@@ -44,7 +44,7 @@ class TestCompo(unittest.TestCase):
     xmlLoader = loader.YACSLoader()
     try:
       p = xmlLoader.load("coupling.xml")
-    except IOError,ex:
+    except IOError as ex:
       self.fail("IO exception:" + ex);
     self.assertTrue(p.isValid())
     e = pilot.ExecutorSwig()
@@ -54,7 +54,7 @@ class TestCompo(unittest.TestCase):
   def tearDown(self):
     try:
       salome_module.main(["killall"])
-    except SystemExit, e:
+    except SystemExit as e:
       pass
   
 if __name__ == '__main__':
index 5f05d722c2823ce011cb2d04e36ca6ba49debb60..6b2a80739c4fce708c35146399547602ad208bba 100644 (file)
@@ -20,7 +20,7 @@
 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
 
@@ -149,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]
@@ -159,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()
 """
index e3875ba2613984a56a6839a68e914b84ee36ec9d..d4a99ef96f742393aa9f7bdf3ceb316e9583ffb9 100644 (file)
@@ -160,15 +160,15 @@ o8={"outputValues":o19,
       <outport name="o8" type="SALOME_TYPES/ParametricOutput"/>
    </inline>
    <inline name="PyScript0005">
-      <script><code><![CDATA[print i1
-print i2
-print i3
-print i4
-print i8
-print i9
-print i5
-print i6
-print i7
+      <script><code><![CDATA[print(i1)
+print(i2)
+print(i3)
+print(i4)
+print(i8)
+print(i9)
+print(i5)
+print(i6)
+print(i7)
 ]]></code></script>
       <inport name="i1" type="SALOME_TYPES/Parameter"/>
       <inport name="i2" type="SALOME_TYPES/ParameterList"/>
@@ -181,15 +181,15 @@ print i7
       <inport name="i7" type="SALOME_TYPES/ParametricOutput"/>
    </inline>
    <inline name="PyScript006">
-      <script><code><![CDATA[print i1
-print i2
-print i3
-print i4
-print i8
-print i9
-print i5
-print i6
-print i7
+      <script><code><![CDATA[print(i1)
+print(i2)
+print(i3)
+print(i4)
+print(i8)
+print(i9)
+print(i5)
+print(i6)
+print(i7)
 ]]></code></script>
       <inport name="i1" type="SALOME_TYPES/Parameter"/>
       <inport name="i2" type="SALOME_TYPES/ParameterList"/>
index 75e42b8f6a05807c1fa716fcbfbe44fc777b9a23..cd16304ae1b278cc66cff3e387952a45f7151d15 100644 (file)
@@ -22,15 +22,15 @@ The python module module_generator defines classes which can be used to define a
 generates a SALOME source module, its installation and a SALOME application including this module and
 other preexisting SALOME modules like GEOM, SMESH or others.
 """
-from gener import Module, Service, Generator
-from fcompo import F77Component
-from cppcompo import CPPComponent
-from pacocompo import PACOComponent
-from pycompo import PYComponent
-from astcompo import ASTERComponent
-from hxxcompo import HXX2SALOMEComponent
-from hxxparacompo import HXX2SALOMEParaComponent
-from yacstypes import add_type
-from salomemodules import add_module
-from gener import Library
-from mpicompo import MPIComponent
+from module_generator.gener import Module, Service, Generator
+from module_generator.fcompo import F77Component
+from module_generator.cppcompo import CPPComponent
+from module_generator.pacocompo import PACOComponent
+from module_generator.pycompo import PYComponent
+from module_generator.astcompo import ASTERComponent
+from module_generator.hxxcompo import HXX2SALOMEComponent
+from module_generator.hxxparacompo import HXX2SALOMEParaComponent
+from module_generator.yacstypes import add_type
+from module_generator.salomemodules import add_module
+from module_generator.gener import Library
+from module_generator.mpicompo import MPIComponent
index 03b32be2a2492224680ad5523ac007f22cd795b1..03762c9e22da238315f7fcebd9cbb3cc56fb4e0b 100644 (file)
 """
 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):
   """
@@ -220,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
@@ -234,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)
@@ -283,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
@@ -296,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)
@@ -354,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
@@ -367,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)
index dd77ff1f116a2026f8b9a2f1f89cfd54ed8db6ca..47f77a681900933691579afd2d0cce8368c3eabc 100644 (file)
@@ -20,7 +20,7 @@
 try:
  from string import Template
 except:
- from compat import Template,set
+ from module_generator.compat import Template,set
 
 asterCompo="""
 import sys,traceback,os
@@ -191,9 +191,9 @@ asterService="""
     if not j.cr.estvide():
        msg="ERREUR DE COMPILATION DANS ACCAS - INTERRUPTION"
        self.MESSAGE(msg)
-       print ">> JDC.py : DEBUT RAPPORT"
-       print j.cr
-       print ">> JDC.py : FIN RAPPORT"
+       print (">> JDC.py : DEBUT RAPPORT")
+       print (j.cr)
+       print (">> JDC.py : FIN RAPPORT")
        j.supprime()
        sys.stdout.flush()
        raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,msg+'\\n'+str(j.cr),"${component}.py",0))
@@ -223,14 +223,14 @@ asterService="""
        msg="ERREUR A L'INTERPRETATION DANS ACCAS - INTERRUPTION"
        self.MESSAGE(msg)
        ier=1
-       print ">> JDC.py : DEBUT RAPPORT"
-       print j.cr
-       print ">> JDC.py : FIN RAPPORT"
+       print (">> JDC.py : DEBUT RAPPORT")
+       print (j.cr)
+       print (">> JDC.py : FIN RAPPORT")
        sys.stdout.flush()
        raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,msg+'\\n'+str(j.cr), "${component}.py",0))
 
     if j.par_lot == 'NON':
-       print "FIN EXECUTION"
+       print ("FIN EXECUTION")
        #err=calcium.cp_fin(self.proxy,calcium.CP_ARRET)
        #retour sans erreur (il faut pousser les variables de sortie)
        sys.stdout.flush()
@@ -242,9 +242,9 @@ asterService="""
     if not cr.estvide():
        msg="ERREUR A LA VERIFICATION SYNTAXIQUE - INTERRUPTION"
        self.MESSAGE(msg)
-       print ">> JDC.py : DEBUT RAPPORT"
-       print cr
-       print ">> JDC.py : FIN RAPPORT"
+       print( ">> JDC.py : DEBUT RAPPORT")
+       print( cr)
+       print( ">> JDC.py : FIN RAPPORT")
        sys.stdout.flush()
        raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,msg+'\\n'+str(cr),"${component}.py",0))
 
@@ -256,9 +256,9 @@ asterService="""
           msg="ERREUR A L'EXECUTION - INTERRUPTION"
           self.MESSAGE(msg)
           ier=1
-          print ">> JDC.py : DEBUT RAPPORT"
-          print j.cr
-          print ">> JDC.py : FIN RAPPORT"
+          print( ">> JDC.py : DEBUT RAPPORT")
+          print( j.cr)
+          print( ">> JDC.py : FIN RAPPORT")
           sys.stdout.flush()
           raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,msg+'\\n'+str(j.cr),"${component}.py",0))
        else:
@@ -380,15 +380,15 @@ from SALOME_ContainerPy import SALOME_ContainerPy_i
 
 if __name__ == '__main__':
 
-  print sys.argv
+  print( sys.argv)
   orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
   poa = orb.resolve_initial_references("RootPOA")
-  print "ORB and POA initialized"
+  print( "ORB and POA initialized")
   containerName=os.getenv("SALOME_CONTAINERNAME")
   cpy_i = SALOME_ContainerPy_i(orb, poa, containerName)
-  print "SALOME_ContainerPy_i instance created ",cpy_i
+  print( "SALOME_ContainerPy_i instance created ",cpy_i)
   cpy_o = cpy_i._this()
-  print "SALOME_ContainerPy_i instance activated ",cpy_o
+  print( "SALOME_ContainerPy_i instance activated ",cpy_o)
   sys.stdout.flush()
   sys.stderr.flush()
 
@@ -398,7 +398,7 @@ if __name__ == '__main__':
 
   #Block for ever
   orb.run()
-  print "fin container aster"
+  print( "fin container aster")
   sys.stdout.flush()
   sys.stderr.flush()
 """
@@ -409,10 +409,10 @@ from ${component}_module import ${component}
 
 if __name__ == '__main__':
 
-  print sys.argv
+  print( sys.argv)
   orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
   poa = orb.resolve_initial_references("RootPOA")
-  print "ORB and POA initialized",orb,poa
+  print( "ORB and POA initialized",orb,poa)
   sys.stdout.flush()
   sys.stderr.flush()
 
@@ -423,7 +423,7 @@ if __name__ == '__main__':
   compo=${component}(orb,poa,container,containerName, instanceName, "${component}")
   comp_o = compo._this()
   comp_iors = orb.object_to_string(comp_o)
-  print "ior aster",comp_iors
+  print( "ior aster",comp_iors)
 
   sys.stdout.flush()
   sys.stderr.flush()
@@ -433,7 +433,7 @@ if __name__ == '__main__':
   poaManager.activate()
 
   orb.run()
-  print "fin du composant aster standalone"
+  print( "fin du composant aster standalone")
 
 """
 component=Template(component)
index 0fdafc64e09a9d6ab038c7bafe5f515e4fdc750a..6b849324474e41084114e0c871242c3994d0c122 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 # CORBA idl
 
index 672b33dde2d5475b32b0cc5fb9b36464669d7023..fd01532afab9471127bf48f14e0c057c014579d4 100644 (file)
@@ -38,10 +38,10 @@ def sorted(iterable, cmp=None, key=None, reverse=False) :
                d = {}
                for v in iterable :
                        k = key(v)
-                       if not d.has_key(k) :
+                       if k not in d :
                                d[k] = []
                        d[k].append(v)
-               keys = d.keys()
+               keys = list(d.keys())
                keys.sort(cmp)
                i = []
                for k in keys :
@@ -78,9 +78,8 @@ class _TemplateMetaclass(type):
                cls.pattern = re.compile(pattern, re.IGNORECASE | re.VERBOSE)
 
 
-class Template:
+class Template(metaclass=_TemplateMetaclass):
        """A string class for supporting $-substitutions."""
-       __metaclass__ = _TemplateMetaclass
        
        delimiter = '$'
        idpattern = r'[_a-z][_a-z0-9]*'
index 1b3a897af119f2336f4cec3048eddf10a311cce1..2462e07e3a69c08fcea8959a568352050d791d60 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 cxxCompo="""
 #include "${component}.hxx"
index 4d09676dcd66bd3cf7b56ec29e925c981e7993fe..75a9f0893f1bdfc42e1b813dfa6389b1a15d117f 100644 (file)
 """
 
 import os
-from gener import Component, Invalid
-from cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
-from cpp_tmpl import exeCPP, cmake_src_compo_cpp
-from yacstypes import corba_rtn_type
+from module_generator.gener import Component, Invalid
+from module_generator.cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
+from module_generator.cpp_tmpl import exeCPP, cmake_src_compo_cpp
+from module_generator.yacstypes import corba_rtn_type
 
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 class CPPComponent(Component):
   """
index bed13624686c758a6a26188564d5aa51cdf76acc..1d906e1eec58fea7ec77387f29b0493042bf2cb3 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 # CMakeLists.txt in doc directory
 # template parameters:
index 03dbf455abbe910109cdb77d50889672555446ed..4fcc90d712667147319a6b8a38dc7ad3d4e3155a 100644 (file)
@@ -17,8 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-from gener import Component
-from cppcompo import CPPComponent
+from module_generator.gener import Component
+from module_generator.cppcompo import CPPComponent
 
 import platform
 archi = platform.architecture()[0]
index a8f722607b136e3c5f46fd7bda480cce120b9445..17934a1365d3d3aa463e6c1c48adcd48b157300a 100644 (file)
@@ -24,30 +24,30 @@ import warnings
 try:
   from string import Template
 except:
-  from compat import Template, set
+  from module_generator.compat import Template, set
 
 class Invalid(Exception):
   pass
 
 debug=0
 
-from mod_tmpl import *
-from cata_tmpl import catalog, interface, idl
-from cata_tmpl import xml, xml_interface, xml_service
-from cata_tmpl import idlMakefilePaCO_BUILT_SOURCES, idlMakefilePaCO_nodist_salomeinclude_HEADERS
-from cata_tmpl import idlMakefilePACO_salomepython_DATA, idlMakefilePACO_salomeidl_DATA
-from cata_tmpl import idlMakefilePACO_INCLUDES
-from cata_tmpl import cataOutStream, cataInStream, cataOutparam, cataInparam
-from cata_tmpl import cataOutParallelStream, cataInParallelStream
-from cata_tmpl import cataService, cataCompo
+from module_generator.mod_tmpl import *
+from module_generator.cata_tmpl import catalog, interface, idl
+from module_generator.cata_tmpl import xml, xml_interface, xml_service
+from module_generator.cata_tmpl import idlMakefilePaCO_BUILT_SOURCES, idlMakefilePaCO_nodist_salomeinclude_HEADERS
+from module_generator.cata_tmpl import idlMakefilePACO_salomepython_DATA, idlMakefilePACO_salomeidl_DATA
+from module_generator.cata_tmpl import idlMakefilePACO_INCLUDES
+from module_generator.cata_tmpl import cataOutStream, cataInStream, cataOutparam, cataInparam
+from module_generator.cata_tmpl import cataOutParallelStream, cataInParallelStream
+from module_generator.cata_tmpl import cataService, cataCompo
 #from aster_tmpl import check_aster
-from salomemodules import salome_modules
-from yacstypes import corbaTypes, corbaOutTypes, moduleTypes, idlTypes, corba_in_type, corba_out_type
-from yacstypes import ValidTypes, PyValidTypes, calciumTypes, DatastreamParallelTypes
-from yacstypes import ValidImpl, ValidImplTypes, ValidStreamTypes, ValidParallelStreamTypes, ValidDependencies
-from gui_tmpl import cmake_py_gui, pysalomeapp, cmake_cpp_gui, cppsalomeapp
-from doc_tmpl import docmakefile, docconf, docsalomeapp
-import yacsgen_version
+from module_generator.salomemodules import salome_modules
+from module_generator.yacstypes import corbaTypes, corbaOutTypes, moduleTypes, idlTypes, corba_in_type, corba_out_type
+from module_generator.yacstypes import ValidTypes, PyValidTypes, calciumTypes, DatastreamParallelTypes
+from module_generator.yacstypes import ValidImpl, ValidImplTypes, ValidStreamTypes, ValidParallelStreamTypes, ValidDependencies
+from module_generator.gui_tmpl import cmake_py_gui, pysalomeapp, cmake_cpp_gui, cppsalomeapp
+from module_generator.doc_tmpl import docmakefile, docconf, docsalomeapp
+from module_generator import yacsgen_version
 
 def makedirs(namedir):
   """Create a new directory named namedir. If a directory already exists copy it to namedir.bak"""
@@ -94,10 +94,10 @@ class Module(object):
     self.gui = gui
     try:
       self.validate()
-    except Invalid,e:
+    except Invalid as e:
       if debug:
         traceback.print_exc()
-      print "Error in module %s: %s" % (name,e)
+      print("Error in module %s: %s" % (name,e))
       raise SystemExit
 
   def validate(self):
@@ -175,8 +175,8 @@ class Component(object):
         cmake_vars = cmake_vars + salome_modules[mod]["linklibs"]
       else:
         default_lib = var_template.substitute(name=mod)
-        print "Unknown libraries for module " + mod
-        print "Using default library name " + default_lib
+        print("Unknown libraries for module " + mod)
+        print("Using default library name " + default_lib)
         cmake_vars = cmake_vars + default_lib + "\n  "
     
     return cmake_text, cmake_vars
@@ -252,7 +252,7 @@ class Component(object):
     """
     def get_dependent_modules(mod,modules):
       modules.add(mod)
-      if salome_modules[mod].has_key("depends"):
+      if "depends" in salome_modules[mod]:
         for m in salome_modules[mod]["depends"]:
           if m not in modules:
             get_dependent_modules(m,modules)
@@ -294,7 +294,7 @@ class Service(object):
 
       >>> s1 = module_generator.Service('myservice', inport=[("a","double"),],
                                         instream=[("aa","CALCIUM_double","I")],
-                                        body="print a")
+                                        body="print( a)")
 
 
   """
@@ -455,7 +455,7 @@ class Generator(object):
       srcs[compo.name] = fdict
 
     cmakecontent = ""
-    components_string = "".join(map(lambda x: x.name+" ", module.components))
+    components_string = "".join([x.name+" " for x in module.components])
 
     if self.module.gui:
       GUIname=module.name+"GUI"
@@ -482,8 +482,7 @@ class Generator(object):
       cmake_gui="OFF"
       
     prefix = os.path.abspath(self.module.prefix)
-    component_libs = "".join(map(lambda x: x.libraryName()+" ",
-                                           module.components))
+    component_libs = "".join([x.libraryName()+" " for x in module.components])
     add_modules = ""
     for x in self.used_modules:
       cmake_text = cmake_find_module.substitute(module=x)
@@ -539,11 +538,9 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
 #            other_sks=other_sks+os.path.splitext(os.path.basename(fidl))[0]+"SK.cc "
 
     include_template=Template("$${${module}_ROOT_DIR}/idl/salome")
-    opt_inc="".join(map(lambda x:include_template.substitute(module=x)+"\n  ",
-                                       self.used_modules))
+    opt_inc="".join([include_template.substitute(module=x)+"\n  " for x in self.used_modules])
     link_template=Template("$${${module}_SalomeIDL${module}}")
-    opt_link="".join(map(lambda x:link_template.substitute(module=x)+"\n  ",
-                                       self.used_modules))
+    opt_link="".join([link_template.substitute(module=x)+"\n  " for x in self.used_modules])
     
     idlfiles={"CMakeLists.txt":cmake_idl.substitute(module=module.name,
                                                     extra_idl=other_idls,
@@ -682,16 +679,13 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
           elif src[-3:]==".ui":
             ui_files=ui_files+os.path.basename(src)+"\n  "
           elif src[-3:]==".ts":
-           ts_files=ts_files+os.path.basename(src)+"\n  "
+            ts_files = ts_files + os.path.basename(src) + "\n  "
           else:
             other=other+os.path.basename(src)+"\n  "
 
-      compo_dirs = "".join(map(lambda x: 
-                                 "${PROJECT_SOURCE_DIR}/src/"+x.name+"\n  ",
-                                 self.module.components))
+      compo_dirs = "".join(["${PROJECT_SOURCE_DIR}/src/"+x.name+"\n  " for x in self.module.components])
       compo_dirs = compo_dirs + "${PROJECT_BINARY_DIR}/src/" + self.module.name + "GUI\n"
-      component_libs = "".join(map(lambda x:
-                              x.libraryName()+" ", self.module.components))
+      component_libs = "".join([x.libraryName()+" " for x in self.module.components])
       makefile=cmake_cpp_gui.substitute(module=self.module.name,
                                     include_dirs=compo_dirs,
                                     libs=component_libs,
@@ -713,19 +707,19 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
 
   def makeMakefile(self,makefileItems):
     makefile=""
-    if makefileItems.has_key("header"):
+    if "header" in makefileItems:
       makefile=makefile + makefileItems["header"]+'\n'
-    if makefileItems.has_key("lib_LTLIBRARIES"):
+    if "lib_LTLIBRARIES" in makefileItems:
       makefile=makefile+"lib_LTLIBRARIES= "+" ".join(makefileItems["lib_LTLIBRARIES"])+'\n'
-    if makefileItems.has_key("salomepython_PYTHON"):
+    if "salomepython_PYTHON" in makefileItems:
       makefile=makefile+"salomepython_PYTHON= "+" ".join(makefileItems["salomepython_PYTHON"])+'\n'
-    if makefileItems.has_key("dist_salomescript_SCRIPTS"):
+    if "dist_salomescript_SCRIPTS" in makefileItems:
       makefile=makefile+"dist_salomescript_SCRIPTS= "+" ".join(makefileItems["dist_salomescript_SCRIPTS"])+'\n'
-    if makefileItems.has_key("salomeres_DATA"):
+    if "salomeres_DATA" in makefileItems:
       makefile=makefile+"salomeres_DATA= "+" ".join(makefileItems["salomeres_DATA"])+'\n'
-    if makefileItems.has_key("salomeinclude_HEADERS"):
+    if "salomeinclude_HEADERS" in makefileItems:
       makefile=makefile+"salomeinclude_HEADERS= "+" ".join(makefileItems["salomeinclude_HEADERS"])+'\n'
-    if makefileItems.has_key("body"):
+    if "body" in makefileItems:
       makefile=makefile+makefileItems["body"]+'\n'
     return makefile
 
@@ -798,7 +792,7 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
 
   # For PaCO++
   def makexml(self):
-    from pacocompo import PACOComponent
+    from .pacocompo import PACOComponent
     interfaces = []
     for compo in self.module.components:
       if isinstance(compo, PACOComponent):
@@ -815,15 +809,12 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
        dic key = file name to create
        dic value = file content or dictionary defining the content of a sub directory
     """
-    for name, content in dic.items():
+    for name, content in list(dic.items()):
       filename = os.path.join(basedir, name)
-      if isinstance(content, basestring):
-        if isinstance(content, unicode):
-            # encodage to utf-8 if unicode string
-            content=content.encode('utf8')
-        fil =  open(filename, 'w')
-        fil.write(content)
-        fil.close()
+      if isinstance(content, str):
+        # encodage to utf-8 if unicode string / on python3 str are unicode
+        with open(filename, 'w') as fil:
+          fil.write(content)
       else:
         if not os.path.exists(filename):
           os.makedirs(filename)
@@ -915,14 +906,14 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
     modules = []
     if restrict:
       for mod in restrict:
-        if modules_dict.has_key(mod):
+        if mod in modules_dict:
           modules.append(modules_dict[mod])
     else:
-      modules = modules_dict.values()
+      modules = list(modules_dict.values())
 
     #add the alternate modules if given
     if altmodules:
-      for module, path in altmodules.items():
+      for module, path in list(altmodules.items()):
         modules.append('  <module name="%s" path="%s"/>' % (module, path))
 
     #add the generated module
@@ -976,4 +967,3 @@ ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
       host = socket.gethostname().split('.')[0]
       fil.write(command % host)
       fil.close()
-
index 5b5237c348576058945339073dac3fe8b498cfda..f16ed06e356d3aea41683fe5aef01cb2b4fa0ea4 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 # SalomeApp.xml file for a python gui.
 # template parameters:
index 1496c8cdaffae35061679b83512bcc1b8c636cdb..f6b2537308f515009aa3ae7dcdfa07aafa17bd94 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 cxxCompo="""
 // this cxx file was generated by yacsgen
index 48b755267536877d337fb9a30052990c098f0d05..a5f5dfcca9a6f1ce0c0b6ab7b4fc25e9351bb8db 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 cxxCompo="""
 // this cxx file was generated by yacsgen
index cc5eff8aa5f1700d85fb6c7f579cd6b8e85cf798..b54881fa0953d954410371ad936d220752f94812 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 hxxgui_cxx="""
 #include "${component_name}GUI.h"
index 32020277b1d87be5877c76f15a9f11a753ecffe1..e02711d2657c732f08c41b3f673d1261cdef9883 100644 (file)
 
 debug=1
 import os
-import string
 import fnmatch
 from tempfile import mkstemp
-from gener import Component, Invalid
-from hxx_tmpl import cxxService, hxxCompo, cxxCompo, cmake_src_compo_hxx
+from module_generator.gener import Component, Invalid
+from module_generator.hxx_tmpl import cxxService, hxxCompo, cxxCompo, cmake_src_compo_hxx
 from module_generator import Service
-from yacstypes import corba_rtn_type,moduleTypes
-from hxx_awk import parse01,parse1,parse2,parse3
-from hxx_awk import cpp2idl_mapping
+from module_generator.yacstypes import corba_rtn_type,moduleTypes
+from module_generator.hxx_awk import parse01,parse1,parse2,parse3
+from module_generator.hxx_awk import cpp2idl_mapping
 # these tables contain the part of code which depends upon c++ types
-from hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c  
-from hxx_awk import cpp2yacs_mapping
+from module_generator.hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c  
+from module_generator.hxx_awk import cpp2yacs_mapping
 from tempfile import mkdtemp
-from hxx_tmpl_gui import hxxgui_cxx, hxxgui_h, hxxgui_icon_ts
-from hxx_tmpl_gui import hxxgui_message_en, hxxgui_message_fr
-from hxx_tmpl_gui import hxxgui_config, hxxgui_xml_fr, hxxgui_xml_en
-from gener import Library
-from gui_tmpl import cppsalomeapp
+from module_generator.hxx_tmpl_gui import hxxgui_cxx, hxxgui_h, hxxgui_icon_ts
+from module_generator.hxx_tmpl_gui import hxxgui_message_en, hxxgui_message_fr
+from module_generator.hxx_tmpl_gui import hxxgui_config, hxxgui_xml_fr, hxxgui_xml_en
+from module_generator.gener import Library
+from module_generator.gui_tmpl import cppsalomeapp
 
 # ------------------------------------------------------------------------------
 
@@ -68,7 +67,7 @@ class HXX2SALOMEComponent(Component):
     f=os.popen(cmd1)
     class_name=f.readlines()[0]
     name=class_name
-    print "classname=",class_name
+    print("classname=",class_name)
     f.close()
 
     # create temporary awk files for the parsing
@@ -129,7 +128,7 @@ class HXX2SALOMEComponent(Component):
     result_parsing=open("parse_type_result","r")
     for line in result_parsing.readlines():
         line=line[0:-1] # get rid of trailing \n
-        words = string.split(line,';')
+        words = line.split(';')
 
         if len(words) >=3 and words[0] == "Function": # detect a new service
             function_name=words[2]
@@ -165,10 +164,10 @@ class HXX2SALOMEComponent(Component):
     #  - store it in service_definition[serv]["impl"]
     for serv in list_of_services:
         if debug:
-            print "service : ",serv
-            print "  inports  -> ",service_definition[serv]["inports"]
-            print "  outports -> ",service_definition[serv]["outports"]
-            print "  return   -> ",service_definition[serv]["ret"]
+            print("service : ",serv)
+            print("  inports  -> ",service_definition[serv]["inports"])
+            print("  outports -> ",service_definition[serv]["outports"])
+            print("  return   -> ",service_definition[serv]["ret"])
 
 
         # Part 1 : Argument pre-processing
@@ -199,7 +198,7 @@ class HXX2SALOMEComponent(Component):
               post=""
               pre=""
 
-              if string.find(cpp_impl_a[argtype],"auto_ptr" ) != -1 :
+              if cpp_impl_a[argtype].find("auto_ptr" ) != -1 :
                   # for auto_ptr argument, retrieve the raw pointer behind
                   post=".get()" 
               if  argtype == "const MEDMEM::MESH&"  or  \
@@ -229,7 +228,7 @@ class HXX2SALOMEComponent(Component):
         # Part 3.b : In Argument Post-processing
         for (argname,argtype) in service_definition[serv]["inports"]:
             # not all in types require a treatment
-            if cpp_impl_c.has_key(argtype)
+            if argtype in cpp_impl_c
                 format=cpp_impl_c[argtype]
                 # id : treatment of %(module) is postponed in makecxx
                 s_argument_postprocessing += \
@@ -251,7 +250,7 @@ class HXX2SALOMEComponent(Component):
                                            s_argument_postprocessing + \
                                            s_rtn_processing
         if debug:
-            print "implementation :\n",service_definition[serv]["impl"]
+            print("implementation :\n",service_definition[serv]["impl"])
 
     #
     # Create a list of Service objects (called services), 
@@ -288,13 +287,13 @@ class HXX2SALOMEComponent(Component):
 
         code=service_definition[serv]["impl"]
         if debug:
-            print "service : ",serv
-            print "  inports  -> ",service_definition[serv]["inports"]
-            print "  converted inports  -> ",inports
-            print "  outports -> ",service_definition[serv]["outports"]
-            print "  converted outports  -> ",outports
-            print "  Return  -> ",service_definition[serv]["ret"]
-            print "  converted Return  -> ",Return
+            print("service : ",serv)
+            print("  inports  -> ",service_definition[serv]["inports"])
+            print("  converted inports  -> ",inports)
+            print("  outports -> ",service_definition[serv]["outports"])
+            print("  converted outports  -> ",outports)
+            print("  Return  -> ",service_definition[serv]["ret"])
+            print("  converted Return  -> ",Return)
 
         services.append(Service(serv, 
            inport=inports, 
@@ -430,7 +429,7 @@ class HXX2SALOMEComponent(Component):
     defs = []
     for serv in self.services:
       defs.append(serv.defs)
-      print "CNC bug : ",serv.body
+      print("CNC bug : ",serv.body)
       service = cxxService.substitute(
                            component=self.name, 
                            service=serv.name,
@@ -530,7 +529,7 @@ class HXX2SALOMEComponent(Component):
 
   def getIdlInterfaces(self):
     services = self.getIdlServices()
-    from hxx_tmpl import interfaceidlhxx
+    from .hxx_tmpl import interfaceidlhxx
     Inherited=""
     if self.use_medmem==True:
         Inherited="Engines::EngineComponent,SALOME::MultiCommClass,SALOME_MED::MED_Gen_Driver"
index 059dbcec6a1f69260469e7baed4f5b2ee7a38082..59c7b6880a77b49dea8121e002393d6d1b472a65 100644 (file)
 
 debug=1
 import os
-from gener import Component, Invalid
-from hxx_para_tmpl import cxxService, hxxCompo, cxxCompo, cmake_src_compo_hxxpara
+from module_generator.gener import Component, Invalid
+from module_generator.hxx_para_tmpl import cxxService, hxxCompo, cxxCompo, cmake_src_compo_hxxpara
 from module_generator import Service
-import string
 from tempfile import mkstemp
-from yacstypes import corba_rtn_type,moduleTypes
-from gener import Library
+from module_generator.yacstypes import corba_rtn_type,moduleTypes
+from module_generator.gener import Library
 
 class HXX2SALOMEParaComponent(Component):
   def __init__(self, hxxfile , cpplib , cpp_path ):
@@ -49,12 +48,12 @@ class HXX2SALOMEParaComponent(Component):
     self.hxxfile=hxxfile  # to include it in servant implementation
 
     # grab name of c++ component
-    from hxx_awk import parse01,parse1,parse2,parse3
+    from .hxx_awk import parse01,parse1,parse2,parse3
     cmd1="""awk '$1 == "class" && $0 !~ /;/ {print $2}' """ + hxxfileful[0] + """|awk -F: '{printf "%s",$1}' """
     f=os.popen(cmd1)
     class_name=f.readlines()[0]
     name=class_name
-    print "classname=",class_name
+    print("classname=",class_name)
 
     if cpplib[:3]=="lib" and cpplib[-3:]==".so":
         cpplibname=cpplib[3:-3]  # get rid of lib and .so, to use within makefile.am
@@ -101,8 +100,8 @@ class HXX2SALOMEParaComponent(Component):
     #   ...
     # The service names are stored in list_of_services
     # The information relative to a service (called service_name) is stored in the dictionnary service_definition[service_name]
-    from hxx_awk import cpp2idl_mapping
-    from hxx_awk import cpp2yacs_mapping
+    from .hxx_awk import cpp2idl_mapping
+    from .hxx_awk import cpp2yacs_mapping
     cpp2yacs_mapping["const MEDCoupling::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
     cpp2yacs_mapping["const MEDCoupling::MEDCouplingFieldDouble&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
     cpp2yacs_mapping["MEDCoupling::MEDCouplingFieldDouble*&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
@@ -112,7 +111,7 @@ class HXX2SALOMEParaComponent(Component):
     result_parsing=open("parse_type_result","r")
     for line in result_parsing.readlines():
         line=line[0:-1] # get rid of trailing \n
-        words = string.split(line,';')
+        words = line.split(';')
 
         if len(words) >=3 and words[0] == "Function": # detect a new service
             function_name=words[2]
@@ -140,19 +139,19 @@ class HXX2SALOMEParaComponent(Component):
             else:
                 service_definition[list_of_services[-1]]["outports"].append( (argname,typename) )
 
-    if service_definition.has_key('getInputFieldTemplate'):
+    if 'getInputFieldTemplate' in service_definition:
         del service_definition['getInputFieldTemplate']
     #
     # generate implementation of c++ servant
     # store it in service_definition[serv]["impl"]
     #
-    from hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c  # these tables contain the part of code which depends upon c++ types
+    from .hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c  # these tables contain the part of code which depends upon c++ types
     cpp_impl_b["MEDCoupling::MEDCouplingFieldDouble*"]="""\tMEDCoupling::MPIMEDCouplingFieldDoubleServant * _rtn_field_i = new MEDCoupling::MPIMEDCouplingFieldDoubleServant(_orb,_poa,this,_rtn_cpp);
 \t_rtn_cpp->decrRef();
 \tSALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr _rtn_ior = _rtn_field_i->_this();\n"""
     cpp_impl_a["const MEDCoupling::MEDCouplingFieldDouble*"]="\tMEDCoupling::MEDCouplingFieldDouble* _%(arg)s=cppCompo_->getInputFieldTemplate();\n\t_setInputField(%(arg)s,_%(arg)s);\n\t_initializeCoupling(%(arg)s);\n"
 
-    from yacstypes import corbaTypes,corbaOutTypes
+    from .yacstypes import corbaTypes,corbaOutTypes
     format_thread_signature="void * th_%s(void * st);" # this thread declaration will be included in servant's header
     format_thread_struct="typedef struct {\n  int ip;\n  Engines::IORTab* tior;\n%(arg_decl)s} thread_%(serv_name)s_str;" # this thread declaration will be included in servant's header
     format_thread_create="""
@@ -219,10 +218,10 @@ void *th_%(serv_name)s(void *s)
     self.thread_impl=""  # the implementation of the thread functions used to invoque services on slave processors 
     for serv in list_of_services:
         if debug:
-            print "service : ",serv
-            print "  inports  -> ",service_definition[serv]["inports"]
-            print "  outports -> ",service_definition[serv]["outports"]
-            print "  return   -> ",service_definition[serv]["ret"]
+            print("service : ",serv)
+            print("  inports  -> ",service_definition[serv]["inports"])
+            print("  outports -> ",service_definition[serv]["outports"])
+            print("  return   -> ",service_definition[serv]["ret"])
 
         # Part 0 : specific treatments for parallel components (call threads to forward the invocation to the service to all processes)
         service_definition[serv]["thread_func_decl"]=format_thread_signature % serv
@@ -273,7 +272,7 @@ void *th_%(serv_name)s(void *s)
               # special treatment for some arguments
               post=""
               pre=""
-              if string.find(cpp_impl_a[argtype],"auto_ptr" ) != -1 :
+              if cpp_impl_a[argtype].find("auto_ptr" ) != -1 :
                   post=".get()" # for auto_ptr argument, retrieve the raw pointer behind
               if  argtype == "const MEDMEM::MESH&"  or  argtype == "const MEDMEM::SUPPORT&" : 
                   pre="*"  # we cannot create MESHClient on the stack (private constructor), so we create it on the heap and dereference it
@@ -291,7 +290,7 @@ void *th_%(serv_name)s(void *s)
                                                                                               # because we don't know here the module name
         # Part 3.b : In Argument Post-processing
         for (argname,argtype) in service_definition[serv]["inports"]:
-            if cpp_impl_c.has_key(argtype): # not all in types require a treatment
+            if argtype in cpp_impl_c: # not all in types require a treatment
                 format=cpp_impl_c[argtype]
                 s_argument_postprocessing += format % {"arg" : argname, "module" : "%(module)s" } # id : treatment of %(module) is postponed in makecxx
 
@@ -302,7 +301,7 @@ void *th_%(serv_name)s(void *s)
 
         service_definition[serv]["impl"] = s_thread_call + s_argument_processing + s_call_cpp_function + s_thread_join  + s_argument_postprocessing + s_rtn_processing
         if debug:
-            print "implementation :\n",service_definition[serv]["impl"]
+            print("implementation :\n",service_definition[serv]["impl"])
 
     #
     # Create a list of Service objects (called services), and give it to Component constructor
@@ -337,13 +336,13 @@ void *th_%(serv_name)s(void *s)
 
         code=service_definition[serv]["impl"]
         if debug:
-            print "service : ",serv
-            print "  inports  -> ",service_definition[serv]["inports"]
-            print "  converted inports  -> ",inports
-            print "  outports -> ",service_definition[serv]["outports"]
-            print "  converted outports  -> ",outports
-            print "  Return  -> ",service_definition[serv]["ret"]
-            print "  converted Return  -> ",Return
+            print("service : ",serv)
+            print("  inports  -> ",service_definition[serv]["inports"])
+            print("  converted inports  -> ",inports)
+            print("  outports -> ",service_definition[serv]["outports"])
+            print("  converted outports  -> ",outports)
+            print("  Return  -> ",service_definition[serv]["ret"])
+            print("  converted Return  -> ",Return)
 
         services.append(Service(serv, 
            inport=inports, 
@@ -441,10 +440,10 @@ void *th_%(serv_name)s(void *s)
     thread_func_decl="\n".join(self.thread_func_decl)
     thread_str_decl="\n".join(self.thread_str_decl)
     if debug:
-        print "thread_func_decl : "
-        print thread_func_decl
-        print "thread_str_decl : "
-        print thread_str_decl
+        print("thread_func_decl : ")
+        print(thread_func_decl)
+        print("thread_str_decl : ")
+        print(thread_str_decl)
 
     if self.inheritedclass:
       inheritedclass= " public virtual " + self.inheritedclass + ","
@@ -473,7 +472,7 @@ void *th_%(serv_name)s(void *s)
 
   def getIdlInterfaces(self):
     services = self.getIdlServices()
-    from hxx_tmpl import interfaceidlhxx
+    from .hxx_tmpl import interfaceidlhxx
     Inherited=""
     Inherited="SALOME_MED::ParaMEDMEMComponent"
     return interfaceidlhxx.substitute(component=self.name,inherited=Inherited, services="\n".join(services))
index 3767e529370395f0ca42e1e9dc989d8d8dc9a9ed..a59a6f7a71f49eec6a4922dbb68c7a13631016d7 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 application="""
 <application>
index c393c1c5fe863e5d8abe5d6a1ea7e7c65cdb86c4..cc51bd0138498258fbdbe8d743175c90f1f13751 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 # cxx file of a MPI component.
 # template parameters:
index 5703a9088f8426f0972594de3a69b3ab49319391..b060c52d73994f32e276cc74e69d5ae2e061e83f 100644 (file)
 """
 
 import os
-from gener import Component, Invalid
-from cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
-from cpp_tmpl import exeCPP, cmake_src_compo_cpp
-from yacstypes import corba_rtn_type, corba_in_type
-import mpi_tmpl
-from cppcompo import CPPComponent
+from module_generator.gener import Component, Invalid
+from module_generator.cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
+from module_generator.cpp_tmpl import exeCPP, cmake_src_compo_cpp
+from module_generator.yacstypes import corba_rtn_type, corba_in_type
+from module_generator import mpi_tmpl
+from module_generator.cppcompo import CPPComponent
 
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 class MPIComponent(CPPComponent):
   """
index 064b2607d9e537493bc37a1e31662074b1c442fa..bcf190df381a4517b10971017e8364fa9f89597b 100644 (file)
@@ -24,7 +24,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
   
 compoMakefile="""
 include $$(top_srcdir)/adm_local/make_common_starter.am
index 7950e3d68c6c6c4d23428a11c70b7fe456f5a35a..4a895f628499e85c5a33890f893a2e76df4aee43 100644 (file)
   Module that defines PACOComponent for SALOME PaCO++ components implemented in C++
 """
 import os
-from gener import Component, Invalid
-from paco_tmpl import compoMakefile, hxxCompo, cxxService
-from paco_tmpl import initService, cxxCompo, paco_sources
-from paco_tmpl import cxxFactoryDummy, cxxFactoryMpi, cxx_des_parallel_stream
-from paco_tmpl import hxxparallel_instream, hxxparallel_outstream, hxxinit_ok
-from paco_tmpl import hxxparallel_instream_init, hxxparallel_outstream_init, cxxService_connect
-from paco_tmpl import cxx_cons_service, cxx_cons_parallel_outstream, cxx_cons_parallel_instream
-from cata_tmpl import parallel_interface
+from module_generator.gener import Component, Invalid
+from module_generator.paco_tmpl import compoMakefile, hxxCompo, cxxService
+from module_generator.paco_tmpl import initService, cxxCompo, paco_sources
+from module_generator.paco_tmpl import cxxFactoryDummy, cxxFactoryMpi, cxx_des_parallel_stream
+from module_generator.paco_tmpl import hxxparallel_instream, hxxparallel_outstream, hxxinit_ok
+from module_generator.paco_tmpl import hxxparallel_instream_init, hxxparallel_outstream_init, cxxService_connect
+from module_generator.paco_tmpl import cxx_cons_service, cxx_cons_parallel_outstream, cxx_cons_parallel_instream
+from module_generator.cata_tmpl import parallel_interface
 
 class PACOComponent(Component):
 
index 85cf820c07925e6e19581ff21bf9c1eb3fc9f41e..f97bf8d05d7025b63d25121f98802732c565bca9 100644 (file)
   Module that defines PYComponent for SALOME components implemented in Python
 """
 import os
-from gener import Component, Invalid
-from pyth_tmpl import pyinitService, pyService, pyCompoEXE, pyCompo, cmake_src_compo_py
+from module_generator.gener import Component, Invalid
+from module_generator.pyth_tmpl import pyinitService, pyService, pyCompoEXE, pyCompo, cmake_src_compo_py
 import textwrap
-from string import split,rstrip,join
 
 def indent(text, prefix='    '):
   """Indent text by prepending a given prefix to each line."""
   if not text: return ''
-  lines = split(text, '\n')
-  lines = map(lambda line, prefix=prefix: prefix + line, lines)
-  if lines: lines[-1] = rstrip(lines[-1])
-  return join(lines, '\n')
+  lines = text.split('\n')
+  lines = list(map(lambda line, prefix=prefix: prefix + line, lines))
+  if lines: lines[-1] = lines[-1].rstrip()
+  return '\n'.join(lines)
 
 class PYComponent(Component):
   """
@@ -99,8 +98,7 @@ class PYComponent(Component):
       raise Invalid("Invalid kind ()%s for component %s" % (
                                     self.kind, self.name))
     
-    sources = pyfile + "".join(map(lambda x: "\n  " + os.path.basename(x),
-                                   self.sources))
+    sources = pyfile + "".join(["\n  " + os.path.basename(x) for x in self.sources])
     cmake_content = cmake_src_compo_py.substitute(sources=sources)
     
     return {"CMakeLists.txt":cmake_content,
@@ -120,7 +118,7 @@ class PYComponent(Component):
         if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
-          pyparams.append("      %s=cPickle.loads(%s)" %(name, name))
+          pyparams.append("      %s=pickle.loads(%s)" %(name, name))
       inparams = ",".join(params)
       convertinparams = '\n'.join(pyparams)
 
@@ -130,7 +128,7 @@ class PYComponent(Component):
         if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
-          pyparams.append("      %s=cPickle.dumps(%s,-1)" %(name, name))
+          pyparams.append("      %s=pickle.dumps(%s,-1)" %(name, name))
       outparams = ",".join(params)
       convertoutparams = '\n'.join(pyparams)
       #dedent and indent the body
@@ -184,7 +182,7 @@ class PYComponent(Component):
         if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
-          pyparams.append("      %s=cPickle.loads(%s)" %(name, name))
+          pyparams.append("      %s=pickle.loads(%s)" %(name, name))
       inparams = ",".join(params)
       convertinparams = '\n'.join(pyparams)
 
@@ -194,7 +192,7 @@ class PYComponent(Component):
         if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
-          pyparams.append("      %s=cPickle.dumps(%s,-1)" %(name, name))
+          pyparams.append("      %s=pickle.dumps(%s,-1)" %(name, name))
       outparams = ",".join(params)
       convertoutparams = '\n'.join(pyparams)
       #dedent and indent the body
index e8199139dd6bffe8bbc7e4f7e4b48120c9da4929..bc7348b0938cd746c551559aab5f30a4dfb6b007 100644 (file)
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 pyCompo="""
 import sys,traceback,os
@@ -30,7 +30,7 @@ import calcium
 import dsccalcium
 import SALOME
 import Engines
-import cPickle
+import pickle
 
 try:
   import numpy
@@ -70,10 +70,10 @@ pyCompoEXE="""#!/usr/bin/env python
 
 if __name__ == '__main__':
   from omniORB import CORBA
-  print sys.argv
+  print( sys.argv)
   orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
   poa = orb.resolve_initial_references("RootPOA")
-  print "ORB and POA initialized",orb,poa
+  print( "ORB and POA initialized",orb,poa)
   sys.stdout.flush()
   sys.stderr.flush()
 
@@ -84,7 +84,7 @@ if __name__ == '__main__':
   compo=${component}(orb,poa,container,containerName, instanceName, "${component}")
   comp_o = compo._this()
   comp_iors = orb.object_to_string(comp_o)
-  print "ior ${component}",comp_iors
+  print( "ior ${component}",comp_iors)
 
   sys.stdout.flush()
   sys.stderr.flush()
@@ -94,7 +94,7 @@ if __name__ == '__main__':
   poaManager.activate()
 
   orb.run()
-  print "fin du composant ${component} standalone"
+  print( "fin du composant ${component} standalone")
 
 """
 
index 39579668df39df3b5520c02b4ce7750c571044dc..1e2185ca5a7d1e4bf7ca47b38f53598a8e5c91a6 100644 (file)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-major_version=8
-minor_version=5
+major_version=9
+minor_version=1
 patch_version=0
 complete_version="%d.%d.%d" % (major_version, minor_version, patch_version)
index abb2c5de63cdefffc47865bc9365ebc6cb4263ca..637948427654da6923e7270e45674428c1ea27ea 100644 (file)
@@ -62,7 +62,7 @@ def corba_rtn_type(typ, module):
   else:
     return corbaRtnTypes[typ]
 
-ValidTypes = corbaTypes.keys()
+ValidTypes = list(corbaTypes.keys())
 PyValidTypes = ValidTypes+["pyobj"]
 
 def add_type(typename, corbaType=None, corbaOutType=None, module="", idltype=None, corbaRtnType=None):
@@ -102,8 +102,8 @@ DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"}
 
 ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO")
 ValidImplTypes = ("sequential", "parallel")
-ValidStreamTypes = calciumTypes.keys()
-ValidParallelStreamTypes = DatastreamParallelTypes.keys()
+ValidStreamTypes = list(calciumTypes.keys())
+ValidParallelStreamTypes = list(DatastreamParallelTypes.keys())
 ValidDependencies = ("I", "T")
 
 #Add KERNEL YACS types : YACS name, c++ corba arg in, c++ corba arg out,defining module, repr corba idl, c++ corba return
index 053e697840cf339efee3a3a48f541efddb17630f..6fda8ede15e67f77e990baf7c8a58e0a0699c112 100755 (executable)
@@ -80,21 +80,21 @@ def main():
 
 #   Make sure given paths/files are valid
     if not os.path.exists(cppdir):
-        print "ERROR: cppdir %s does not exist. It is mandatory" % cppdir
-        print usage
+        print("ERROR: cppdir %s does not exist. It is mandatory" % cppdir)
+        print(usage)
         sys.exit(1)
 
     if not os.path.exists(installpath):
-        print "ERROR: installpath %s does not exist. It is mandatory" \
-              % installpath
-        print usage
+        print("ERROR: installpath %s does not exist. It is mandatory" \
+              % installpath)
+        print(usage)
         sys.exit(1)
 
     if options.environ_file != None:
         if not os.path.exists(options.environ_file):
-            print "ERROR: environ_file %s does not exist. It is mandatory" \
-                  % options.environ_file
-            print usage
+            print("ERROR: environ_file %s does not exist. It is mandatory" \
+                  % options.environ_file)
+            print(usage)
             sys.exit(1)
 
     hxx2salome(cppdir=cppdir,
@@ -141,7 +141,7 @@ def hxx2salome(cppdir,
     try: 
         os.mkdir(install_root_dir)
     except OSError:
-        print "Warning : directory %s already exixts!" % install_root_dir
+        print("Warning : directory %s already exixts!" % install_root_dir)
 
     # if a graphical user interface is required,
     # ask HXX2SALOMEComponent to generate template files