Salome HOME
Merge Python 3 porting.
authorrnv <rnv@opencascade.com>
Thu, 22 Jun 2017 16:45:01 +0000 (19:45 +0300)
committerrnv <rnv@opencascade.com>
Tue, 27 Jun 2017 16:29:37 +0000 (19:29 +0300)
208 files changed:
Demo/xmlrpcprog_orig.py
Misc/doxy2swig.py
NEWS
README
doc/advancepy.rst
doc/exemples/exemple2/exmpl.py
doc/exemples/exemple3/use.py
doc/exemples/exemple8/client.py
py-compile
src/engine/Plugin/saconst.h
src/engine_swig/CMakeLists.txt
src/engine_swig/engtypemaps.i
src/engine_swig/pilot.i
src/engine_swig/pypilot.i
src/evalyfx/CMakeLists.txt
src/evalyfx/YACSEvalPort.cxx
src/evalyfx/YACSEvalSeqAny.cxx
src/evalyfx/YACSEvalSession.cxx
src/evalyfx/YACSEvalSessionInternal.cxx
src/evalyfx/YACSEvalYFXPattern.cxx
src/evalyfx_swig/CMakeLists.txt
src/evalyfx_swig/evalyfx.i
src/evalyfx_swig/test3.py
src/genericgui/CMakeLists.txt
src/genericgui/FormContainerDecorator.cxx
src/genericgui/FormParamContainer.ui
src/genericgui/ListJobs_GUI.cxx
src/genericgui/SceneComposedNodeItem.cxx
src/genericgui/journal
src/hmi/CMakeLists.txt
src/hmi/guiObservers.cxx
src/pmml/pmml_swig/PMMLBasicsTest.py
src/pmml/pmml_swig/PMMLBasicsTestLauncher.py
src/py2yacs/CMakeLists.txt
src/py2yacs/Test/Py2yacsTest.cxx
src/py2yacs/py2yacs.cxx
src/py2yacs/py2yacs.py
src/pyqt/gui/Appli.py
src/pyqt/gui/BoxManager.py
src/pyqt/gui/CItems.py
src/pyqt/gui/CONNECTOR.py
src/pyqt/gui/GraphViewer.py
src/pyqt/gui/Icons.py
src/pyqt/gui/Item.py
src/pyqt/gui/Items.py
src/pyqt/gui/PanelManager.py
src/pyqt/gui/Tree.py
src/pyqt/gui/adapt.py
src/pyqt/gui/browser.py
src/pyqt/gui/browser_catalog.py
src/pyqt/gui/browser_session.py
src/pyqt/gui/cataitems.py
src/pyqt/gui/catalog.py
src/pyqt/gui/graph.py
src/pyqt/gui/panels.py
src/pyqt/gui/sessions.py
src/pyqt/yacsfiles/forloop3.xml
src/pyqt/yacsfiles/while1.xml
src/runtime/CMakeLists.txt
src/runtime/CORBAPorts.cxx
src/runtime/DistributedPythonNode.cxx
src/runtime/PyStdout.cxx
src/runtime/PythonNode.cxx
src/runtime/PythonPorts.cxx
src/runtime/RuntimeSALOME.cxx
src/runtime/RuntimeSALOME.hxx
src/runtime/SalomePythonNode.cxx
src/runtime/StudyNodes.cxx
src/runtime/Test/CMakeLists.txt
src/runtime/Test/runtimeTest.cxx
src/runtime/Test/xmlrun_orig.sh
src/runtime/TypeConversions.cxx
src/runtime/TypeConversions.hxx
src/runtime_swig/CMakeLists.txt
src/runtime_swig/SALOMERuntime.i
src/salomeloader/CMakeLists.txt
src/salomeloader/ElementPath.py [deleted file]
src/salomeloader/ElementTree.py [deleted file]
src/salomeloader/graph.py
src/salomeloader/salomeloader.py
src/salomeloader/samples/Graph_couronne.xml
src/salomeloader/samples/testvisu20.xml
src/salomeloader/testSalomeLoader.py.in
src/wrappergen/bin/Cpp_Template__SRC/adm/unix/config_files/ac_python_devel.m4
src/wrappergen/bin/Cpp_Template__SRC/adm/unix/config_files/check_python.m4
src/wrappergen/bin/Cpp_Template__SRC/src/Cpp_Template_/Cpp_Template__CXX/Cpp_Template_.hxx
src/wrappergen/bin/Cpp_Template__SRC/src/Cpp_Template_/Cpp_Template__TEST/Cpp_Template__test.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/config_files/python.m4
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/bin/runSalome.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAME/HXX2SALOME_GENERIC_CLASS_NAME_TEST.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAMEGUI/HXX2SALOME_GENERIC_CLASS_NAME_msg_fr.po
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/config_files/check_python.m4
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/py-compile
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/bin/runSalome.py
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/py-compile
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAMEGUI/HXX2SALOME_GENERIC_CLASS_NAME_msg_fr.po
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAME_I/HXX2SALOME_GENERIC_CLASS_NAME_TEST.py
src/wrappergen/src/parse3.awk
src/yacsloader/CMakeLists.txt
src/yacsloader/Test/CMakeLists.txt
src/yacsloader/Test/YacsLoaderTest.cxx
src/yacsloader/Test/algoasyncexample.py
src/yacsloader/Test/algosyncexample.py
src/yacsloader/Test/echoclt.py
src/yacsloader/Test/genPascal.py
src/yacsloader/Test/genTriangle.py
src/yacsloader/Test/optim_plugin.py
src/yacsloader/Test/waitContainers.py
src/yacsloader/Test/xmlrun_orig.sh
src/yacsloader/parserBase.cxx
src/yacsloader/pmml/CMakeLists.txt
src/yacsloader/samples/aschema.xml
src/yacsloader/samples/bid.xml
src/yacsloader/samples/bloc1.xml
src/yacsloader/samples/bloc2.xml
src/yacsloader/samples/bloc3.xml
src/yacsloader/samples/bloc4.xml
src/yacsloader/samples/bool1.xml
src/yacsloader/samples/cpp1.xml
src/yacsloader/samples/datanode0.xml
src/yacsloader/samples/double1.xml
src/yacsloader/samples/err0.xml
src/yacsloader/samples/err1.xml
src/yacsloader/samples/err2.xml
src/yacsloader/samples/err3.xml
src/yacsloader/samples/eschema.xml
src/yacsloader/samples/file1.xml
src/yacsloader/samples/foreach1.xml
src/yacsloader/samples/foreach2.xml
src/yacsloader/samples/foreach3.xml
src/yacsloader/samples/foreach4.xml
src/yacsloader/samples/foreach5.xml
src/yacsloader/samples/foreach6.xml
src/yacsloader/samples/foreach7.xml
src/yacsloader/samples/foreach_LongCorba.xml
src/yacsloader/samples/foreach_LongPython.xml
src/yacsloader/samples/foreach_init2fin.xml
src/yacsloader/samples/forloop1.xml
src/yacsloader/samples/forloop2.xml
src/yacsloader/samples/forloop3.xml
src/yacsloader/samples/forloop4.xml
src/yacsloader/samples/forloop5.xml
src/yacsloader/samples/forloop6.xml
src/yacsloader/samples/forloop7.xml
src/yacsloader/samples/forwhile1.xml
src/yacsloader/samples/fschema.xml
src/yacsloader/samples/gobj1.xml
src/yacsloader/samples/integer1.xml
src/yacsloader/samples/legendre7.xml
src/yacsloader/samples/objref1.xml
src/yacsloader/samples/objref2.xml
src/yacsloader/samples/optimizer1.xml
src/yacsloader/samples/optimizer2.xml
src/yacsloader/samples/optimizer_async_cpp.xml
src/yacsloader/samples/optimizer_async_py.xml
src/yacsloader/samples/optimizer_sync_cpp.xml
src/yacsloader/samples/optimizer_sync_py.xml
src/yacsloader/samples/pschema.xml
src/yacsloader/samples/pyremote1.xml
src/yacsloader/samples/pyremote2.xml
src/yacsloader/samples/pyremote3.xml
src/yacsloader/samples/pyremote4.xml
src/yacsloader/samples/refcnt1.xml
src/yacsloader/samples/schema2.xml
src/yacsloader/samples/schemaANN2.xml
src/yacsloader/samples/schemaANNLR2.xml
src/yacsloader/samples/schemaLR2.xml
src/yacsloader/samples/schemaPmmlDoesNotExist.xml
src/yacsloader/samples/sinline1.xml
src/yacsloader/samples/sinline2.xml
src/yacsloader/samples/sinline3.xml
src/yacsloader/samples/sinline4.xml
src/yacsloader/samples/sinline5.xml
src/yacsloader/samples/string1.xml
src/yacsloader/samples/struct1.xml
src/yacsloader/samples/study1.xml
src/yacsloader/samples/switch1.xml
src/yacsloader/samples/switch10.xml
src/yacsloader/samples/switch2.xml
src/yacsloader/samples/switch3.xml
src/yacsloader/samples/switch4.xml
src/yacsloader/samples/switch5.xml
src/yacsloader/samples/switch6.xml
src/yacsloader/samples/switch7.xml
src/yacsloader/samples/switch8.xml
src/yacsloader/samples/switch9.xml
src/yacsloader/samples/triangle5error.xml
src/yacsloader/samples/while1.xml
src/yacsloader/samples/while2.xml
src/yacsloader/samples/while3.xml
src/yacsloader_swig/CMakeLists.txt
src/yacsloader_swig/Test/optim_plugin.py
src/yacsloader_swig/Test/testEdit.py
src/yacsloader_swig/Test/testExec.py
src/yacsloader_swig/Test/testLoader.py
src/yacsloader_swig/Test/testRefcount.py
src/yacsloader_swig/Test/testResume.py
src/yacsloader_swig/Test/testSave.py
src/yacsloader_swig/Test/testSaveLoadRun.py
src/yacsorb/CORBAEngineTest.py
src/yacsorb/YACS.py
src/ydfx_gui/YDFXGUIHostParametrizer.cxx
src/ydfx_gui/YDFXGUIMain.hxx
src/ydfx_gui/YDFXGUIPortsSelector.cxx
src/ydfx_gui/YDFXGUIPushButtons.cxx
src/ydfx_gui/YDFXGUIPyThreadSaver.hxx
src/ydfx_gui/YDFXGUISeqInit.cxx
src/ydfx_gui/YDFXGUIWrap.cxx

index fa4fde57e145e7ce9402c4faa43a9e2a47ba9c53..b0c0c330eb2738172e4edd1cca9848b75d9a8b0a 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 data="""
 <methodCall>
@@ -31,14 +31,14 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print args
+  print(args)
   return 96785439
 
 f=open("input")
 data=f.read()
 f.close()
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
    call=eval(method)
@@ -46,11 +46,11 @@ try:
    response = (response,)
 except:
    # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+   response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+   response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
+print(response)
 f=open("output",'w')
 f.write(response)
 f.close()
index e4fafe57df91aca33b9cd0bc5c12a051ca0ff471..4d6cec781b6ea3ffdb65564160a819e2eb89e099 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Copyright (C) 2006-2016  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 
 """Doxygen XML to SWIG docstring converter.
 
-Usage:
-
-  doxy2swig.py [options] input.xml output.i
-
 Converts Doxygen generated XML files into a file containing docstrings
 that can be used by SWIG-1.3.x.  Note that you need to get SWIG
 version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
@@ -33,6 +29,8 @@ input.xml is your doxygen generated XML file and output.i is where the
 output will be written (the file will be clobbered).
 
 """
+
+__usage__ = "doxy2swig.py [options] input.xml output.i"
 ######################################################################
 #
 # This code is implemented using Mark Pilgrim's code as a guideline:
@@ -53,20 +51,20 @@ import textwrap
 import sys
 import types
 import os.path
-import optparse
+import argparse
 
 
 def my_open_read(source):
     if hasattr(source, "read"):
         return source
     else:
-        return open(source)
+        return open(source, encoding='utf8')
 
 def my_open_write(dest):
     if hasattr(dest, "write"):
         return dest
     else:
-        return open(dest, 'w')
+        return open(dest, 'w', encoding='utf8')
 
 
 class Doxy2SWIG:    
@@ -168,7 +166,7 @@ class Doxy2SWIG:
 
     def add_text(self, value):
         """Adds text corresponding to `value` into `self.pieces`."""
-        if type(value) in (types.ListType, types.TupleType):
+        if type(value) in (list, tuple):
             self.pieces.extend(value)
         else:
             self.pieces.append(value)
@@ -228,17 +226,17 @@ class Doxy2SWIG:
         kind = node.attributes['kind'].value
         if kind in ('class', 'struct'):
             prot = node.attributes['prot'].value
-            if prot <> 'public':
+            if prot != 'public':
                 return
             names = ('compoundname', 'briefdescription',
                      'detaileddescription', 'includes')
             first = self.get_specific_nodes(node, names)
             for n in names:
-                if first.has_key(n):
+                if n in first:
                     self.parse(first[n])
             self.add_text(['";','\n'])
             for n in node.childNodes:
-                if n not in first.values():
+                if n not in list(first.values()):
                     self.parse(n)
         elif kind in ('file', 'namespace'):
             nodes = node.getElementsByTagName('sectiondef')
@@ -251,7 +249,7 @@ class Doxy2SWIG:
 
     def do_parameterlist(self, node):
         text='unknown'
-        for key, val in node.attributes.items():
+        for key, val in list(node.attributes.items()):
             if key == 'kind':
                 if val == 'param': text = 'Parameters'
                 elif val == 'exception': text = 'Exceptions'
@@ -298,7 +296,7 @@ class Doxy2SWIG:
             if name[:8] == 'operator': # Don't handle operators yet.
                 return
 
-            if not first.has_key('definition') or \
+            if 'definition' not in first or \
                    kind in ['variable', 'typedef']:
                 return
 
@@ -326,7 +324,7 @@ class Doxy2SWIG:
                 self.add_text(' %s::%s "\n%s'%(cname, name, defn))
 
             for n in node.childNodes:
-                if n not in first.values():
+                if n not in list(first.values()):
                     self.parse(n)
             self.add_text(['";', '\n'])
         
@@ -390,7 +388,7 @@ class Doxy2SWIG:
             if not os.path.exists(fname):
                 fname = os.path.join(self.my_dir,  fname)
             if not self.quiet:
-                print "parsing file: %s"%fname
+                print("parsing file: %s"%fname)
             p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
             p.generate()
             self.pieces.extend(self.clean_pieces(p.pieces))
@@ -445,24 +443,23 @@ def convert(input, output, include_function_definition=True, quiet=False):
     p.write(output)
 
 def main():
-    usage = __doc__
-    parser = optparse.OptionParser(usage)
-    parser.add_option("-n", '--no-function-definition',
-                      action='store_true',
-                      default=False,
-                      dest='func_def',
-                      help='do not include doxygen function definitions')
-    parser.add_option("-q", '--quiet',
-                      action='store_true',
-                      default=False,
-                      dest='quiet',
-                      help='be quiet and minimise output')
+    parser = argparse.ArgumentParser(description=__doc__, usage = __usage__)
+    parser.add_argument("-n", '--no-function-definition',
+                        action='store_true',
+                        default=False,
+                        dest='func_def',
+                        help='do not include doxygen function definitions')
+    parser.add_argument("-q", '--quiet',
+                        action='store_true',
+                        default=False,
+                        dest='quiet',
+                        help='be quiet and minimise output')
+    parser.add_argument('input')
+    parser.add_argument('ouput')
     
-    options, args = parser.parse_args()
-    if len(args) != 2:
-        parser.error("error: no input and output specified")
+    args = parser.parse_args()
 
-    convert(args[0], args[1], not options.func_def, options.quiet)
+    convert(args.input, args.output, not options.func_def, options.quiet)
     
 
 if __name__ == '__main__':
diff --git a/NEWS b/NEWS
index f100d98cf40c3a025637ef5d88627788edf29182..5ecee04ee99bc79055ca9fb24ba89204f2ddafa3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -655,9 +655,9 @@ status--: OK
 description:
  --       Import test_schema.xml
  --       Select block node "bbb" => modify its parameters as: 
-          Â·  Delete "node4" from first line
-          Â·  Create new line by "+" pressing
-          Â·  Add "nnode0"
+          Ã‚·  Delete "node4" from first line
+          Ã‚·  Create new line by "+" pressing
+          Ã‚·  Add "nnode0"
  --       Press Apply button 
 Result: SIGSEGV
 comments: OCC: DONE
@@ -668,8 +668,8 @@ status--: OK
 description:
  --       Import test_schema_last.xml
  --       Select node "node1" => modify its parameters as: 
-          Â·  Change name
-          Â·  Assign new valyes to X and Y
+          Ã‚·  Change name
+          Ã‚·  Assign new valyes to X and Y
  --       Press Apply button 
  --       Select in 2D Viewer block node"Sb1", for which previous node belongs
 Result: SIGSEGV
diff --git a/README b/README
index 0d46d9b0e6fd4be695ac1e994d442e22c6701bba..c1d693dfc0b1feca13b55178026071bcb65f2569 100644 (file)
--- a/README
+++ b/README
@@ -4,26 +4,26 @@ YACS is for dYnamic pArallel Coupling System
 TODOlist, questions
 -------------------
 
-Les noms de noeuds devraient avoir une portée relative au bloc qui les contient,
-et pouvoir Ãªtre identifiés au sein d'une hiérarchie de bloc par un nom
-construit de la même façon que pour les ports:
+Les noms de noeuds devraient avoir une portée relative au bloc qui les contient,
+et pouvoir Ãªtre identifiés au sein d'une hiérarchie de bloc par un nom
+construit de la même façon que pour les ports:
 "bloc1.bloc2.noeud3"
 
-Dans quels cas faut-il créer des ports de données sur des noeuds composés ?
+Dans quels cas faut-il créer des ports de données sur des noeuds composés ?
 (Switch, boucle...).
-La création est elle faite automatiquement au niveau de l'engine ?
+La création est elle faite automatiquement au niveau de l'engine ?
 
-Fonction de vérification de la compétude d'un graphe Ã  l'édition:
-- tous les ports de donnée entrants doivent Ãªtre initialisés ou connectés.
-- inventaire des ports de donnée entrants non initialisés et non connectés.
-- faut-il vérifier quelque chose pour les gates ?
+Fonction de vérification de la compétude d'un graphe Ã  l'édition:
+- tous les ports de donnée entrants doivent Ãªtre initialisés ou connectés.
+- inventaire des ports de donnée entrants non initialisés et non connectés.
+- faut-il vérifier quelque chose pour les gates ?
 
-Regles d'ecriture C++ Ã  definir :
+Regles d'ecriture C++ Ã  definir :
  - pas de clause using namespace dans les .hxx
  - prefixer les attributs de classe par _
  - indentation style gnu
  - utilisation des namespace dans les cxx
-   - nom complets dans les declarations (identité avec .hxx pour doxygen)
+   - nom complets dans les declarations (identité avec .hxx pour doxygen)
 
 
 IMPROVEMENTS :
@@ -57,7 +57,7 @@ CHECKLIST:
 - test foreach4.xml problemes sporadiques (CC) sur conversions de doubles
 
 - ecriture graphe XML :
-  - ajout attribut _isComponentMethod initialisé a true pour noeuds SALOME
+  - ajout attribut _isComponentMethod initialisé a true pour noeuds SALOME
     est-ce utile ?
   - <node>/<component> dans bschema, cschema, dschema...
   - calcium*.xml
index 5d09877f2ed0447ff4e6c3115d2e59603f5649f9..1fe66b22561d8c71fbf886cee39faf7415bd4e16 100644 (file)
@@ -18,7 +18,7 @@ The protocol name appears in the first part of the type Repository ID (before th
 
 The Python protocol
 ++++++++++++++++++++++
-The Python protocol is based on serialisation done by the cPickle module (C implementation of the pickle module).  
+The Python protocol is based on serialisation done by the pickle module.  
 All that is necessary is to define an object reference type with the Python protocol so that Python objects 
 can be exchanged between Python inline nodes and with SALOME components implemented in Python.  
 SALOME components implemented in Python that are required to support this exchange type must be designed 
@@ -61,14 +61,14 @@ The implementation of component compo1 must handle serialisation / deserialisati
 way as the example in the run method described below::
 
   def run(self,s):
-    o=cPickle.loads(s)
+    o=pickle.loads(s)
     ret={'a':6, 'b':[1,2,3]}
-    return cPickle.dumps(ret,-1)
+    return pickle.dumps(ret,-1)
  
 The json protocol
 ++++++++++++++++++++++
 The json protocol is based on `JSON <http://www.json.org/>`_ (JavaScript Object Notation) 
-serialisation / deserialisation instead of cPickle. JSON supports fewer data types and requires that 
+serialisation / deserialisation instead of pickle. JSON supports fewer data types and requires that 
 the simplejson Python module should be installed, but it has the advantage that it is more interoperable.  
 In particular, there are C++ libraries that serialise/deserialise the JSON.
 
index c1a49596ec7076620a84b19c4dc1242c4be94f44..7decb00cd223206dd6c69af7fba75d5b089da038 100755 (executable)
@@ -10,8 +10,8 @@ for i in range(5):
 C = compo.compo()
     
 z = C.addvec(x, y)
-print 'x = ', x
-print 'y = ', y
-print 'z = ', z
-print C.prdscl(x,y)
+print('x = ', x)
+print('y = ', y)
+print('z = ', z)
+print(C.prdscl(x,y))
 
index 7ff59df58854c8edca49b941bf5d88931da4be2c..f916b07406d56024bb97ccd442b4b490caec5061 100755 (executable)
@@ -2,18 +2,18 @@ import systeme
 
 S = systeme.Systeme()
 
-print "create U1 ..."
+print("create U1 ...")
 S.touch('U1')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "copy U1 to U2 ..."
+print("copy U1 to U2 ...")
 S.cp('U1', 'U2')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "delete U1 ..."
+print("delete U1 ...")
 S.rm('U1')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "delete U2 ..."
+print("delete U2 ...")
 S.rm('U2')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
index ba2b9d971f68e07acf65488ca94815ab7a79142e..104617db24426557316954590a27f5881d697dc2 100755 (executable)
@@ -16,6 +16,6 @@ v1 = [ 1, 2, 3 ]
 v2 = [ 3, 4, 5 ]
 
 v3 = o.addvec(v1, v2)
-print v3
+print(v3)
 
-print o.prdscl(v1, v3)
+print(o.prdscl(v1, v3))
index a055fae4f527316245adc7261a2a40eb70bd3b4a..12be852518b06a94f07b4bb728407e9dd0adcbcd 100755 (executable)
@@ -65,12 +65,12 @@ $PYTHON -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules...'
+print('Byte-compiling python modules...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" || exit $?
@@ -80,12 +80,12 @@ $PYTHON -O -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules (optimised versions) ...'
+print('Byte-compiling python modules (optimised versions) ...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" 2>/dev/null || :
index b5608fe47129cf7868601101312bc982b1b2fb11..d2593adad2103ba3d0436e06f0fde69141ee3385 100644 (file)
@@ -41,9 +41,9 @@
 
 #define ROSENBROCK
 
-/* constante dépendant du choix de l'évaluateur */
+/* constante dépendant du choix de l'évaluateur */
 
-// nombre de paramètre
+// nombre de paramètre
 #ifdef GRIEWANK
 #define NBGENE   30
 #else
index e534b89ed86aca462f3c32f66cb98d99044d89e9..af9df8b3c2f84b578ab5675f109d7c374c624064 100644 (file)
@@ -31,6 +31,7 @@ ENDIF()
 INCLUDE_DIRECTORIES(
   ${PTHREAD_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
   ${PROJECT_BINARY_DIR}
index d31e8870f6b3027d607f89bf15d92fd4d62e080b..1ed0ee20fbd1265038e0e264325d7e58ee9d1a6f 100644 (file)
 #ifdef OMNIORB
 #include <omniORB4/CORBA.h>
 
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBPYAPI
-{
-  PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-           CORBA::Boolean hold_lock);
-  // Convert a C++ object reference to a Python object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-             CORBA::Boolean hold_lock);
-  // Convert a Python object reference to a C++ object reference.
-  // Raises BAD_PARAM if the Python object is not an object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-  // Sets the Python exception state to reflect the given C++ system
-  // exception. Always returns NULL. The caller must hold the Python
-  // interpreter lock.
-};
-
-omniORBPYAPI* api;
+#include <omniORBpy.h>
+omniORBpyAPI* api=0;
 
 #define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS \
 catch (const CORBA::SystemException& ex) { \
@@ -293,7 +274,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
 
   $result = PyList_New($1.size());
   for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
-    PyList_SetItem($result,i,PyString_FromString((*iL).c_str())); 
+    PyList_SetItem($result,i,PyUnicode_FromString((*iL).c_str())); 
 }
 
 %typemap(in) std::list<std::string>
@@ -308,8 +289,8 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
       for (i = 0; i < size; i++)
         {
           PyObject *o = PyList_GetItem($input,i);
-          if (PyString_Check(o))
-            $1.push_back(std::string(PyString_AsString(PyList_GetItem($input,i))));
+          if (PyUnicode_Check(o))
+            $1.push_back(std::string(PyUnicode_AsUTF8(PyList_GetItem($input,i))));
           else
             {
               PyErr_SetString(PyExc_TypeError,"list must contain strings");
@@ -333,11 +314,13 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
   void *ptr;
   if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0) == 0) 
     $1 = 1;
-  else if (PyInt_Check($input))
+  else if (PyLong_Check($input))
     $1 = 1;
   else if(PyFloat_Check($input))
     $1 = 1;
-  else if (PyString_Check($input))
+  else if (PyUnicode_Check($input))
+    $1 = 1;
+  else if (PyBytes_Check($input))
     $1 = 1;
   else 
     $1 = 0;
@@ -350,10 +333,10 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
       // It is an Any : it is converted by SWIG_ConvertPtr $input -> $1
       is_new_object=0;
     }
-  else if (PyInt_Check($input))
+  else if (PyLong_Check($input))
     {
       // It is an Int
-      $1=YACS::ENGINE::AtomAny::New((int)PyInt_AsLong($input));
+      $1=YACS::ENGINE::AtomAny::New((int)PyLong_AsLong($input));
       is_new_object=1;
     }
   else if(PyFloat_Check($input))
@@ -362,10 +345,16 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
       $1=YACS::ENGINE::AtomAny::New(PyFloat_AsDouble($input));
       is_new_object=1;
     }
-  else if(PyString_Check($input))
+  else if(PyUnicode_Check($input))
     {
-      // It is a Float
-      $1=YACS::ENGINE::AtomAny::New(PyString_AsString($input));
+      // It is a Unicode
+      $1=YACS::ENGINE::AtomAny::New(PyUnicode_AsUTF8($input));
+      is_new_object=1;
+    }
+  else if(PyBytes_Check($input))
+    {
+      // It is a Bytes
+      $1=YACS::ENGINE::AtomAny::New(PyBytes_AsString($input));
       is_new_object=1;
     }
   else
@@ -385,17 +374,22 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
   else if (PyInt_Check($1))
     {
       // It is an Int
-      $result=YACS::ENGINE::AtomAny::New((int)PyInt_AsLong($1));
+      $result=YACS::ENGINE::AtomAny::New((int)PyLong_AsLong($1));
     }
   else if(PyFloat_Check($1))
     {
       // It is a Float
       $result=YACS::ENGINE::AtomAny::New(PyFloat_AsDouble($1));
     }
-  else if(PyString_Check($1))
+  else if(PyUnicode_Check($1))
     {
-      // It is a String
-      $result=YACS::ENGINE::AtomAny::New(PyString_AsString($1));
+      // It is a Unicode
+      $result=YACS::ENGINE::AtomAny::New(PyUnicode_AsUTF8($1));
+    }
+  else if(PyBytes_Check($1))
+    {
+      // It is a Bytes
+      $result=YACS::ENGINE::AtomAny::New(PyBytes_AsString($1));
     }
   else
     {
@@ -842,11 +836,53 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
  To overload standard SWIG wrapping we define a full specialization of std::map
  with %extend for 4 basic methods : getitem, setitem, delitem and keys.
  Then we complete the interface by deriving the shadow wrapper from
- the python mixin class (UserDict.DictMixin).
+ the python mixin class (UserDict.DictMixin / collections.MutableMapping with Python 3).
  Do not forget to declare the new shadow class to SWIG with tname_swigregister(tname).
  Objects returned by __getitem__ are declared new (%newobject) so that when destroyed they
  call decrRef (see feature("unref") for RefCounter).
 */
+/*
+%inline %{
+template <typename U> class StopIterator {};
+template <typename U> class Iterator {
+  public:
+    Iterator(std::map<std::string,U*>::iterator _cur, std::map<std::string,U*>::iterator _end) : cur(_cur), end(_end) {}
+    Iterator* __iter__()
+    {
+      return this;
+    }
+    template <typename U> std::map<std::string,U*>::iterator cur;
+    template <typename U> std::map<std::string,U*>::iterator end;
+  };
+%}
+
+%include "exception.i"
+%exception Iterator::next {
+  try
+  {
+    $action  // calls %extend function next() below
+  }
+  catch (StopIterator)
+  {
+    PyErr_SetString(PyExc_StopIteration, "End of iterator");
+    return NULL;
+  }
+}
+
+%extend Iterator
+{
+  std::map<std::string,U*>& next()
+  {
+    if ($self->cur != $self->end)
+    {
+      // dereference the iterator and return reference to the object,
+      // after that it increments the iterator
+      return *$self->cur++;
+    }
+    throw StopIterator();
+  }
+}
+*/
 template<>
 class std::map<std::string,T*>
 {
@@ -891,10 +927,21 @@ public:
       PyObject* keyList = PyList_New(pysize);
       std::map<std::string, T* >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
-        PyList_SET_ITEM(keyList, j, PyString_FromString(i->first.c_str()));
+        PyList_SET_ITEM(keyList, j, PyUnicode_FromString(i->first.c_str()));
       }
       return keyList;
     }
+/*  Iterator __iter__()
+  {
+    // return a constructed Iterator object
+    return Iterator($self->begin(), $self->end());
+  }
+*/
+  int __len__()
+  {
+      int pysize = self->size();
+      return pysize;
+  }
 }
 };
 
@@ -902,8 +949,8 @@ public:
 %template()   std::pair<std::string, T* >;
 %template(tname)    std::map<std::string, T* >;
 %pythoncode{
-from UserDict import DictMixin
-class tname(tname,DictMixin):pass
+from collections import MutableMapping    
+class tname(tname,MutableMapping):pass
 tname##_swigregister(tname)
 }
 %enddef
index 98a7296db3b0330b204bd02fc2a3b40e79146ec2..d760c97d7609b6f63a02a9c44a04c7d42eeb903b 100644 (file)
@@ -72,10 +72,10 @@ using namespace YACS::ENGINE;
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 #endif
 %}
@@ -241,13 +241,50 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
 %include <Port.hxx>
 %extend YACS::ENGINE::Port
 {
-  int __cmp__(Port* other)
+  /* __cmp__ does not exist in Python 3 */
+  int  __lt__(Port* other)
     {
       if(self==other)
         return 0;
       else 
         return 1;
     }
+  int  __gt__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ne__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __eq__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __le__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ge__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  
   long ptr()
     {
       return (long)self;
@@ -308,13 +345,50 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
 %include <Node.hxx>
 %extend YACS::ENGINE::Node 
 {
-  int __cmp__(Node* other)
+  /* __cmp__ does not exist in Python 3 */
+  int  __lt__(Node* other)
     {
       if(self==other)
         return 0;
       else 
         return 1;
     }
+  int  __gt__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ne__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __eq__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __le__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ge__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+
   long ptr()
     {
           return (long)self;
@@ -425,7 +499,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     // param 0
     PyObject *ret0Py(PyList_New(ret0.size()));
     for(std::size_t i=0;i<ret0.size();i++)
-      PyList_SetItem(ret0Py,i,PyInt_FromLong(ret0[i]));
+      PyList_SetItem(ret0Py,i,PyLong_FromLong(ret0[i]));
     PyTuple_SetItem(ret,0,ret0Py);
     // param 1
     PyObject *ret1Py(PyList_New(ret1.size()));
@@ -435,7 +509,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     // param 2
     PyObject *ret2Py(PyList_New(ret2.size()));
     for(std::size_t i=0;i<ret2.size();i++)
-      PyList_SetItem(ret2Py,i,PyString_FromString(ret2[i].c_str()));
+      PyList_SetItem(ret2Py,i,PyBytes_FromString(ret2[i].c_str()));
     PyTuple_SetItem(ret,2,ret2Py);
     return ret;
   }
index 04e1584b0ddc119bb5e58a49c389f021e84e8843..8038d42f758a5366e3c944e5096ccbb7500d7ee6 100644 (file)
@@ -87,10 +87,10 @@ namespace YACS
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 #endif
 %}
index 98494643803a5439851265512f9953ac1e3e97e2..f46fd014d74c364beb0f4912e8703b5809880437 100644 (file)
@@ -40,6 +40,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index 9dce3ae6bf09767f9dd4b6e982dcfc1d358d900c..efe93a9c92cc323b7a5c337137911c64fba17f41 100644 (file)
@@ -149,8 +149,8 @@ YACSEvalAny *YACSEvalInputPort::getDefaultValueDefined() const
         throw YACS::Exception("YACSEvalInputPort::getDefaultValueDefined : internal error !");
       if(PyFloat_Check(data))
         return new YACSEvalAnyDouble(PyFloat_AsDouble(data));
-      if(PyInt_Check(data))
-        return new YACSEvalAnyInt((int)PyInt_AsLong(data));
+      if(PyLong_Check(data))
+        return new YACSEvalAnyInt((int)PyLong_AsLong(data));
       throw YACS::Exception("YACSEvalInputPort::getDefaultValueDefined : unmanaged types different from int and double for py !");
     }
   YACS::ENGINE::AnyInputPort *i1(dynamic_cast<YACS::ENGINE::AnyInputPort *>(_ptr));
@@ -220,7 +220,7 @@ void YACSEvalInputPort::setDefaultValue(const YACSEvalAny *parameter)
             }
           else if(par1)
             {
-              PyObject *obj(PyInt_FromLong(par1->toInt()));
+              PyObject *obj(PyLong_FromLong(par1->toInt()));
               i0->put(obj);
               Py_XDECREF(obj);
             }
index 0a6f9208bbb72d80d7b776f20d2d296da38dc27b..e0d0e647d77b55b9043a1e94da06079b87e79c4a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2016  CEA/DEN, EDF R&D
+  // Copyright (C) 2012-2016  CEA/DEN, 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
@@ -112,7 +112,7 @@ void YACSEvalSeqAnyInt::initialize(YACS::ENGINE::InputPyPort *p) const
   PyObject *ob(PyList_New(sz));
   for(std::size_t i=0;i<sz;i++)
     {
-      PyList_SetItem(ob,i,PyInt_FromLong((*_arr)[i]));
+      PyList_SetItem(ob,i,PyLong_FromLong((*_arr)[i]));
     }
   p->put(ob);
   p->exSaveInit();
index d08aa9c49db0d7846cfd9ce12a87a721468b7ce4..e8039658e6e0b20036abbc86577b5842ec8f4cab 100644 (file)
@@ -67,7 +67,7 @@ void YACSEvalSession::launch()
   _salomeInstance=PyObject_Call(startMeth,myArgs,myKWArgs);//new
   YACS::ENGINE::AutoPyRef getPortMeth(PyObject_GetAttrString(_salomeInstance,const_cast<char *>("get_port")));//new
   YACS::ENGINE::AutoPyRef portPy(PyObject_CallObject(getPortMeth,0));//new
-  _port=PyInt_AsLong(portPy);
+  _port=PyLong_AsLong(portPy);
   //
   int dummy;
   _corbaConfigFileName=GetConfigAndPort(dummy);
@@ -114,7 +114,7 @@ std::string YACSEvalSession::GetPathToAdd()
   PyObject *kernelRootDir(0);// os.environ["KERNEL_ROOT_DIR"]
   {
     YACS::ENGINE::AutoPyRef environPy(PyObject_GetAttrString(osPy,const_cast<char *>("environ")));//new
-    YACS::ENGINE::AutoPyRef kernelRootDirStr(PyString_FromString(const_cast<char *>(KERNEL_ROOT_DIR)));//new
+    YACS::ENGINE::AutoPyRef kernelRootDirStr(PyBytes_FromString(const_cast<char *>(KERNEL_ROOT_DIR)));//new
     kernelRootDir=PyObject_GetItem(environPy,kernelRootDirStr);//new
   }
   {
@@ -122,11 +122,11 @@ std::string YACSEvalSession::GetPathToAdd()
     YACS::ENGINE::AutoPyRef joinPy(PyObject_GetAttrString(pathPy,const_cast<char *>("join")));//new
     YACS::ENGINE::AutoPyRef myArgs(PyTuple_New(4));
     Py_XINCREF(kernelRootDir); PyTuple_SetItem(myArgs,0,kernelRootDir);
-    PyTuple_SetItem(myArgs,1,PyString_FromString(const_cast<char *>("bin")));
-    PyTuple_SetItem(myArgs,2,PyString_FromString(const_cast<char *>("salome")));
-    PyTuple_SetItem(myArgs,3,PyString_FromString(const_cast<char *>("appliskel")));
+    PyTuple_SetItem(myArgs,1,PyBytes_FromString(const_cast<char *>("bin")));
+    PyTuple_SetItem(myArgs,2,PyBytes_FromString(const_cast<char *>("salome")));
+    PyTuple_SetItem(myArgs,3,PyBytes_FromString(const_cast<char *>("appliskel")));
     YACS::ENGINE::AutoPyRef res(PyObject_CallObject(joinPy,myArgs));
-    ret=PyString_AsString(res);
+    ret=PyBytes_AsString(res);
   }
   Py_XDECREF(kernelRootDir);
   return ret;
@@ -137,13 +137,13 @@ std::string YACSEvalSession::GetConfigAndPort(int& port)
   YACS::ENGINE::AutoPyRef osPy(PyImport_ImportModule(const_cast<char *>("os")));//new
   YACS::ENGINE::AutoPyRef environPy(PyObject_GetAttrString(osPy,const_cast<char *>("environ")));//new
   //
-  YACS::ENGINE::AutoPyRef corbaConfigStr(PyString_FromString(const_cast<char *>(CORBA_CONFIG_ENV_VAR_NAME)));//new
+  YACS::ENGINE::AutoPyRef corbaConfigStr(PyBytes_FromString(const_cast<char *>(CORBA_CONFIG_ENV_VAR_NAME)));//new
   YACS::ENGINE::AutoPyRef corbaConfigFileNamePy(PyObject_GetItem(environPy,corbaConfigStr));//new
-  std::string ret(PyString_AsString(corbaConfigFileNamePy));
+  std::string ret(PyBytes_AsString(corbaConfigFileNamePy));
   //
-  YACS::ENGINE::AutoPyRef nsPortStr(PyString_FromString(const_cast<char *>(NSPORT_VAR_NAME)));//new
+  YACS::ENGINE::AutoPyRef nsPortStr(PyBytes_FromString(const_cast<char *>(NSPORT_VAR_NAME)));//new
   YACS::ENGINE::AutoPyRef nsPortValuePy(PyObject_GetItem(environPy,nsPortStr));//new
-  std::string portStr(PyString_AsString(nsPortValuePy));
+  std::string portStr(PyBytes_AsString(nsPortValuePy));
   std::istringstream iss(portStr);
   iss >> port;
   return ret;
index d5bf80b158e71430e136addc208ffe6b301ffa0b..09a1971c20ef14ea885e22ff6bd91e39ad8a4b33 100644 (file)
@@ -48,7 +48,7 @@ Engines::SalomeLauncher_var YACSEvalSession::YACSEvalSessionInternal::goFetching
   const char fetchPyCmd[]="import salome,CORBA\nsalome.salome_init()\nsl=salome.naming_service.Resolve(\"/SalomeLauncher\")\nif not CORBA.is_nil(sl):\n  return salome.orb.object_to_string(sl)\nelse:\n  raise Exception(\"Impossible to locate salome launcher !\")";
   YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(methName,fetchPyCmd));
   YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
-  std::string ior(PyString_AsString(val));
+  std::string ior(PyBytes_AsString(val));
   CORBA::Object_var obj(string_to_object(ior));
   if(CORBA::is_nil(obj))
     throw YACS::Exception("goFetchingSalomeLauncherInNS : fetched ior is NIL !");
index 43b6b6b9dd49c191142eac4e83c00f1a64ba3781..d8128ebed816755502860db4c250c3640d875748 100644 (file)
@@ -261,7 +261,7 @@ YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueInPort(YACS::ENGINE::InputPyPort *
       for(std::size_t i=0;i<sz;i++)
         {
           PyObject *elt(PyList_GetItem(obj,i));
-          eltCpp[i]=PyInt_AsLong(elt);
+          eltCpp[i]=PyLong_AsLong(elt);
         }
       YACS::AutoCppPtr<YACSEvalSeqAnyInt> elt(new YACSEvalSeqAnyInt(eltCpp));
       return elt.dettach();
@@ -869,10 +869,10 @@ void YACSEvalYFXGraphGenCluster::generateGraph()
   //
   YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent));
   YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
-  _locSchemaFile=PyString_AsString(val);
+  _locSchemaFile=PyBytes_AsString(val);
   func=YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent2);
   val=YACS::ENGINE::evalFuncPyWithNoParams(func);
-  _jobName=PyString_AsString(val);
+  _jobName=PyBytes_AsString(val);
   //
   static const char LISTPYOBJ_STR[]="list[pyobj]";
   if(getBoss()->getOutputsOfInterest().empty())
index 3d7693171b2a93cdcf1e2bacc1c3afddb4af1b36..3fd0568796b7c730b565f92d33a13077230aae97 100644 (file)
@@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader_swig
   ${PROJECT_SOURCE_DIR}/src/evalyfx
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )
 
index a530309024bf07f221f3e2944c88f69c28260240..6796ada923dc5815e2b5da6d8dbfaa1c822e871c 100644 (file)
@@ -46,7 +46,7 @@ static void convertPyToIntArr(PyObject *pyLi, std::vector<int>& arr)
           PyObject *o=PyList_GetItem(pyLi,i);
           if(PyInt_Check(o))
             {
-              int val=(int)PyInt_AS_LONG(o);
+              int val=(int)PyLong_AS_LONG(o);
               arr[i]=val;
             }
           else
@@ -60,9 +60,9 @@ static void convertPyToIntArr(PyObject *pyLi, std::vector<int>& arr)
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
-          if(PyInt_Check(o))
+          if(PyLong_Check(o))
             {
-              int val=(int)PyInt_AS_LONG(o);
+              int val=(int)PyLong_AS_LONG(o);
               arr[i]=val;
             }
           else
@@ -80,7 +80,7 @@ static PyObject *convertToPyToInt(const std::vector<unsigned int>& arr)
   std::size_t sz(arr.size());
   PyObject *ret(PyList_New(sz));
   for(std::size_t i=0;i<sz;i++)
-    PyList_SetItem(ret,i,PyInt_FromLong(arr[i]));
+    PyList_SetItem(ret,i,PyLong_FromLong(arr[i]));
   return ret;
 }
 
@@ -148,7 +148,7 @@ static PyObject *convertVectOfSeqAny(const std::vector<YACSEvalSeqAny *>& retCpp
           std::size_t sz2(zeArr->size());
           PyObject *ret2(PyList_New(sz2));
           for(std::size_t i2=0;i2<sz2;i2++)
-            PyList_SetItem(ret2,i2,PyInt_FromLong((*zeArr)[i2]));
+            PyList_SetItem(ret2,i2,PyLong_FromLong((*zeArr)[i2]));
           PyList_SetItem(ret,i,ret2);
         }
       else
@@ -249,7 +249,7 @@ public:
            }
          else if(PyInt_Check(parameter))
            {
-             YACSEvalAnyInt tmp((int)PyInt_AsLong(parameter));
+             YACSEvalAnyInt tmp((int)PyLong_AsLong(parameter));
              self->setDefaultValue(&tmp);
            }
          else
@@ -507,7 +507,7 @@ public:
          PyObject *ret0Py(ret0?Py_True:Py_False);
          Py_XINCREF(ret0Py);
          PyTuple_SetItem(ret,0,ret0Py);
-         PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
+         PyTuple_SetItem(ret,1,PyLong_FromLong(ret1));
          return ret;
        }
      }
index 9fd10cc45564e6cd715831476d45ef94e5a7922f..4bb752016ebe6442de7593a2a28c66f09e658529 100644 (file)
@@ -68,5 +68,5 @@ cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch"
 cp.setWCKey("P11U50:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05")
 assert(not rss.isInteractive())
 a,b=efx.run(session)
-print("************",a,b)
-print efx.getResults()
+print(("************",a,b))
+print(efx.getResults())
index 3525093bc0a186649cbc5b84aee82a565c306d5e..f9e4e3ce495463226a1a384004464a0ec3e1d0f1 100644 (file)
@@ -25,6 +25,7 @@ INCLUDE(UseQtExt)
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${GRAPHVIZ_INCLUDE_DIRS}
   ${QT_INCLUDES}
index f5f33b74d591673b45aa174d4bdc12e1b6c79d99..df2a1d314a08a56ef17882958cf505ce6d265ad6 100644 (file)
@@ -179,6 +179,6 @@ void FormContainerDecorator::checkAndRepareTypeIfNecessary(YACS::ENGINE::Contain
 void FormContainerDecorator::connectForTyp()
 {
   connect(_typ->cb_resource,SIGNAL(mousePressed()),this,SLOT(onResMousePressed()));
-  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated));
-  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled()));
+  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated(int)));
+  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled(bool)));
 }
index 41c36c1dd0f0bd55e743be7c96da6ee40dbef99a..010589813abbee16a92b25c9cc5e3cc72b1fb981 100644 (file)
@@ -72,7 +72,7 @@
          </widget>
         </item>
         <item>
-         <widget class="QComboBox" name="cb_resource">
+         <widget class="ComboBox" name="cb_resource">
           <property name="toolTip">
            <string>name of the resource hosting container when manually set</string>
           </property>
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ComboBox</class>
+   <extends>QComboBox</extends>
+   <header>FormComponent.hxx</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
index fa6299c06e37324130007e357ce4e0166e99c143..8ce983ddcb5b147ba8541f67da297b8af87f4161 100644 (file)
@@ -20,8 +20,8 @@
 #include <iostream>
 #include <fstream>
 
-#include "ListJobs_GUI.hxx"
 #include "RuntimeSALOME.hxx"
+#include "ListJobs_GUI.hxx"
 #include "GenericGui.hxx"
 #include "QtGuiContext.hxx"
 #include "YACSGuiLoader.hxx"
index d4568dec008e4cf001809f36700ff796c8a5ba79..3c8e4d41244de8adc29defef45b6bf2cfde0c99f 100644 (file)
@@ -482,7 +482,7 @@ bool SceneComposedNodeItem::hasExpandedChildren(bool recursively)
 
 void SceneComposedNodeItem::shrinkExpandRecursive(bool toExpand, bool fromHere, ShrinkMode theShrinkMode)
 {
-  DEBTRACE("SceneComposedNodeItem::shrinkExpandRecursive " << isExpanding << " " << fromHere << " " << isExpanded() << " " << _label.toStdString());
+  DEBTRACE("SceneComposedNodeItem::shrinkExpandRecursive " << toExpand << " " << fromHere << " " << isExpanded() << " " << _label.toStdString());
   
   bool toChangeShrinkState = false;
   switch (theShrinkMode) {
index 355a11a96d3c1dbed5b703594f3573f34f9fb2b5..1afaf3091ab038f462b065b1fa073c173596af2a 100644 (file)
@@ -23,12 +23,12 @@ x creation de liens  a la souris dans scene et arbre en drag and drop
 x sauvegarde schema en edition
 x import catalogues depuis schemas
 x insertion dans SALOME 5
-x boutons-actions zoom, panning, cadre zone Ã  voir, reset vue, fit all
+x boutons-actions zoom, panning, cadre zone Ã  voir, reset vue, fit all
 x proc remplit automatiquement toute la vue principale (bouton fit all)
 x bouton save ou save as au lieu de export
 x Model/view table (ports)
 x affichage etat en edition
-x dessins des liens de contrôle
+x dessins des liens de contrôle
 x gestion etude SALOME : object browser
 x design arbre (edition/execution)
 x contournement bug confirmOverwrite QFileDialog Qt 4.3.3 (corrige en 4.3.5)
@@ -84,7 +84,7 @@ x couleur differente des liens datastream
 
 - drag & drop de ports pour l'ordre dans le tableau, dans la scene
 - creation de liens par menu
-x distinguer les liens simples (sans contrôle)
+x distinguer les liens simples (sans contrôle)
 - deplacement de noeud a la souris: pouvoir passer par dessus un bloc
   (pressed + touche...) transparence, finir le deplacement que s'il y a
   la place, ou pousser le bloc ?
@@ -106,7 +106,7 @@ x distinguer les liens simples (sans contr
   - choix d'un port dans le panneau noeud -> arbre, vue
   - selection multiples (arbre, tableau vue) pour action groupee
     (deplacement scene, destruction...)
-- connexion automatique de ports avec des noeuds bord Ã  bord
+- connexion automatique de ports avec des noeuds bord Ã  bord
   (regle de correspondance de noms ? respect de l'ordre ?)
 - dessiner les liens avec des ponts quand des liens se croisent !
 - 2eme vue avec schema complet et cadre de la vue principale
@@ -175,7 +175,7 @@ x passage en execution: arbre pas toujours cree la premiere fois
 x message incomprehensible lors de l'ajout d'un deuxieme noeud dans un forloop
 x libelle comboBox ajout de ports dans panneau edition: folklorique (newSchema_1)
 x fermeture schema non sauvegarde : dialogues de sauvegarde
-x lien nouvellement créé droit et très fin, pas toujours visible
+x lien nouvellement créé droit et très fin, pas toujours visible
 x panneau edition function Node: controler nom de fonction saisie (validation)
 x panneau edition function Node: remonter le nom de fonction
 x remontee d'erreur en edition: le contenu de la log proc ne change pas, quand c'est en erreur
@@ -214,9 +214,9 @@ x destruction d'un lien, impact sur la disposition des noeuds
   dernier selectionne, idem pour la selection dans l'arbre
   (avec correction SchemaItem 1.8)
   lie au clearAndSelect dans SchemaItem::select (correction SchemaItem 1.8)
-- selection rubrique containers ou types: précédente selection reste dans canvas et edition
-- destruction component instance : mal repercuté (arbres, map proc...)
-- caractères accentues dans script python d'un noeud python, fichier xml mal chargé
+- selection rubrique containers ou types: précédente selection reste dans canvas et edition
+- destruction component instance : mal repercuté (arbres, map proc...)
+- caractères accentues dans script python d'un noeud python, fichier xml mal chargé
 
 - fermeture vue SALOME, object Browser pas mis a jour mais schema detruit...
 
@@ -289,20 +289,20 @@ Modes de representation du noeud
 
 - noeud elementaire
   -----------------
-  - developpé, edition   : entete + ports avec nom (valeurs = tooltip ou panneau)
+  - developpé, edition   : entete + ports avec nom (valeurs = tooltip ou panneau)
   - reduit, edition      : entete + ports sans nom
   - collapsed, edition   : entete seul (que les control link ?)
   memes vues en execution (faut il des valeurs sur les ports ?)
 
-- noeud composé
+- noeud composé
   -------------
-  - developpé, edition   : tout les internes de premier niveau visibles,
+  - developpé, edition   : tout les internes de premier niveau visibles,
                            au moins sous forme reduite
-  - macro noeud, edition : un seul macro noeud, presentation du noeud Ã©lémentaire developpé
-                           certains ports internes cachés
-                           (enrichir description IHM avec notion port privé ? ) 
-  - reduit, edition      : un seul macro noeud, presentation du noeud Ã©lémentaire réduit
-  - collapsed, Ã©dition   : entete seul
+  - macro noeud, edition : un seul macro noeud, presentation du noeud Ã©lémentaire developpé
+                           certains ports internes cachés
+                           (enrichir description IHM avec notion port privé ? ) 
+  - reduit, edition      : un seul macro noeud, presentation du noeud Ã©lémentaire réduit
+  - collapsed, Ã©dition   : entete seul
   memes vues en execution 
 
 
@@ -316,4 +316,4 @@ puis print python.
 on peut ajouter 2 methodes dans le DataFlowPort :
  recup valeur      : string fetch()
  chargement valeur : void load(string)
-à dériver dans les ports any, python, corba
+à dériver dans les ports any, python, corba
index adb7187835f9dd3a0ccc55109ee52f0150e2f03e..5d9c12206b4f355b416220356bfd7955635d01e7 100644 (file)
@@ -27,6 +27,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
index e1414cfd11e64913b1d3dd46db6c23d1b39f2ab6..8e160166ef708f08d6598c88f860367b9d28c90c 100644 (file)
@@ -197,11 +197,11 @@ void Subject::select(bool isSelected)
 
 void Subject::update(GuiEvent event,int type, Subject* son)
 {
-  //DEBTRACE("Subject::update " << type << "," << GuiObserver::eventName(event) << "," << son);
+    std::cerr << "Subject::update " << type << "," << GuiObserver::eventName(event) << "," << son << std::endl;
   set<GuiObserver*> copySet = _setObs;
   for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
     {
-      //DEBTRACE("Subject::update " << *it);
+        std::cerr << "Subject::update " << *it << std::endl;
       try
         {
           (*it)->update(event, type, son);
@@ -209,11 +209,13 @@ void Subject::update(GuiEvent event,int type, Subject* son)
       catch(Exception& ex)
         {
           std::cerr << "Internal error in Subject::update: " << ex.what() << std::endl;
+          std::cerr << "ERREUR ICI" << std::endl;
         }
-      catch(...)
-        {
-          std::cerr << "Internal error in Subject::update: " << std::endl;
-        }
+      //catch(...)
+      //  {
+      //    std::cerr << "Internal error in Subject::update: " << std::endl;
+      //    std::cerr << "ERREUR OU LA " << std::endl;
+      //  }
     }
 }
 
index d82c3142b17e4e4c21d47def60a86bdf7a127ffa..b3bcc60159b36943f329696a59175bd917f9a15a 100755 (executable)
@@ -23,8 +23,6 @@ from PMML import PMMLlib, kANN, kLR
 
 # imports python
 import unittest
-import exceptions
-from exceptions import RuntimeError
 import os
 import shutil
 
@@ -36,7 +34,7 @@ class PMMLBasicsTest(unittest.TestCase):
         self.tmpDir += "PmmlUnitTest";
         self.tmpDir += os.sep ;
         if ( not os.path.exists(self.tmpDir) ):
-            os.mkdir(self.tmpDir);
+            os.makedirs(self.tmpDir);
             pass
         pass
 
@@ -51,13 +49,15 @@ class PMMLBasicsTest(unittest.TestCase):
         model = "sANNName";
         exportPyScript = self.tmpDir + "swigTestExportPythonNeuralNet.py";
         refPyFilename = self.resourcesDir + "unittest_ref_ann_model.py";
-        refLines = file(refPyFilename).readlines(); 
+        with open(refPyFilename,"r") as f:
+            refLines = f.readlines(); 
         #
         p = PMMLlib( pmmlFile );
         p.SetCurrentModel( model, kANN );
         p.ExportPython( exportPyScript, "myTestFunc", 
                         "File used by unit test\n PMMLBasicsTest1::testExportNeuralNetworkPython" );
-        myLines = file(exportPyScript).readlines();
+        with open(exportPyScript,"r") as f:
+            myLines = f.readlines();
         self.assertEqual( len(myLines), len(refLines) );
         for (i,line) in enumerate(myLines):
             self.assertEqual( line, refLines[i] );
@@ -69,13 +69,15 @@ class PMMLBasicsTest(unittest.TestCase):
         model = "Modeler[LinearRegression]Tds[steamplant]Predictor[x6:x8:x6x8:x6x6x8]Target[x1]";
         exportPyScript = self.tmpDir + "swigTestExportPythonRegression.py";
         refPyFilename = self.resourcesDir + "unittest_ref_lr_model.py";
-        refLines = file(refPyFilename).readlines(); 
+        with open(refPyFilename,"r") as f:
+            refLines = f.readlines(); 
         #
         p = PMMLlib( pmmlFile );
         p.SetCurrentModel( model, kLR );
         p.ExportPython( exportPyScript, "myTestFunc", 
                                "File used by unit test\n PMMLBasicsTest1::testExportLinearRegressionPython" );
-        myLines = file(exportPyScript).readlines();
+        with open(exportPyScript,"r") as f:
+            myLines = f.readlines();
         self.assertEqual( len(myLines), len(refLines) );
         for (i,line) in enumerate(myLines):
             self.assertEqual( line, refLines[i] );
index 836d6ab56e661f56ff56d857d3cd01ae03f13ee2..7e440e27202c3c322763c82d1143e7ab874adda2 100755 (executable)
@@ -31,7 +31,7 @@ if not os.path.exists(os.path.join(dirALaCon0,dirAlaCon1)):
     os.chdir("..")
 # GO !
 dn=os.path.dirname(__file__)
-p=subprocess.Popen(["python","PMMLBasicsTest.py"],cwd=dn,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+p=subprocess.Popen(["python3","PMMLBasicsTest.py"],cwd=dn,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
 a,b=p.communicate()
 ret=p.returncode
 # Clean up the wonderful first part stuf
index 8e32b7c4eeb26f7033853e3139c79d9f196f9de7..e6eb48a0e8a2ea11fbb881fa1b33dfe88176b72b 100644 (file)
@@ -19,6 +19,7 @@
 
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${SALOME_INCL_PATH}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index 1ba389d23b18e777beec3e4e1b1048f261bd1049..3c42da566b5d062a5586edbd994bae8e3bc2def1 100644 (file)
@@ -61,6 +61,10 @@ void verifyCorrectPycode(const char * code_py, const char * function_name,
   {
     CPPUNIT_FAIL(e.what());
   }
+  catch(std::exception& e)
+  {
+    CPPUNIT_FAIL(e.what());
+  }
   catch(...)
   {
     CPPUNIT_FAIL("Unknown exception");
@@ -102,6 +106,10 @@ void verifyWrongPycode(const char* code_py, const char* function_name,
     std::cerr << "===============================================" << std::endl;
     CPPUNIT_ASSERT(what.find(error_message) != std::string::npos);
   }
+  catch(std::exception& e)
+  {
+    CPPUNIT_FAIL(e.what());
+  }
 }
 
 static
@@ -125,6 +133,10 @@ void verifyWrongParser(const char* parser_module, const char* parser_function,
     std::cerr << "===============================================" << std::endl;
     CPPUNIT_ASSERT(what.find(error_message) != std::string::npos);
   }
+  catch(std::exception& e)
+  {
+    CPPUNIT_FAIL(e.what());
+  }
 }
 
 void Py2yacsTest::t1()
@@ -152,9 +164,9 @@ void Py2yacsTest::t2()
 void Py2yacsTest::t3()
 {
   const char * code_py = "def f1(a, b, c):\n"
-                         "  print a\n"
-                         "  print b\n"
-                         "  print c\n";
+                         "  print(a)\n"
+                         "  print(b)\n"
+                         "  print(c)\n";
   const char* input_ports[] = {"a", "b", "c"};
   const char** output_ports;
   verifyCorrectPycode(code_py, "f1", 3, input_ports, 0, output_ports);
@@ -163,7 +175,7 @@ void Py2yacsTest::t3()
 void Py2yacsTest::t4()
 {
   const char * code_py = "def f1():\n"
-                         "  print 'toto'\n"
+                         "  print('toto')\n"
                          "  return\n";
   const char* input_ports[] = {"a", "b", "c"};
   const char** output_ports;
@@ -213,7 +225,7 @@ void Py2yacsTest::unaccepted_statement2()
   const char * code_py = "def f(a):\n"
                          "  return a\n"
                          "if __name__ == '__main__':"
-                         "  print 'toto'\n";
+                         "  print('toto')\n";
   verifyWrongPycode(code_py, "f", "not accepted statement");
 }
 
@@ -237,7 +249,7 @@ void Py2yacsTest::syntaxError()
 {
   const char * code_py = "bla bla bla\n"
                          "  return f1(x)\n";
-  verifyWrongPycode(code_py, "f2", "SyntaxError");
+  verifyWrongPycode(code_py, "f2", "invalid syntax");
 }
 
 void Py2yacsTest::badFunctionName()
@@ -291,19 +303,19 @@ void Py2yacsTest::schemaExec()
 // Test the behaviour when there is an error in the python parser
 void Py2yacsTest::parserErrors()
 {
-  verifyWrongParser("bad_parsers", "p1", "argument");
-  verifyWrongParser("bad_parsers", "p2", "Attribute 'name' not found");
+  verifyWrongParser("bad_parsers", "p1", "0 positional arguments");
+  verifyWrongParser("bad_parsers", "p2", "'str' object has no attribute 'name'");
   verifyWrongParser("bad_parsers", "p3", "should be a python list");
-  verifyWrongParser("bad_parsers", "p4", "Traceback");
+  verifyWrongParser("bad_parsers", "p4", "unsupported operand type");
   verifyWrongParser("bad_parsers", "f", "Cannot find the parsing function");
   verifyWrongParser("err_py2yacs_invalid", "get_properties", "invalid syntax");
   verifyWrongParser("no_file", "f", "Failed to load");
-  verifyWrongParser("bad_parsers", "p5", " ");
-  verifyWrongParser("bad_parsers", "p6", " ");
-  verifyWrongParser("bad_parsers", "p7", " ");
+  verifyWrongParser("bad_parsers", "p5", "is not a string");
+  verifyWrongParser("bad_parsers", "p6", "is not a string");
+  verifyWrongParser("bad_parsers", "p7", "is not a string");
   verifyWrongParser("bad_parsers", "p8", "Attribute 'name' should be a string.");
-  verifyWrongParser("bad_parsers", "p9", " ");
-  verifyWrongParser("bad_parsers", "p10", " ");
+  verifyWrongParser("bad_parsers", "p9", "Not a python list");
+  verifyWrongParser("bad_parsers", "p10", "is not a string");
 }
 
 void Py2yacsTest::globalVerification()
@@ -341,4 +353,4 @@ void Py2yacsTest::globalVerification()
     std::cerr << "-----------------------------------------" << std::endl;
   }
 
-}
\ No newline at end of file
+}
index 2ad047d4e31f0898a8c63e7313eb37ce57184f9f..fcd711ced91368389fe01e56048086aba85c681b 100644 (file)
@@ -74,7 +74,7 @@ const std::list<FunctionProperties>& Py2yacs::getFunctionProperties()const
 static
 std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
 {
-  std::string error;
+  std::string error="";
   if(!PyList_Check(pyList))
   {
     error = "Not a python list.\n";
@@ -82,11 +82,11 @@ std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
   }
   else
   {
-    int n = PyList_Size(pyList);
-    for(int i=0; i<n; i++)
+    Py_ssize_t n = PyList_Size(pyList);
+    for(Py_ssize_t i=0; i<n; i++)
     {
       PyObject *elem = PyList_GetItem(pyList,i);
-      if(!PyString_Check(elem))
+      if(!PyUnicode_Check(elem))
       {
         std::stringstream message;
         message << "List element number " << i << " is not a string.\n";
@@ -95,8 +95,7 @@ std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
       }
       else
       {
-        const char * portName = PyString_AsString(elem);
-        cppList.push_back(portName);
+        cppList.push_back(std::string(PyUnicode_AsUTF8(elem)));
       }
     }
   }
@@ -113,14 +112,14 @@ std::string getPyErrorText()
     PyObject *pystr, *module_name, *pyth_module, *pyth_func;
     PyErr_Fetch(&ptype, &pvalue, &ptraceback);
     pystr = PyObject_Str(pvalue);
-    result = PyString_AsString(pystr);
+    result = std::string(PyUnicode_AsUTF8(pystr));
     result += "\n";
     Py_DECREF(pystr);
     
     /* See if we can get a full traceback */
     if(ptraceback)
     {
-      module_name = PyString_FromString("traceback");
+      module_name = PyUnicode_FromString("traceback");
       pyth_module = PyImport_Import(module_name);
       Py_DECREF(module_name);
       if (pyth_module)
@@ -136,7 +135,7 @@ std::string getPyErrorText()
             for(int i=0; i<n; i++)
             {
               pystr = PyList_GetItem(pyList,i);
-              result += PyString_AsString(pystr);
+              result += std::string(PyUnicode_AsUTF8(pystr));
             }
             Py_DECREF(pyList);
           }
@@ -180,7 +179,7 @@ void Py2yacs::load(const std::string& python_code)
     
     // Py_Initialize();
     YACS::ENGINE::AutoGIL agil;
-    pValue = PyString_FromString(_python_parser_module.c_str());
+    pValue = PyUnicode_FromString(_python_parser_module.c_str());
     pModule = PyImport_Import(pValue);
     Py_DECREF(pValue);
 
@@ -198,7 +197,7 @@ void Py2yacs::load(const std::string& python_code)
       if (pFunc && PyCallable_Check(pFunc))
       {
         pArgs = PyTuple_New(1);
-        pValue = PyString_FromString(python_code.c_str());
+        pValue = PyUnicode_FromString(python_code.c_str());
         PyTuple_SetItem(pArgs, 0, pValue);
         
         pValue = PyObject_CallObject(pFunc, pArgs);
@@ -211,7 +210,7 @@ void Py2yacs::load(const std::string& python_code)
           {
             errorMessage += "Parsing function should return a tuple of two string lists.\n";
           }
-          int n = PyTuple_Size(pValue);
+          Py_ssize_t n = PyTuple_Size(pValue);
           if(n != 2)
           {
             errorMessage += "Parsing function should return two string lists.\n";
@@ -232,7 +231,7 @@ void Py2yacs::load(const std::string& python_code)
               
               if(pAttribute = checkAndGetAttribute(fpy, "name", errorMessage))
               {
-                if(!PyString_Check(pAttribute))
+                if(!PyUnicode_Check(pAttribute))
                 {
                   errorMessage += "Attribute 'name' should be a string.\n";
                   Py_DECREF(pAttribute);
@@ -241,7 +240,7 @@ void Py2yacs::load(const std::string& python_code)
                 {
                   _functions.push_back(FunctionProperties());
                   FunctionProperties& fcpp = _functions.back();
-                  fcpp._name=PyString_AsString(pAttribute);
+                  fcpp._name=std::string(PyUnicode_AsUTF8(pAttribute));
                   Py_DECREF(pAttribute);
                   
                   if(pAttribute = checkAndGetAttribute(fpy, "inputs", errorMessage))
index 84ac997f000315bbeeaf2f65d31f73df0d3e2dbf..f5f01ce3d384a764e6d293f661dc72f4a4efba86 100644 (file)
@@ -41,7 +41,7 @@ class FunctionProperties:
 
 class v(ast.NodeVisitor):
   def visit_Module(self, node):
-    #print type(node).__name__, ":"
+    #print(type(node).__name__, ":")
     accepted_tokens = ["Import", "ImportFrom", "FunctionDef", "ClassDef"]
     #print "module body:"
     self.global_errors=[]
@@ -51,8 +51,8 @@ class v(ast.NodeVisitor):
         error="py2yacs error at line %s: not accepted statement '%s'." % (
                e.lineno, type_name)
         self.global_errors.append(error)
-      #print type_name
-    #print "------------------------------------------------------------------"
+      #print(type_name)
+    #print("------------------------------------------------------------------")
     self.functions=[]
     self.lastfn=""
     self.infunc=False
@@ -60,7 +60,7 @@ class v(ast.NodeVisitor):
     self.generic_visit(node)
     pass
   def visit_FunctionDef(self, node):
-    #print type(node).__name__, ":", node.name
+    #print(type(node).__name__, ":", node.name)
     if not self.infunc:
       self.lastfn = FunctionProperties(node.name)
       self.functions.append(self.lastfn)
@@ -71,24 +71,12 @@ class v(ast.NodeVisitor):
       self.lastfn = None
       self.infunc=False
     pass
-  def visit_arguments(self, node):
-    #print type(node).__name__, ":"
-    self.inargs=True
-    self.generic_visit(node)
-    self.inargs=False
-    pass
-  def visit_Name(self, node):
-    if self.inargs :
-      #print type(node).__name__, ":", node.id
-      self.lastname=node.id
-      self.generic_visit(node)
-    pass
-  def visit_Param(self, node):
-    #print type(node).__name__, ":", self.lastname
-    self.lastfn.inputs.append(self.lastname)
+  def visit_arg(self, node):
+    #print(type(node).__name__, ":", node.arg)
+    self.lastfn.inputs.append(node.arg)
     pass
   def visit_Return(self, node):
-    #print type(node).__name__, ":", node.value
+    #print(type(node).__name__, ":", node.value)
     if self.lastfn.outputs is not None :
       error="py2yacs error at line %s: multiple returns." % node.lineno
       self.lastfn.errors.append(error)
@@ -184,9 +172,9 @@ if __name__ == '__main__':
   
   fn_name = args.def_name
   functions,errors = get_properties(text_file)
-  print "global errors:", errors
+  print("global errors:", errors)
   for f in functions:
-    print f
+    print(f)
   
   fn_properties = next((f for f in functions if f.name == fn_name), None)
   if fn_properties is not None :
@@ -195,7 +183,6 @@ if __name__ == '__main__':
                        fn_properties.inputs, fn_properties.outputs,
                        args.output)
     else:
-      print "\n".join(fn_properties.errors)
+      print("\n".join(fn_properties.errors))
   else:
-    print "Function not found:", fn_name
-  
\ No newline at end of file
+    print("Function not found:", fn_name)
index a3022e7f695b14cc77bd75840e6faa5cea5f0e8d..62868d720e0248c5b68ef95ba197c9b7cf89019d 100644 (file)
 """
 import sys,os
 from qt import *
-import Tree
-import PanelManager
-import BoxManager
-import Icons
-import Items
-import adapt
-import Item
-import logview
+from . import Tree
+from . import PanelManager
+from . import BoxManager
+from . import Icons
+from . import Items
+from . import adapt
+from . import Item
+from . import logview
 import pilot
 import threading
 import time
-import CONNECTOR
-import catalog
+from . import CONNECTOR
+from . import catalog
 import traceback
 import glob
 
@@ -55,7 +55,7 @@ class Runner(threading.Thread):
   def run(self):
     try:
       self.executor.RunW(self.proc,0)
-    except ValueError,ex:
+    except ValueError as ex:
       #traceback.print_exc()
       QApplication.postEvent(self.parent, ErrorEvent('YACS execution error',str(ex)))
 
@@ -467,7 +467,7 @@ class Appli(QMainWindow):
 
 
 if __name__ == "__main__":
-  from Item import Item
+  from .Item import Item
   app = QApplication(sys.argv)
   t=Appli()
   t.objectBrowser.additem(Item("item1"))
index e4e93427850752109fa01011c8656db4af1980a5..bb3c67eec91975ed3e3acb2c82e7f50072f165e3 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 from qt import *
-import CONNECTOR
+from . import CONNECTOR
 
 class BoxManager(QWidgetStack):
   """ A BoxManager manages a collection of widget 
@@ -35,7 +35,7 @@ class BoxManager(QWidgetStack):
     CONNECTOR.Connect(self.rootItem,"selected",self.setview,())
 
   def setview(self,item):
-    if not self.panels.has_key(item):
+    if item not in self.panels:
       CONNECTOR.Connect(item,"changed",self.changePanel,(item,))
       panel=item.box(self)
       self.panels[item]=panel
@@ -43,8 +43,8 @@ class BoxManager(QWidgetStack):
     self.raiseWidget(self.panels[item])
 
   def changePanel(self,item):
-    print "changePanel",item
-    if self.panels.has_key(item):
+    print("changePanel",item)
+    if item in self.panels:
       self.removeWidget(self.panels[item])
     panel=item.box(self)
     self.panels[item]=panel
index 2ea6be76cf3130882db7fe0f291b0ca06c4a5fd5..6d5c60561daddc54bd358300466c96434dff3823 100644 (file)
@@ -22,7 +22,7 @@ from qt import *
 from qtcanvas import *
 import pilot
 import pypilot
-import Item
+from . import Item
 import math
 
 dispatcher=pilot.Dispatcher.getDispatcher()
@@ -246,7 +246,7 @@ class LinkItem:
     return menu
 
   def delete(self):
-    print "delete link"
+    print("delete link")
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
@@ -293,10 +293,10 @@ class ControlItem(QCanvasRectangle):
     return menu
 
   def connect(self):
-    print "ControlItem.connect",self.context
-    print self.port
+    print("ControlItem.connect",self.context)
+    print(self.port)
     item=Item.adapt(self.port)
-    print item
+    print(item)
     item.connect()
     self.context.connecting(item)
     #self.context.connecting(self)
@@ -305,7 +305,7 @@ class ControlItem(QCanvasRectangle):
     #Protocol to link 2 objects (ports, at first)
     #First, notify the canvas View (or any view that can select) we are connecting (see method connect above)
     #Second (and last) make the link in the link method of object that was declared connecting
-    print "link:",obj
+    print("link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), self.width(), self.height())
@@ -331,7 +331,7 @@ class InControlItem(ControlItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutControlItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -358,7 +358,7 @@ class OutControlItem(ControlItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InControlItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -405,15 +405,15 @@ class PortItem(QCanvasEllipse):
     return menu
 
   def connect(self):
-    print "PortItem.connect",self.context
-    print self.port
+    print("PortItem.connect",self.context)
+    print(self.port)
     item=Item.adapt(self.port)
-    print item
+    print(item)
     self.context.connecting(item)
     #self.context.connecting(self)
 
   def link(self,obj):
-    print "PortItem.link:",obj
+    print("PortItem.link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(),pos.y(),self.width(), self.height())
@@ -440,7 +440,7 @@ class InPortItem(PortItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutPortItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -461,7 +461,7 @@ class OutPortItem(PortItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InPortItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -588,7 +588,7 @@ class Cell(QCanvasRectangle,pypilot.PyObserver):
       color= self.colors.get(color,Qt.white)
       self.setBrush(QBrush(color))
     else:
-      print "Unknown custom event type:", event.type()
+      print("Unknown custom event type:", event.type())
 
   def moveBy(self,dx,dy):
     QCanvasRectangle.moveBy(self,dx,dy)
@@ -624,7 +624,7 @@ class Cell(QCanvasRectangle,pypilot.PyObserver):
     #QToolTip(view).tip( r, s )
 
   def browse(self):
-    print "browse"
+    print("browse")
 
   def selected(self):
     """The canvas item has been selected"""
index 5514cfdccc182fc72d5ccca668fa83887a725e84..fe19e8b5f54f9de702d9d9f3e07f6f1abcccc223 100644 (file)
 # -*- coding: iso-8859-15 -*-
 #
 """
-  La classe CONNECTOR sert Ã  enregistrer les observateurs d'objets et Ã  délivrer
-  les messages Ã©mis Ã  ces objets.
+  La classe CONNECTOR sert Ã  enregistrer les observateurs d'objets et Ã  délivrer
+  les messages Ã©mis Ã  ces objets.
 
-  Le principe général est le suivant : un objet (subscriber) s'enregistre aupres du 
+  Le principe général est le suivant : un objet (subscriber) s'enregistre aupres du 
   connecteur global (theconnector) pour observer un objet emetteur de messages (publisher) 
-  sur un canal donné (channel). Il demande Ã  etre notifie par appel d'une fonction (listener).
-  La séquence est donc :
+  sur un canal donné (channel). Il demande Ã  etre notifie par appel d'une fonction (listener).
+  La séquence est donc :
 
      - enregistrement du subscriber pour le publisher : theconnector.Connect(publisher,channel,listener,args)
-     - Ã©mission du message par le publisher : theconnector.Emit(publisher,channel,cargs)
+     - Ã©mission du message par le publisher : theconnector.Emit(publisher,channel,cargs)
 
-  args et cargs sont des tuples contenant les arguments de la fonction listener qui sera appelée
+  args et cargs sont des tuples contenant les arguments de la fonction listener qui sera appelée
   comme suit::
 
      listener(cargs+args)
@@ -51,12 +51,12 @@ class CONNECTOR:
   def Connect(self, object, channel, function, args):
     ###print "Connect",object, channel, function, args
     idx = id(object)
-    if self.connections.has_key(idx):
+    if idx in self.connections:
        channels = self.connections[idx]
     else:
        channels = self.connections[idx] = {}
 
-    if channels.has_key(channel):
+    if channel in channels:
        receivers = channels[channel]
     else:
        receivers = channels[channel] = []
@@ -75,8 +75,7 @@ class CONNECTOR:
     try:
        receivers = self.connections[id(object)][channel]
     except KeyError:
-       raise ConnectorError, \
-            'no receivers for channel %s of %s' % (channel, object)
+       raise ConnectorError('no receivers for channel %s of %s' % (channel, object))
 
     for funct,fargs in receivers[:]:
         if funct() is None:
@@ -94,9 +93,8 @@ class CONNECTOR:
                  del self.connections[id(object)]
            return
 
-    raise ConnectorError,\
-          'receiver %s%s is not connected to channel %s of %s' \
-          % (function, args, channel, object)
+    raise ConnectorError('receiver %s%s is not connected to channel %s of %s' \
+          % (function, args, channel, object))
 
 
   def Emit(self, object, channel, *args):
@@ -112,7 +110,7 @@ class CONNECTOR:
        try:
           func=rfunc()
           if func:
-             apply(func, args + fargs)
+             func(*args + fargs)
           else:
              # Le receveur a disparu
              if (rfunc,fargs) in receivers:receivers.remove((rfunc,fargs))
@@ -127,8 +125,8 @@ def ref(target,callback=None):
 
 class BoundMethodWeakref(object):
    def __init__(self,callable):
-       self.Self=weakref.ref(callable.im_self)
-       self.Func=weakref.ref(callable.im_func)
+       self.Self=weakref.ref(callable.__self__)
+       self.Func=weakref.ref(callable.__func__)
 
    def __call__(self):
        target=self.Self()
@@ -146,27 +144,27 @@ if __name__ == "__main__":
    class A:pass
    class B:
      def add(self,a):
-       print "add",self,a
+       print("add",self,a)
      def __del__(self):
-       print "__del__",self
+       print("__del__",self)
 
    def f(a):
-     print f,a
-   print "a=A()"
+     print(f,a)
+   print("a=A()")
    a=A()
-   print "b=B()"
+   print("b=B()")
    b=B()
-   print "c=B()"
+   print("c=B()")
    c=B()
    Connect(a,"add",b.add,())
    Connect(a,"add",b.add,())
    Connect(a,"add",c.add,())
    Connect(a,"add",f,())
    Emit(a,"add",1)
-   print "del b"
+   print("del b")
    del b
    Emit(a,"add",1)
-   print "del f"
+   print("del f")
    del f
    Emit(a,"add",1)
    Disconnect(a,"add",c.add,())
index fd14ca4e7323a435336415e6d93f6e46b1964d42..418f1e66172a3dee759009bbb7900417a35867cb 100644 (file)
@@ -162,7 +162,7 @@ class GraphViewer(QCanvasView):
     #self.canvas().update()
 
   def addNode(self):
-    print "addNode"    
+    print("addNode")    
 
   def zoomIn(self):
     m = self.worldMatrix()
@@ -184,7 +184,7 @@ class GraphViewer(QCanvasView):
 
   def connecting(self,obj):
     """Method called by an item to notify canvasView a connection has begun"""
-    print "connecting",obj
+    print("connecting",obj)
     self.__connecting=obj
 
   def contentsMouseMoveEvent(self,e):
@@ -270,7 +270,7 @@ class LinkItem(QCanvasLine):
     return menu
 
   def delete(self):
-    print "delete link"
+    print("delete link")
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
@@ -304,11 +304,11 @@ class PortItem(QCanvasEllipse):
     return menu
 
   def connect(self):
-    print "connect",self.context
+    print("connect",self.context)
     self.context.connecting(self)
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(self.x(), self.y(), self.width(), self.height())
@@ -326,7 +326,7 @@ class InPortItem(PortItem):
       link.setToPoint( int(self.x()), int(self.y()) )
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutPortItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -345,7 +345,7 @@ class OutPortItem(PortItem):
       link.setFromPoint( int(self.x()), int(self.y()) )
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InPortItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -399,10 +399,10 @@ class Cell(QCanvasRectangle):
     view.tip( r, s )
 
   def browse(self):
-    print "browse"
+    print("browse")
 
   def selected(self):
-    print "selected"
+    print("selected")
 
 if __name__=='__main__':
   app=QApplication(sys.argv)
index 3d3b56fb88e59c3954df203b212aacd3b5b0caa5..d85460100d17e9eb5f6322c194197e4bc8b59522 100644 (file)
 
 import os
 from qt import QPixmap
-from imagesxpm import dico_xpm
+from .imagesxpm import dico_xpm
 
 dico_images={}
 
 def get_image(name):
-  if dico_images.has_key(name):
+  if name in dico_images:
     return dico_images[name]
   else :
-    if dico_xpm.has_key(name):
+    if name in dico_xpm:
       image=QPixmap(dico_xpm[name])
     else:
       fic_image = os.path.join(os.path.dirname(__file__),"icons",name)
index 83401a6cb339f6042cbeb15e4b408b20d9470de3..2b80e44df384672bbbe7ac925c8a26efcb625a20 100644 (file)
@@ -19,8 +19,8 @@
 
 import sys
 from qt import *
-import CONNECTOR
-import adapt
+from . import CONNECTOR
+from . import adapt
 
 class Item:
   def __init__(self,label=""):
@@ -62,7 +62,7 @@ class Item:
 ADAPT=adapt.adapt
 items={}
 def adapt(obj):
-  if items.has_key(obj.ptr()):
+  if obj.ptr() in items:
     return items[obj.ptr()]
   else:
     item= ADAPT(obj,Item)
index 50eb722214669794c9daed59663bb704637e00b6..9dd6baa9fd469e8fd8842719f4359305df937b76 100644 (file)
 import sys
 import pilot
 import SALOMERuntime
-import Item
-import adapt
+from . import Item
+from . import adapt
 from qt import *
 from qtcanvas import *
-import Editor
-import CItems
+from . import Editor
+from . import CItems
 import pygraphviz
 import traceback
-import CONNECTOR
-import graph
-import panels
+from . import CONNECTOR
+from . import graph
+from . import panels
 
 class DataLinkItem(Item.Item):
   def __init__(self,pin,pout):
@@ -174,7 +174,7 @@ class ItemComposedNode(Item.Item):
     return tabWidget
 
   def addNode(self,service):
-    print "Composed.addNode",service
+    print("Composed.addNode",service)
     #add node service in the parent self which is a ComposedNode
     new_node=service.clone(None)
     ItemComposedNode.n=ItemComposedNode.n+1
@@ -196,7 +196,7 @@ class ItemComposedNode(Item.Item):
   panels=[("Panel1",panel1)]
 
   def addLink(self,link):
-    print "Composed.addLink",link
+    print("Composed.addLink",link)
     if isinstance(link,DataLinkItem):
       self.datalinks.addLink(link)
     elif isinstance(link,StreamLinkItem):
@@ -237,7 +237,7 @@ class ItemSwitch(ItemComposedNode):
 class ItemProc(ItemComposedNode):
   """Item pour la procedure"""
   def connecting(self,item):
-    print "ItemProc.connecting",item
+    print("ItemProc.connecting",item)
     self._connecting=item
 
 class ItemPort(Item.Item):
@@ -276,10 +276,10 @@ class ItemPort(Item.Item):
   box=panel
 
   def link(self,other):
-    print "ItemPort.link:",self,other
+    print("ItemPort.link:",self,other)
 
   def connect(self):
-    print "ItemPort.connect:"
+    print("ItemPort.connect:")
     self.root.connecting(self)
 
 class ItemInPort(ItemPort):
@@ -317,7 +317,7 @@ class ItemOutPort(ItemPort):
       if not cflink:
         #add also a control flow link
         fitem.addLink(ControlLinkItem(nodeS,nodeE))
-    except ValueError,ex:
+    except ValueError as ex:
       traceback.print_exc()
       QMessageBox.warning(None,"YACS error",str(ex))
       return
@@ -340,7 +340,7 @@ class ItemOutStream(ItemPort):
       l=StreamLinkItem(other.port,self.port)
       fitem=Item.adapt(father)
       fitem.addLink(l)
-    except ValueError,ex:
+    except ValueError as ex:
       traceback.print_exc()
       QMessageBox.warning(None,"YACS error",str(ex))
       return
index ad36686e0039b548287231491d59ebf3460211e8..55d742ca48f3e29f0c4bc02c371b5fb73cf099ed 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 from qt import *
-import CONNECTOR
+from . import CONNECTOR
 
 class PanelManager(QWidgetStack):
   """ A PanelManager manages a collection of widget
@@ -36,7 +36,7 @@ class PanelManager(QWidgetStack):
     CONNECTOR.Connect(self.rootItem,"dblselected",self.setview,())
 
   def setview(self,item):
-    if not self.panels.has_key(item):
+    if item not in self.panels:
       panel=item.panel(self)
       self.panels[item]=panel
       idd=self.addWidget(panel)
index 4d1484b5ce8899127c916e33178d3e4f4f81655b..ff0fc50f98207ea6b7ba578cfefdc3dd35dcbfd1 100644 (file)
 
 # -*- coding: iso-8859-15 -*-
 #
-"""Ce module permet de créer des vues sous forme d'arbre
-   Ces vues sont construites Ã  partir des informations
-   fournies par un modèle
+"""Ce module permet de créer des vues sous forme d'arbre
+   Ces vues sont construites Ã  partir des informations
+   fournies par un modèle
 """
 
 import sys
 from qt import *
-import Icons
-import CONNECTOR
+from . import Icons
+from . import CONNECTOR
 
 class Tree(QListView):
   """Tree(parent=None)
@@ -156,7 +156,7 @@ class Node(QListViewItem):
        
 
 if __name__ == "__main__":
-  from Item import Item
+  from .Item import Item
   app = QApplication(sys.argv)
   t=Tree()
   t.additem(Item("item1"))
index dded890b565c928267970a6d3b24d51bb2f9435a..352911c7226a5270d1e250eafa1ebc9a80c522b9 100644 (file)
@@ -37,7 +37,7 @@ def _adapt_by_registry(obj, protocol, alternate):
         else:
             adapter = factory(obj, protocol, alternate)
         if adapter is AdaptationError:
-            raise AdaptationError,obj
+            raise AdaptationError(obj)
         else:
             return adapter
 
index ea2f2d57e3cdbc6acad0890ad800c65ded3bf70f..48a6d219c9444cc2192dd6a7281f539334a22158 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import Tree
-from BoxManager import BoxManager
+from . import Tree
+from .BoxManager import BoxManager
 
 class Browser(QVBox):
   def __init__(self,parent,appli):
index a97504b7c49763526ae72169a46eaae03835eab5..c6b645bfa444e0ea7829c419cd5a2f9ddea8074d 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import browser
-import cataitems
+from . import browser
+from . import cataitems
 
 class Browser(browser.Browser):
   def init(self):
@@ -30,7 +30,7 @@ class Browser(browser.Browser):
     self.connect( but1, SIGNAL("clicked()"), self.handleBut1 )
 
   def handleBut1(self):
-    print "handleBut1",self.selected
+    print("handleBut1",self.selected)
     if hasattr(self.selected,"addNode"):
       self.selected.addNode(self.appli)
     return
index ed5cc95525d0fb6fb4dca7694605184418862cf6..3e97c45f34d551ab02126156171aacb02daf5bc8 100644 (file)
@@ -19,8 +19,8 @@
 
 import sys
 from qt import *
-import browser
-import sessions
+from . import browser
+from . import sessions
 import pilot
 
 class Browser(browser.Browser):
index 574f1faa880e63fa71dfcd1cd9d32415d6f7cf0e..111273387277ff575358fe74d2535bffaff2b308 100644 (file)
@@ -19,9 +19,9 @@
 
 from qt import *
 
-import Item
-import CONNECTOR
-import Items
+from . import Item
+from . import CONNECTOR
+from . import Items
 
 class Obj(Item.Item):
   def __init__(self,root=None):
@@ -124,7 +124,7 @@ class ItemCompo(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for service in self.compo._serviceMap.values():
+    for service in list(self.compo._serviceMap.values()):
       itemservice=ItemService(service,self.root)
       sublist.append(itemservice)
     return sublist
@@ -197,7 +197,7 @@ class TypesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for name,typ in self.typeMap.items():
+    for name,typ in list(self.typeMap.items()):
       itemtype=ItemType(typ,self.root,name)
       sublist.append(itemtype)
     return sublist
@@ -218,7 +218,7 @@ class ComponentsItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for compo in self.compoMap.values():
+    for compo in list(self.compoMap.values()):
       itemcompo=ItemCompo(compo,self.root)
       sublist.append(itemcompo)
     return sublist
@@ -239,7 +239,7 @@ class NodesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for node in self.nodesMap.values():
+    for node in list(self.nodesMap.values()):
       itemnode=ItemNode(node,self.root)
       sublist.append(itemnode)
     return sublist
@@ -260,7 +260,7 @@ class ComposedNodesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for node in self.composedMap.values():
+    for node in list(self.composedMap.values()):
       itemnode=ItemComposedNode(node,self.root)
       sublist.append(itemnode)
     return sublist
index 43cdd73c59fe890977812599b2f9b56e436c4db3..fe86e2c7d88aa884436f1b7fb7be3907bed271e6 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import browser_session
-import browser_catalog
+from . import browser_session
+from . import browser_catalog
 import pilot
 
 class CatalogTool(QMainWindow):
@@ -74,10 +74,10 @@ class CatalogTool(QMainWindow):
       return
     filename = str(fn)
     cata=pilot.getRuntime().loadCatalog("proc",filename)
-    print cata
-    print cata._nodeMap
-    for name,node in cata._nodeMap.items():
-      print name,node
+    print(cata)
+    print(cata._nodeMap)
+    for name,node in list(cata._nodeMap.items()):
+      print(name,node)
     self.register(cata,filename)
 
   def register(self,cata,name):
index db2a0c4f26e39ef15f68e6276e3a03d5eb9ba175..73057b7cc077d04196ae50dc7406f1f132c9365e 100644 (file)
 
 import sys
 import pilot
-import Item
+from . import Item
 from qt import *
 from qtcanvas import *
-from GraphViewer import GraphViewer
-import Editor
-import CItems
+from .GraphViewer import GraphViewer
+from . import Editor
+from . import CItems
 import pygraphviz
 from pygraphviz import graphviz as gv
 import traceback
-import CONNECTOR
+from . import CONNECTOR
 import bisect
 
 class MyCanvas(QCanvas):
@@ -68,7 +68,7 @@ class Graph:
       citems[n.ptr()]=c
       c.show()
 
-    for k,n in citems.items():
+    for k,n in list(citems.items()):
       for p in n.inports:
         pitems[p.port.ptr()]=p
       for p in n.outports:
@@ -91,7 +91,7 @@ class Graph:
     self.layout("LR")
 
   def addLink(self,link):
-    print "graph.addLink",link
+    print("graph.addLink",link)
     #CItem for outport
     nodeS=self.citems[link.pout.getNode().ptr()]
     nodeE=self.citems[link.pin.getNode().ptr()]
@@ -127,7 +127,7 @@ class Graph:
     G.graph_attr["dpi"]="72"
     dpi=72.
     aspect=dpi/72
-    for k,n in self.citems.items():
+    for k,n in list(self.citems.items()):
       #k is node address (YACS)
       #n is item in canvas
       G.add_node(k)
@@ -139,7 +139,7 @@ class Graph:
         continue
       G.add_edge(pout.getNode().ptr(),pin.getNode().ptr())
 
-    for k,n in self.citems.items():
+    for k,n in list(self.citems.items()):
       for ndown in n.node.getOutNodes():
         G.add_edge(n.node.ptr(),ndown.ptr())
 
@@ -183,7 +183,7 @@ class Graph:
     self.canvas.update()
 
   def clearLinks(self):
-    items=self.citems.values()
+    items=list(self.citems.values())
     for node in items:
       for port in node.outports:
         if not hasattr(port,"links"):
@@ -193,7 +193,7 @@ class Graph:
     self.canvas.update()
 
   def orthoLinks(self):
-    items=self.citems.values()
+    items=list(self.citems.values())
     g=grid(items)
     for node in items:
       for port in node.outports:
@@ -328,10 +328,10 @@ class grid:
     self.xs=xs
     self.ys=ys
     self.cols=[]
-    for w in xrange(len(xs)-1):
+    for w in range(len(xs)-1):
       col=[]
       x=(xs[w]+xs[w+1])/2
-      for h in xrange(len(ys)-1):
+      for h in range(len(ys)-1):
         y=(ys[h]+ys[h+1])/2
         col.append(node((x,y),(w,h)))
       self.cols.append(col)
@@ -412,7 +412,7 @@ class grid:
     self.open.append((fromNode.total,fromNode))
     toNode=self.get(toLoc)
     if toNode.blocked:
-      print "toNode is blocked"
+      print("toNode is blocked")
       return []
     destx,desty=toNode.coord
     while self.open:
index a26f095cc909983c3ddd1d95f1a4dc372d0490f2..c15fc9306bf5173938ca0d068992a87e4637b8ac 100644 (file)
@@ -19,8 +19,8 @@
 
 from qt import *
 import traceback
-import Editor
-import Item
+from . import Editor
+from . import Item
 
 class PanelScript(QVBox):
   def __init__(self,parent,item):
index 46c0ded2fde70fda23995897f9c7f5053c94eeb1..021488da60bb93aff79e1852efa975b0d7cf1c3f 100644 (file)
@@ -22,8 +22,8 @@ import omniORB
 from omniORB import CORBA
 import CosNaming
 
-import Item
-import CONNECTOR
+from . import Item
+from . import CONNECTOR
 
 class Sessions(Item.Item):
   def __init__(self,port):
index f2feb37b3df72ba74167c81a45dfa700038fa025..aaa98f565d917ca33dba5de9a763bb9320704b73 100644 (file)
@@ -35,9 +35,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index 723751e76c8dcb344e1188ddb3a09c3b6944196d..917f8a5430d2ab0207d0c6a1aa635924aa44464c 100644 (file)
@@ -37,9 +37,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print "p1:",p1</code>
+            <code>  print("p1:",p1)</code>
             <code><![CDATA[  condition=p1 < 40.]]> </code>
             <code>  return p1,condition</code>
         </function>
index b2b1c67131bc7111db79f045707f454e84703408..e71ce3a408eaafd0223936c06ff9291cdfc2f9f6 100644 (file)
@@ -51,6 +51,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
   ${OMNIORB_ROOT_DIR}/include/omniORB4/internal
+  ${OMNIORBPY_INCLUDE_DIR}
   ${SALOME_INCL_PATH}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index aeba65639af0882fcff5729ddef54e1032963330..690061c817d30fca4ebeb2ee9cac82669aa3ca0d 100644 (file)
@@ -272,9 +272,9 @@ std::string InputCorbaPort::dump()
 
 std::string InputCorbaPort::valToStr()
 {
-  int isString = PyString_Check(getPyObj());
+  int isString = PyBytes_Check(getPyObj());
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   if (isString)
     val = "\"" + val + "\"";
   Py_DECREF(strPyObj);
@@ -466,7 +466,7 @@ namespace YACS {
 std::string OutputCorbaPort::valToStr()
 {
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   Py_DECREF(strPyObj);
   return val;
 }
index 8a2ccd7a71f93307a684e328290e467e6f0f2b08..bf78b6d30d9f462f34ba995814133d778b86f76f 100644 (file)
@@ -72,7 +72,7 @@ void DistributedPythonNode::load()
         _errorDetails=msg.str();
         throw Exception(msg.str());
       }
-    const char picklizeScript[]="import cPickle\ndef pickleForDistPyth2009(*args,**kws):\n  return cPickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n  args=cPickle.loads(st)\n  return args\n";
+    const char picklizeScript[]="import pickle\ndef pickleForDistPyth2009(*args,**kws):\n  return pickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n  args=pickle.loads(st)\n  return args\n";
     PyObject *res=PyRun_String(picklizeScript,Py_file_input,_context,_context);
     if(res == NULL)
       {
@@ -180,7 +180,7 @@ void DistributedPythonNode::execute()
         PyTuple_SetItem(args,pos,ob);
       }
     PyObject *serializationInput=PyObject_CallObject(_pyfuncSer,args);
-    std::string serializationInputC=PyString_AsString(serializationInput);
+    std::string serializationInputC=PyBytes_AsString(serializationInput);
     serializationInputCorba=new Engines::pickledArgs;
     int len=serializationInputC.length();
     serializationInputCorba->length(serializationInputC.length());
@@ -212,7 +212,7 @@ void DistributedPythonNode::execute()
   {
     AutoGIL agil;
     args = PyTuple_New(1);
-    PyObject* resultPython=PyString_FromString(resultCorbaC);
+    PyObject* resultPython=PyBytes_FromString(resultCorbaC);
     delete [] resultCorbaC;
     PyTuple_SetItem(args,0,resultPython);
     PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
@@ -237,7 +237,7 @@ void DistributedPythonNode::execute()
           {
             OutputPyPort *p=(OutputPyPort *)*iter;
             DEBTRACE( "port name: " << p->getName() );
-            DEBTRACE( "port kind: " << p->edGetType()->kind() );
+            DEBTRACE( "port kind: " << p->typeName() );
             DEBTRACE( "port pos : " << pos );
             if(PyTuple_Check(finalResult))ob=PyTuple_GetItem(finalResult,pos) ;
             else ob=finalResult;
index cc939672ce761a48d1c2619466dd956a6ef752f0..0c1cf83ded316005f49952e136bcf61d7deb41a7 100644 (file)
@@ -78,49 +78,49 @@ static PyMemberDef PyStdOut_memberlist[] = {
 static PyTypeObject PyStdOut_Type = {
   /* The ob_type field must be initialized in the module init function
    * to be portable to Windows without using C++. */
-  PyObject_HEAD_INIT(NULL)
-  0,      /*ob_size*/
-  "PyOut",   /*tp_name*/
-  sizeof(PyStdOut),  /*tp_basicsize*/
-  0,      /*tp_itemsize*/
+  PyVarObject_HEAD_INIT(NULL, 0)
+  /*0,*/                            /*ob_size*/
+  "PyOut",                      /*tp_name*/
+  sizeof(PyStdOut),             /*tp_basicsize*/
+  0,                            /*tp_itemsize*/
   /* methods */
   (destructor)PyStdOut_dealloc, /*tp_dealloc*/
-  0,      /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  0,      /*tp_compare*/
-  0,      /*tp_repr*/
-  0,      /*tp_as_number*/
-  0,      /*tp_as_sequence*/
-  0,      /*tp_as_mapping*/
-  0,      /*tp_hash*/
-        0,                      /*tp_call*/
-        0,                      /*tp_str*/
-        PyObject_GenericGetAttr,                      /*tp_getattro*/
-        /* softspace is writable:  we must supply tp_setattro */
-        PyObject_GenericSetAttr,    /* tp_setattro */
-        0,                      /*tp_as_buffer*/
-        Py_TPFLAGS_DEFAULT,     /*tp_flags*/
-        0,                      /*tp_doc*/
-        0,                      /*tp_traverse*/
-        0,                      /*tp_clear*/
-        0,                      /*tp_richcompare*/
-        0,                      /*tp_weaklistoffset*/
-        0,                      /*tp_iter*/
-        0,                      /*tp_iternext*/
-        PyStdOut_methods,                      /*tp_methods*/
-        PyStdOut_memberlist,                      /*tp_members*/
-        0,                      /*tp_getset*/
-        0,                      /*tp_base*/
-        0,                      /*tp_dict*/
-        0,                      /*tp_descr_get*/
-        0,                      /*tp_descr_set*/
-        0,                      /*tp_dictoffset*/
-        0,                      /*tp_init*/
-        0,                      /*tp_alloc*/
-        0,                      /*tp_new*/
-        0,                      /*tp_free*/
-        0,                      /*tp_is_gc*/
+  0,                            /*tp_print*/
+  0,                            /*tp_getattr*/
+  0,                            /*tp_setattr*/
+  0,                            /*tp_compare*/
+  0,                            /*tp_repr*/
+  0,                            /*tp_as_number*/
+  0,                            /*tp_as_sequence*/
+  0,                            /*tp_as_mapping*/
+  0,                            /*tp_hash*/
+  0,                            /*tp_call*/
+  0,                            /*tp_str*/
+  PyObject_GenericGetAttr,      /*tp_getattro*/
+  /* softspace is writable:  we must supply tp_setattro */
+  PyObject_GenericSetAttr,      /* tp_setattro */
+  0,                            /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT,           /*tp_flags*/
+  0,                            /*tp_doc*/
+  0,                            /*tp_traverse*/
+  0,                            /*tp_clear*/
+  0,                            /*tp_richcompare*/
+  0,                            /*tp_weaklistoffset*/
+  0,                            /*tp_iter*/
+  0,                            /*tp_iternext*/
+  PyStdOut_methods,             /*tp_methods*/
+  PyStdOut_memberlist,          /*tp_members*/
+  0,                            /*tp_getset*/
+  0,                            /*tp_base*/
+  0,                            /*tp_dict*/
+  0,                            /*tp_descr_get*/
+  0,                            /*tp_descr_set*/
+  0,                            /*tp_dictoffset*/
+  0,                            /*tp_init*/
+  0,                            /*tp_alloc*/
+  0,                            /*tp_new*/
+  0,                            /*tp_free*/
+  0,                            /*tp_is_gc*/
 };
 
 
@@ -168,7 +168,7 @@ PyObject *evalPy(const std::string& funcName, const std::string& strToEval)
       std::ostringstream oss; oss << "evalPy failed : " << errorDetails;
       throw Exception(oss.str());
     }
-  AutoPyRef res(PyEval_EvalCode(reinterpret_cast<PyCodeObject *>((PyObject *)code),context,context));
+  AutoPyRef res(PyEval_EvalCode((PyObject *)code,context,context));
   PyObject *ret(PyDict_GetItemString(context,funcName.c_str())); //borrowed ref
   if(!ret)
     throw YACS::Exception("evalPy : Error on returned func !");
index e1db34ebbe40d79958a392846bc171e878ad6e5e..9a604d3bd749925fbdbb5334dd67aab9e3680960 100644 (file)
 typedef int Py_ssize_t;
 #endif
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "YacsTrace.hxx"
 
 using namespace YACS::ENGINE;
 using namespace std;
 
-const char PythonEntry::SCRIPT_FOR_SIMPLE_SERIALIZATION[]="import cPickle\n"
+const char PythonEntry::SCRIPT_FOR_SIMPLE_SERIALIZATION[]="import pickle\n"
     "def pickleForVarSimplePyth2009(val):\n"
-    "  return cPickle.dumps(val,-1)\n"
+    "  return pickle.dumps(val,-1)\n"
     "\n";
 
 const char PythonNode::IMPL_NAME[]="Python";
 const char PythonNode::KIND[]="Python";
 
-const char PythonNode::SCRIPT_FOR_SERIALIZATION[]="import cPickle\n"
+const char PythonNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "def pickleForDistPyth2009(kws):\n"
-    "  return cPickle.dumps(((),kws),-1)\n"
+    "  return pickle.dumps(((),kws),-1)\n"
     "\n"
     "def unPickleForDistPyth2009(st):\n"
-    "  args=cPickle.loads(st)\n"
+    "  args=pickle.loads(st)\n"
     "  return args\n";
 
 const char PythonNode::REMOTE_NAME[]="remote";
 
 const char PythonNode::DPL_INFO_NAME[]="my_dpl_localization";
 
-const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import cPickle\n"
+const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "def pickleForDistPyth2009(*args,**kws):\n"
-    "  return cPickle.dumps((args,kws),-1)\n"
+    "  return pickle.dumps((args,kws),-1)\n"
     "\n"
     "def unPickleForDistPyth2009(st):\n"
-    "  args=cPickle.loads(st)\n"
+    "  args=pickle.loads(st)\n"
     "  return args\n";
 
 
@@ -423,7 +423,7 @@ void PythonNode::executeRemote()
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
       char *serializationInputC(0);
       Py_ssize_t len;
-      if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+      if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
       serializationInputCorba->length(len);
       for(int i=0; i < len ; i++)
@@ -475,7 +475,7 @@ void PythonNode::executeRemote()
   {
       AutoGIL agil;
       PyObject *args(0),*ob(0);
-      PyObject* resultPython=PyString_FromStringAndSize(resultCorbaC,resultCorba->length());
+      PyObject* resultPython=PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length());
       delete [] resultCorbaC;
       args = PyTuple_New(1);
       PyTuple_SetItem(args,0,resultPython);
@@ -572,7 +572,7 @@ void PythonNode::executeLocal()
     PyObject* code=Py_CompileString(_script.c_str(), stream.str().c_str(), Py_file_input);
     if(code == NULL)
       {
-        _errorDetails="";
+        _errorDetails=""; 
         PyObject* new_stderr = newPyStdOut(_errorDetails);
         PySys_SetObject((char*)"stderr", new_stderr);
         PyErr_Print();
@@ -580,7 +580,7 @@ void PythonNode::executeLocal()
         Py_DECREF(new_stderr);
         throw Exception("Error during execution");
       }
-    PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+    PyObject *res = PyEval_EvalCode(  code, _context, _context);
 
     Py_DECREF(code);
     Py_XDECREF(res);
@@ -736,7 +736,7 @@ void PythonNode::applyDPLScope(ComposedNode *gfn)
       {
         const std::pair<std::string,int>& p(ret[i]);
         PyObject *elt(PyTuple_New(2));
-        PyTuple_SetItem(elt,0,PyString_FromString(p.first.c_str()));
+        PyTuple_SetItem(elt,0,PyBytes_FromString(p.first.c_str()));
         PyTuple_SetItem(elt,1,PyLong_FromLong(p.second));
         PyList_SetItem(ob,i,elt);
       }
@@ -750,7 +750,7 @@ void PythonNode::applyDPLScope(ComposedNode *gfn)
         Py_XDECREF(ob);
         char *serializationInputC(0);
         Py_ssize_t len;
-        if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+        if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
           throw Exception("DistributedPythonNode problem in python pickle");
         serializationInputCorba->length(len);
         for(int i=0; i < len ; i++)
@@ -896,7 +896,7 @@ void PyFuncNode::loadLocal()
         Py_DECREF(new_stderr);
         throw Exception("Error during execution");
       }
-    PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+    PyObject *res = PyEval_EvalCode( code, _context, _context);
     Py_DECREF(code);
     Py_XDECREF(res);
 
@@ -980,7 +980,7 @@ void PyFuncNode::executeRemote()
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
       char *serializationInputC(0);
       Py_ssize_t len;
-      if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+      if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
 
       serializationInputCorba->length(len);
@@ -1018,7 +1018,7 @@ void PyFuncNode::executeRemote()
   {
       AutoGIL agil;
 
-      PyObject *resultPython(PyString_FromStringAndSize(resultCorbaC,resultCorba->length()));
+      PyObject *resultPython(PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length()));
       delete [] resultCorbaC;
       PyObject *args(PyTuple_New(1)),*ob(0);
       PyTuple_SetItem(args,0,resultPython);
index f9a218a5979f99dbdd31208774e8fae2f0d8027c..8de6f05e36047d4781a0350db5e28a2276883834 100644 (file)
@@ -38,9 +38,9 @@ void releasePyObj(PyObject* data)
   if (PyObject_HasAttrString(data, (char*)"_is_a"))
     {
       PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
-      if(result && PyInt_Check(result))
+      if(result && PyLong_Check(result))
         {
-          if(PyInt_AS_LONG(result))
+          if(PyLong_AS_LONG(result))
             {
               PyObject* o=PyObject_CallMethod(data, (char*)"Destroy", (char*)"");
               if(o)
@@ -74,9 +74,9 @@ void registerPyObj(PyObject* data)
   if (PyObject_HasAttrString(data, (char*)"_is_a"))
     {
       PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
-      if(result && PyInt_Check(result))
+      if(result && PyLong_Check(result))
         {
-          if(PyInt_AS_LONG(result))
+          if(PyLong_AS_LONG(result))
             {
               PyObject* o= PyObject_CallMethod(data, (char*)"Register", (char*)"") ;
               if(o)
@@ -198,7 +198,7 @@ std::string InputPyPort::getHumanRepr()
   if(!ret)
     return dump();
   std::string retCpp;
-  char *val(PyString_AsString(ret));
+  char *val(PyBytes_AsString(ret));
   if(val)
     retCpp=val;
   Py_XDECREF(ret);
@@ -262,11 +262,11 @@ std::string InputPyPort::dump()
 
 std::string InputPyPort::valToStr()
 {
-  int isString = PyString_Check(getPyObj());
+  int isString = PyBytes_Check(getPyObj());
   //DEBTRACE("isString=" << isString);
   PyObject *strPyObj = PyObject_Str(getPyObj());
   //DEBTRACE(PyString_Size(strPyObj));
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   if (isString)
     val = "\"" + val + "\"";
   //DEBTRACE(val);
@@ -361,7 +361,7 @@ std::string OutputPyPort::dump()
 std::string OutputPyPort::valToStr()
 {
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   Py_DECREF(strPyObj);
   return val;
 }
index 39b0b795fe7cf2f175b0838490e86c5566ceca76..cfabfd4796475f75022861af6347e90949dfd6df 100644 (file)
@@ -293,14 +293,26 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
           Py_InitializeEx(0); // do not install signal handlers
 #endif
           if (argc > 0 && argv != NULL)
-            PySys_SetArgv(argc, argv);
+            {
+              wchar_t **changed_argv = new wchar_t*[argc];
+              for (int i = 0; i < argc; i++)
+              {
+                changed_argv[i] = Py_DecodeLocale(argv[i], NULL);
+              }
+              PySys_SetArgv(argc, changed_argv);
+            } 
           else
             {
               int pyArgc = 1;
               char* pyArgv[1];
               char defaultName[] = "SALOME_YACS_RUNTIME";
+              wchar_t **changed_pyArgv = new wchar_t*[pyArgc];
               pyArgv[0] = defaultName;
-              PySys_SetArgv(pyArgc, pyArgv);
+              for (int i = 0; i < pyArgc; i++)
+              {
+                changed_pyArgv[i] = Py_DecodeLocale(pyArgv[i], NULL);
+              }
+              PySys_SetArgv(pyArgc, changed_pyArgv);
             }
           PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
           PyEval_SaveThread(); /* Release the thread state */
@@ -318,7 +330,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
   
       if (PyDict_GetItemString(globals, "__builtins__") == NULL) 
         {
-          PyObject *bimod = PyImport_ImportModule("__builtin__");
+          PyObject *bimod = PyImport_ImportModule("builtins");
           if (bimod == NULL || PyDict_SetItemString(globals, "__builtins__", bimod) != 0)
             Py_FatalError("can't add __builtins__ to __main__");
           Py_DECREF(bimod);
@@ -342,7 +354,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
             {
               goto out;
             }
-          _api = (omniORBpyAPI*)PyCObject_AsVoidPtr(pyapi);
+          _api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
           Py_DECREF(pyapi);
 
           res=PyRun_String("\n"
@@ -352,7 +364,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
                            "from omniORB import CORBA\n"
                            "from omniORB import any\n"
                            "orb = CORBA.ORB_init([], CORBA.ORB_ID)\n"
-                           "#print sys.getrefcount(orb)\n"
+                           "#print(sys.getrefcount(orb))\n"
                            "try:\n"
                            "  import SALOME\n"
                            "except:\n"
index 06515767dee92bd8749b4f74e4ba06a353896a48..b777a36a33ce72d88190a41330c989ea61b56334 100644 (file)
 
 #include <Python.h>
 #include <omniORB4/CORBA.h>
+#include <omniORBpy.h>
 #include "Runtime.hxx"
 
 #include<string>
 #include<set>
-
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBpyAPI
-{
-      PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                       CORBA::Boolean hold_lock);
-      // Convert a C++ object reference to a Python object reference.
-      // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-      CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-                                               CORBA::Boolean hold_lock);
-      // Convert a Python object reference to a C++ object reference.
-      // Raises BAD_PARAM if the Python object is not an object reference.
-      // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-      PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-      // Sets the Python exception state to reflect the given C++ system
-      // exception. Always returns NULL. The caller must hold the Python
-      // interpreter lock.
-};
-//--- end of from omniORBpy.h (not present on Debian Sarge packages)
       
 namespace YACS
 {
index ceb54864e80be69d5f156bcb6c2c68f5fe542018..6ea9787122c49c768b64d29a9608f074215c4e89 100644 (file)
@@ -72,7 +72,7 @@ void SalomePythonNode::load()
   cerr << "---------------SalomePythonNode::load function---------------" << endl;
   list<OutputPort *>::iterator iter;
   string value2Export=((SalomePythonComponent*)_component)->getStringValueToExportInInterp(this);
-  PyObject* ob=PyString_FromString(value2Export.c_str());
+  PyObject* ob=PyBytes_FromString(value2Export.c_str());
   PyDict_SetItemString(_context,PLACEMENT_VAR_NAME_IN_INTERP,ob);
   for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
     {
index 6b0a32f2529acffbf519d380006102a5e67754a3..0d9349030e2009b57714f0ae9268de87a99016c0 100644 (file)
@@ -24,6 +24,7 @@
 #include "TypeCode.hxx"
 #include "SalomeProc.hxx"
 
+#include "Basics_Utils.hxx"
 #include "SALOME_NamingService.hxx"
 #include "SALOME_KernelServices.hxx"
 #include "SALOMEDS.hh"
@@ -225,7 +226,7 @@ void StudyOutNode::execute()
   // save in file if ref is given
   if(_ref != "")
     {
-         KERNEL::getStudyServant()->SaveAs(_ref.c_str(), false, false);
+      KERNEL::getStudyServant()->SaveAs(Kernel_Utils::decode_s( _ref ), false, false);
     }
   DEBTRACE("+++++++ end StudyOutNode::execute +++++++++++" );
 }
index c498db26ce43bd8ea11285f9085a94ccbd74f063..027fa3da1945aceb1b4be3abfc91f3ae15a6ab30 100644 (file)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
@@ -127,4 +128,4 @@ INSTALL(TARGETS runtimeTestEchoSrv DESTINATION ${LOCAL_TEST_DIR})
 INSTALL(TARGETS echo_clt DESTINATION ${LOCAL_TEST_DIR})
 INSTALL(FILES CTestTestfileInstall.cmake
         DESTINATION ${LOCAL_TEST_DIR}
-        RENAME CTestTestfile.cmake)
\ No newline at end of file
+        RENAME CTestTestfile.cmake)
index c2ac9edfc7c13f5ec3f0f07492a4add0954e160e..3bd3ad6a4ece429473df88fe9466ac89991d8a82 100644 (file)
@@ -365,16 +365,16 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print 'node 13'\n"
+    ((InlineNode*) node)->setScript("print('node 13')\n"
                                      "import eo\n"
-                                     "print ob\n"
+                                     "print(ob)\n"
                                      "o=ob._narrow(eo.Obj)\n"
-                                     "print o\n"
-                                     "print o.echoLong(13)\n"
+                                     "print(o)\n"
+                                     "print(o.echoLong(13))\n"
                                      "a=dble+1\n"
                                      "dble=2*a\n"
-                                     "print lng\n"
-                                     "print '++++++++',s,'+++++++++++++'\n"
+                                     "print(lng)\n"
+                                     "print('++++++++',s,'+++++++++++++')\n"
                                      "ob=o\n"
                                      "seqstr=['aaa','bbb']\n"
                                      "seqobj=[o,o,o,o]\n"
@@ -413,12 +413,12 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print li\n"
-                                     "print 'lili=',lili\n"
-                                     "print 'lstr=',lstr\n"
-                                     "print 'lobj=',lobj\n"
-                                     "print 'llobj=',llobj\n"
-                                     "print 'objc=',objc\n"
+    ((InlineNode*) node)->setScript("print(li)\n"
+                                     "print('lili=',lili)\n"
+                                     "print('lstr=',lstr)\n"
+                                     "print('lobj=',lobj)\n"
+                                     "print('llobj=',llobj)\n"
+                                     "print('objc=',objc)\n"
                                      "li=2*li\n"
                                      );
     InputPort  *i1  = node->edAddInputPort("li",    _tc_seqdble);
@@ -447,12 +447,12 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print li\n"
+    ((InlineNode*) node)->setScript("print(li)\n"
                                      "li=[2*e for e in li]\n"
-                                     "print 'obj=',obj\n"
-                                     "print li\n"
-                                     "print lngvec\n"
-                                     "print dblevec\n"
+                                     "print('obj=',obj)\n"
+                                     "print(li)\n"
+                                     "print(lngvec)\n"
+                                     "print(dblevec)\n"
                                      );
     InputPort  *i1  = node->edAddInputPort("li",      _tc_seqdble);
     InputPort  *i2  = node->edAddInputPort("obj",     _tc_obj);
@@ -1155,7 +1155,6 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_10"])->load();
   ((ElementaryNode*)_nodeMap["Node_10"])->execute();
   //  CPPUNIT_ASSERT_DOUBLES_EQUAL(10.51, (ElementaryNode*)_nodeMap["Node_10"])
-
   DEBTRACE(" --- execution Python Node_11" );
   ((ElementaryNode*)_nodeMap["Node_11"])->load();
   ((ElementaryNode*)_nodeMap["Node_11"])->execute();
@@ -1240,6 +1239,7 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_15"])->load();
   ((ElementaryNode*)_nodeMap["Node_15"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution XML Node_36" );
   ((ElementaryNode*)_nodeMap["Node_36"])->load();
   ((ElementaryNode*)_nodeMap["Node_36"])->execute();
index 3929be57d45ce706fba11ff822649533b6e16499..b1914c7cbd174efcc91051a8cf027556ba79b325 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 data="""
 <methodCall>
@@ -31,13 +31,12 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print args
+  print(args)
   return args
 
-f=open("input")
-data=f.read()
-f.close()
-print data
+with open("input",'r') as f:
+  data=f.read()
+print(data)
 
 class Objref:
   """Wrapper for objrefs """
@@ -45,10 +44,32 @@ class Objref:
     self.data=data
   def __str__(self):
     return self.data or ""
-  def __cmp__(self, other):
+
+# __cmp__ is not defined in Python 3 : strict ordering
+  def __le__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data <= other
+  def __lt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data < other
+  def __ge__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data >= other
+  def __gt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data > other
+  def __eq__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data == other
+  def __ne__(self, other):
     if isinstance(other, Binary):
       other = other.data
-    return cmp(self.data, other)
+    return self.data != other
 
   def decode(self, data):
     self.data = data
@@ -58,28 +79,27 @@ class Objref:
     out.write(self.data or "")
     out.write("</objref></value>\n")
 
-xmlrpclib.WRAPPERS=xmlrpclib.WRAPPERS+(Objref,)
+xmlrpc.client.WRAPPERS=xmlrpc.client.WRAPPERS+(Objref,)
 
 def end_objref(self,data):
   self.append(Objref(data))
   self._value=0
 
-xmlrpclib.Unmarshaller.end_objref=end_objref
-xmlrpclib.Unmarshaller.dispatch["objref"]=end_objref
+xmlrpc.client.Unmarshaller.end_objref=end_objref
+xmlrpc.client.Unmarshaller.dispatch["objref"]=end_objref
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
-   call=eval(method)
-   response=call(params)
-   response = (response,)
+  call=eval(method)
+  response=call(params)
+  response = (response,)
 except:
-   # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+  # report exception back to server
+  response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+  response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
-f=open("output",'w')
-f.write(response)
-f.close()
+print(response)
+with open("output",'w') as f:
+  f.write(response)
index 2134240b340044261e7c6ac3e2f9f94e1fc4dc01..895508f8f4c3f625151ed076f00e7c245ad9237a 100644 (file)
@@ -695,8 +695,6 @@ namespace YACS
           double x;
           if (PyFloat_Check(o))
             x=PyFloat_AS_DOUBLE(o);
-          else if (PyInt_Check(o))
-            x=PyInt_AS_LONG(o);
           else if(PyLong_Check(o))
             x=PyLong_AsLong(o);
           else
@@ -718,9 +716,7 @@ namespace YACS
       static inline long convert(const TypeCode *t,PyObject* o,void*)
         {
           long l;
-          if (PyInt_Check(o))
-            l=PyInt_AS_LONG(o);
-          else if(PyLong_Check(o))
+          if(PyLong_Check(o))
             l=PyLong_AsLong(o);
           else
             {
@@ -741,8 +737,14 @@ namespace YACS
       static inline std::string convert(const TypeCode *t,PyObject* o,void*)
         {
           std::string s;
-          if (PyString_Check(o))
-            s= PyString_AS_STRING(o);
+          if (PyUnicode_Check(o))
+            {
+              Py_ssize_t size;
+              char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
+              if (!ptr)
+                throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
+              s.assign(ptr, size);
+            }
           else
             {
               stringstream msg;
@@ -764,8 +766,6 @@ namespace YACS
           bool l;
           if (PyBool_Check(o))
               l=(o==Py_True);
-          else if (PyInt_Check(o))
-              l=(PyInt_AS_LONG(o)!=0);
           else if(PyLong_Check(o))
               l=(PyLong_AsLong(o)!=0);
           else
@@ -786,24 +786,30 @@ namespace YACS
     {
       static inline std::string convert(const TypeCode *t,PyObject* o,void*,int protocol)
         {
-          if (PyString_Check(o) && strncmp(t->id(),"python",6)!=0)
+          if (PyUnicode_Check(o) && strncmp(t->id(),"python",6)!=0)
             {
               // the objref is used by Python as a string (prefix:value) keep it as a string
-              return PyString_AS_STRING(o);
+              Py_ssize_t size;
+              std::string s;
+              char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
+              if (!ptr)
+                throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
+              s.assign(ptr, size);
+              return s;
             }
           if(strncmp(t->id(),"python",6)==0)
             {
               // It's a native Python object pickle it
-              PyObject* mod=PyImport_ImportModule("cPickle");
+              PyObject* mod=PyImport_ImportModule("pickle");
               PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",o,protocol);
-              DEBTRACE(PyObject_REPR(pickled) );
+              DEBTRACE(PyObject_Repr(pickled) );
               Py_DECREF(mod);
               if(pickled==NULL)
                 {
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr(PyString_AsString(pickled),PyString_Size(pickled));
+              std::string mystr(PyBytes_AsString(pickled),PyBytes_Size(pickled));
               Py_DECREF(pickled);
               return mystr;
             }
@@ -823,7 +829,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr=PyString_AsString(pickled);
+              std::string mystr=PyBytes_AsString(pickled);
               Py_DECREF(pickled);
               return mystr;
             }
@@ -836,7 +842,12 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr=PyString_AsString(pystring);
+              Py_ssize_t size;
+              std::string mystr;
+              char *ptr = PyUnicode_AsUTF8AndSize(pystring, &size);
+              if (!ptr)
+                throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
+              mystr.assign(ptr, size);
               Py_DECREF(pystring);
               return mystr;
             }
@@ -954,7 +965,7 @@ namespace YACS
     {
       static inline PyObject* convert(const TypeCode *t,std::string& o)
         {
-          return PyString_FromString(o.c_str());
+          return PyUnicode_FromString(o.c_str());
         }
     };
     template <>
@@ -978,14 +989,14 @@ namespace YACS
           if(t->isA(Runtime::_tc_file))
             {
               //It's an objref file. Convert it specially
-              return PyString_FromString(o.c_str());
+              return PyUnicode_FromString(o.c_str());
             }
-          if(strncmp(t->id(),"python",6)==0)
+          if(strncmp(t->id(),"python",6)==0) //ex: "python:obj:1.0"
             {
               //It's a python pickled object, unpickled it
-              PyObject* mod=PyImport_ImportModule("cPickle");
-              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",o.c_str(),o.length());
-              DEBTRACE(PyObject_REPR(ob));
+              PyObject* mod=PyImport_ImportModule("pickle");
+              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"y#",o.c_str(),o.length());
+              DEBTRACE(PyObject_Repr(ob));
               Py_DECREF(mod);
               if(ob==NULL)
                 {
@@ -1003,7 +1014,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl: no simplejson module");
                 }
-              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s",o.c_str());
+              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"y",o.c_str());
               Py_DECREF(mod);
               if(ob==NULL)
                 {
@@ -1864,11 +1875,11 @@ namespace YACS
                     }
 
                   PyGILState_STATE gstate = PyGILState_Ensure(); 
-                  PyObject* mod=PyImport_ImportModule("cPickle");
-                  PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",s,buffer->length());
+                  PyObject* mod=PyImport_ImportModule("pickle");
+                  PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"y#",s,buffer->length());
                   PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",ob,protocol);
-                  DEBTRACE(PyObject_REPR(pickled));
-                  std::string mystr=PyString_AsString(pickled);
+                  DEBTRACE(PyObject_Repr(pickled));
+                  std::string mystr=PyBytes_AsString(pickled);
                   Py_DECREF(mod);
                   Py_DECREF(ob);
                   Py_DECREF(pickled);
@@ -2290,8 +2301,11 @@ namespace YACS
     {
       PyObject *s;
       PyGILState_STATE gstate = PyGILState_Ensure(); 
-      s=PyObject_Str(ob);
-      std::string ss(PyString_AsString(s),PyString_Size(s));
+      //s=PyObject_Repr(ob);
+      s=PyObject_ASCII(ob);
+      Py_ssize_t size;
+      char* characters=PyUnicode_AsUTF8AndSize(s, &size);
+      std::string ss( characters, size);
       Py_DECREF(s);
       PyGILState_Release(gstate);
       return ss;
@@ -2493,8 +2507,6 @@ namespace YACS
       {
         if (PyFloat_Check(o))
           return true;
-        else if (PyInt_Check(o))
-          return true;
         else if(PyLong_Check(o))
           return true;
         else
@@ -2507,7 +2519,7 @@ namespace YACS
     template<>
     inline bool checkInt<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyInt_Check(o) || PyLong_Check(o))
+          if (PyLong_Check(o))
             return true;
           else
             {
@@ -2521,8 +2533,6 @@ namespace YACS
       {
           if (PyBool_Check(o))
               return true;
-          else if (PyInt_Check(o))
-              return true;
           else if(PyLong_Check(o))
               return true;
           else
@@ -2536,7 +2546,7 @@ namespace YACS
     template<>
     inline bool checkString<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyString_Check(o))
+          if (PyUnicode_Check(o))
             return true;
           else
             {
@@ -2548,7 +2558,7 @@ namespace YACS
     template<>
     inline bool checkObjref<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyString_Check(o))
+          if (PyUnicode_Check(o))
             return true;
           if(strncmp(t->id(),"python",6)==0) // a Python object is expected (it's always true)
             return true;
index fe030312dd1994036b2b8e44f726008924926073..7fc3dc1eb8a8e2b788955e908c5aa76354473f18 100644 (file)
 #include <libxml/parser.h>
 #include <string>
 
+#if PY_VERSION_HEX < 0x03050000
+static char*
+Py_EncodeLocale(const wchar_t *arg, size_t *size)
+{
+       return _Py_wchar2char(arg, size);
+}
+static wchar_t*
+Py_DecodeLocale(const char *arg, size_t *size)
+{
+       return _Py_char2wchar(arg, size);
+}
+#endif
+
 namespace YACS
 {
   namespace ENGINE
index 27e3d41fb2bf9e772b0586ca0a7c74b97c3043bb..c5d9f59cf1ad93f39cb4597552aa6204fc5ea96b 100644 (file)
@@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(
   ${SALOME_INCL_PATH}
   ${PTHREAD_INCLUDE_DIRS}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
index 1de04b0af039bae26b4f74cdd798289fd3859c72..95103b3a29388bbe1ae3afae97fc7eb433fc58ab 100644 (file)
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 %}
 
index 70be1f0f19087efa1ea4cfb7459fa27d619c018c..72d2d79bfbfa62d71f6e05bb7365b59b4c23f7ea 100644 (file)
@@ -25,8 +25,6 @@ ENDIF()
 
 SET(salomeloader_PYTHON
   salomeloader.py
-  ElementTree.py
-  ElementPath.py
   graph.py
   )
 
diff --git a/src/salomeloader/ElementPath.py b/src/salomeloader/ElementPath.py
deleted file mode 100644 (file)
index 8d8d28d..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# ElementTree
-# $Id$
-#
-# limited xpath support for element trees
-#
-# history:
-# 2003-05-23 fl   created
-# 2003-05-28 fl   added support for // etc
-# 2003-08-27 fl   fixed parsing of periods in element names
-#
-# Copyright (c) 2003-2004 by Fredrik Lundh.  All rights reserved.
-#
-# fredrik@pythonware.com
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# The ElementTree toolkit is
-#
-# Copyright (c) 1999-2004 by Fredrik Lundh
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of
-# Secret Labs AB or the author not be used in advertising or publicity
-# pertaining to distribution of the software without specific, written
-# prior permission.
-#
-# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
-# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
-# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-# --------------------------------------------------------------------
-
-##
-# Implementation module for XPath support.  There's usually no reason
-# to import this module directly; the <b>ElementTree</b> does this for
-# you, if needed.
-##
-
-import re
-
-xpath_tokenizer = re.compile(
-    "(::|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/:\[\]\(\)@=\s]+)|\s+"
-    ).findall
-
-class xpath_descendant_or_self:
-    pass
-
-##
-# Wrapper for a compiled XPath.
-
-class Path:
-
-    ##
-    # Create an Path instance from an XPath expression.
-
-    def __init__(self, path):
-        tokens = xpath_tokenizer(path)
-        # the current version supports 'path/path'-style expressions only
-        self.path = []
-        self.tag = None
-        if tokens and tokens[0][0] == "/":
-            raise SyntaxError("cannot use absolute path on element")
-        while tokens:
-            op, tag = tokens.pop(0)
-            if tag or op == "*":
-                self.path.append(tag or op)
-            elif op == ".":
-                pass
-            elif op == "/":
-                self.path.append(xpath_descendant_or_self())
-                continue
-            else:
-                raise SyntaxError("unsupported path syntax (%s)" % op)
-            if tokens:
-                op, tag = tokens.pop(0)
-                if op != "/":
-                    raise SyntaxError(
-                        "expected path separator (%s)" % (op or tag)
-                        )
-        if self.path and isinstance(self.path[-1], xpath_descendant_or_self):
-            raise SyntaxError("path cannot end with //")
-        if len(self.path) == 1 and isinstance(self.path[0], type("")):
-            self.tag = self.path[0]
-
-    ##
-    # Find first matching object.
-
-    def find(self, element):
-        tag = self.tag
-        if tag is None:
-            nodeset = self.findall(element)
-            if not nodeset:
-                return None
-            return nodeset[0]
-        for elem in element:
-            if elem.tag == tag:
-                return elem
-        return None
-
-    ##
-    # Find text for first matching object.
-
-    def findtext(self, element, default=None):
-        tag = self.tag
-        if tag is None:
-            nodeset = self.findall(element)
-            if not nodeset:
-                return default
-            return nodeset[0].text or ""
-        for elem in element:
-            if elem.tag == tag:
-                return elem.text or ""
-        return default
-
-    ##
-    # Find all matching objects.
-
-    def findall(self, element):
-        nodeset = [element]
-        index = 0
-        while 1:
-            try:
-                path = self.path[index]
-                index = index + 1
-            except IndexError:
-                return nodeset
-            set = []
-            if isinstance(path, xpath_descendant_or_self):
-                try:
-                    tag = self.path[index]
-                    if not isinstance(tag, type("")):
-                        tag = None
-                    else:
-                        index = index + 1
-                except IndexError:
-                    tag = None # invalid path
-                for node in nodeset:
-                    new = list(node.getiterator(tag))
-                    if new and new[0] is node:
-                        set.extend(new[1:])
-                    else:
-                        set.extend(new)
-            else:
-                for node in nodeset:
-                    for node in node:
-                        if path == "*" or node.tag == path:
-                            set.append(node)
-            if not set:
-                return []
-            nodeset = set
-
-_cache = {}
-
-##
-# (Internal) Compile path.
-
-def _compile(path):
-    p = _cache.get(path)
-    if p is not None:
-        return p
-    p = Path(path)
-    if len(_cache) >= 100:
-        _cache.clear()
-    _cache[path] = p
-    return p
-
-##
-# Find first matching object.
-
-def find(element, path):
-    return _compile(path).find(element)
-
-##
-# Find text for first matching object.
-
-def findtext(element, path, default=None):
-    return _compile(path).findtext(element, default)
-
-##
-# Find all matching objects.
-
-def findall(element, path):
-    return _compile(path).findall(element)
-
diff --git a/src/salomeloader/ElementTree.py b/src/salomeloader/ElementTree.py
deleted file mode 100644 (file)
index 8ea3c79..0000000
+++ /dev/null
@@ -1,1254 +0,0 @@
-#
-# ElementTree
-# $Id$
-#
-# light-weight XML support for Python 1.5.2 and later.
-#
-# history:
-# 2001-10-20 fl   created (from various sources)
-# 2001-11-01 fl   return root from parse method
-# 2002-02-16 fl   sort attributes in lexical order
-# 2002-04-06 fl   TreeBuilder refactoring, added PythonDoc markup
-# 2002-05-01 fl   finished TreeBuilder refactoring
-# 2002-07-14 fl   added basic namespace support to ElementTree.write
-# 2002-07-25 fl   added QName attribute support
-# 2002-10-20 fl   fixed encoding in write
-# 2002-11-24 fl   changed default encoding to ascii; fixed attribute encoding
-# 2002-11-27 fl   accept file objects or file names for parse/write
-# 2002-12-04 fl   moved XMLTreeBuilder back to this module
-# 2003-01-11 fl   fixed entity encoding glitch for us-ascii
-# 2003-02-13 fl   added XML literal factory
-# 2003-02-21 fl   added ProcessingInstruction/PI factory
-# 2003-05-11 fl   added tostring/fromstring helpers
-# 2003-05-26 fl   added ElementPath support
-# 2003-07-05 fl   added makeelement factory method
-# 2003-07-28 fl   added more well-known namespace prefixes
-# 2003-08-15 fl   fixed typo in ElementTree.findtext (Thomas Dartsch)
-# 2003-09-04 fl   fall back on emulator if ElementPath is not installed
-# 2003-10-31 fl   markup updates
-# 2003-11-15 fl   fixed nested namespace bug
-# 2004-03-28 fl   added XMLID helper
-# 2004-06-02 fl   added default support to findtext
-# 2004-06-08 fl   fixed encoding of non-ascii element/attribute names
-# 2004-08-23 fl   take advantage of post-2.1 expat features
-# 2005-02-01 fl   added iterparse implementation
-# 2005-03-02 fl   fixed iterparse support for pre-2.2 versions
-#
-# Copyright (c) 1999-2005 by Fredrik Lundh.  All rights reserved.
-#
-# fredrik@pythonware.com
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# The ElementTree toolkit is
-#
-# Copyright (c) 1999-2005 by Fredrik Lundh
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of
-# Secret Labs AB or the author not be used in advertising or publicity
-# pertaining to distribution of the software without specific, written
-# prior permission.
-#
-# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
-# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
-# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-# --------------------------------------------------------------------
-
-__all__ = [
-    # public symbols
-    "Comment",
-    "dump",
-    "Element", "ElementTree",
-    "fromstring",
-    "iselement", "iterparse",
-    "parse",
-    "PI", "ProcessingInstruction",
-    "QName",
-    "SubElement",
-    "tostring",
-    "TreeBuilder",
-    "VERSION", "XML",
-    "XMLTreeBuilder",
-    ]
-
-##
-# The <b>Element</b> type is a flexible container object, designed to
-# store hierarchical data structures in memory. The type can be
-# described as a cross between a list and a dictionary.
-# <p>
-# Each element has a number of properties associated with it:
-# <ul>
-# <li>a <i>tag</i>. This is a string identifying what kind of data
-# this element represents (the element type, in other words).</li>
-# <li>a number of <i>attributes</i>, stored in a Python dictionary.</li>
-# <li>a <i>text</i> string.</li>
-# <li>an optional <i>tail</i> string.</li>
-# <li>a number of <i>child elements</i>, stored in a Python sequence</li>
-# </ul>
-#
-# To create an element instance, use the {@link #Element} or {@link
-# #SubElement} factory functions.
-# <p>
-# The {@link #ElementTree} class can be used to wrap an element
-# structure, and convert it from and to XML.
-##
-
-import string, sys, re
-
-class _SimpleElementPath:
-    # emulate pre-1.2 find/findtext/findall behaviour
-    def find(self, element, tag):
-        for elem in element:
-            if elem.tag == tag:
-                return elem
-        return None
-    def findtext(self, element, tag, default=None):
-        for elem in element:
-            if elem.tag == tag:
-                return elem.text or ""
-        return default
-    def findall(self, element, tag):
-        if tag[:3] == ".//":
-            return element.getiterator(tag[3:])
-        result = []
-        for elem in element:
-            if elem.tag == tag:
-                result.append(elem)
-        return result
-
-try:
-    import ElementPath
-except ImportError:
-    # FIXME: issue warning in this case?
-    ElementPath = _SimpleElementPath()
-
-# TODO: add support for custom namespace resolvers/default namespaces
-# TODO: add improved support for incremental parsing
-
-VERSION = "1.2.6"
-
-##
-# Internal element class.  This class defines the Element interface,
-# and provides a reference implementation of this interface.
-# <p>
-# You should not create instances of this class directly.  Use the
-# appropriate factory functions instead, such as {@link #Element}
-# and {@link #SubElement}.
-#
-# @see Element
-# @see SubElement
-# @see Comment
-# @see ProcessingInstruction
-
-class _ElementInterface:
-    # <tag attrib>text<child/>...</tag>tail
-
-    ##
-    # (Attribute) Element tag.
-
-    tag = None
-
-    ##
-    # (Attribute) Element attribute dictionary.  Where possible, use
-    # {@link #_ElementInterface.get},
-    # {@link #_ElementInterface.set},
-    # {@link #_ElementInterface.keys}, and
-    # {@link #_ElementInterface.items} to access
-    # element attributes.
-
-    attrib = None
-
-    ##
-    # (Attribute) Text before first subelement.  This is either a
-    # string or the value None, if there was no text.
-
-    text = None
-
-    ##
-    # (Attribute) Text after this element's end tag, but before the
-    # next sibling element's start tag.  This is either a string or
-    # the value None, if there was no text.
-
-    tail = None # text after end tag, if any
-
-    def __init__(self, tag, attrib):
-        self.tag = tag
-        self.attrib = attrib
-        self._children = []
-
-    def __repr__(self):
-        return "<Element %s at %x>" % (self.tag, id(self))
-
-    ##
-    # Creates a new element object of the same type as this element.
-    #
-    # @param tag Element tag.
-    # @param attrib Element attributes, given as a dictionary.
-    # @return A new element instance.
-
-    def makeelement(self, tag, attrib):
-        return Element(tag, attrib)
-
-    ##
-    # Returns the number of subelements.
-    #
-    # @return The number of subelements.
-
-    def __len__(self):
-        return len(self._children)
-
-    ##
-    # Returns the given subelement.
-    #
-    # @param index What subelement to return.
-    # @return The given subelement.
-    # @exception IndexError If the given element does not exist.
-
-    def __getitem__(self, index):
-        return self._children[index]
-
-    ##
-    # Replaces the given subelement.
-    #
-    # @param index What subelement to replace.
-    # @param element The new element value.
-    # @exception IndexError If the given element does not exist.
-    # @exception AssertionError If element is not a valid object.
-
-    def __setitem__(self, index, element):
-        assert iselement(element)
-        self._children[index] = element
-
-    ##
-    # Deletes the given subelement.
-    #
-    # @param index What subelement to delete.
-    # @exception IndexError If the given element does not exist.
-
-    def __delitem__(self, index):
-        del self._children[index]
-
-    ##
-    # Returns a list containing subelements in the given range.
-    #
-    # @param start The first subelement to return.
-    # @param stop The first subelement that shouldn't be returned.
-    # @return A sequence object containing subelements.
-
-    def __getslice__(self, start, stop):
-        return self._children[start:stop]
-
-    ##
-    # Replaces a number of subelements with elements from a sequence.
-    #
-    # @param start The first subelement to replace.
-    # @param stop The first subelement that shouldn't be replaced.
-    # @param elements A sequence object with zero or more elements.
-    # @exception AssertionError If a sequence member is not a valid object.
-
-    def __setslice__(self, start, stop, elements):
-        for element in elements:
-            assert iselement(element)
-        self._children[start:stop] = list(elements)
-
-    ##
-    # Deletes a number of subelements.
-    #
-    # @param start The first subelement to delete.
-    # @param stop The first subelement to leave in there.
-
-    def __delslice__(self, start, stop):
-        del self._children[start:stop]
-
-    ##
-    # Adds a subelement to the end of this element.
-    #
-    # @param element The element to add.
-    # @exception AssertionError If a sequence member is not a valid object.
-
-    def append(self, element):
-        assert iselement(element)
-        self._children.append(element)
-
-    ##
-    # Inserts a subelement at the given position in this element.
-    #
-    # @param index Where to insert the new subelement.
-    # @exception AssertionError If the element is not a valid object.
-
-    def insert(self, index, element):
-        assert iselement(element)
-        self._children.insert(index, element)
-
-    ##
-    # Removes a matching subelement.  Unlike the <b>find</b> methods,
-    # this method compares elements based on identity, not on tag
-    # value or contents.
-    #
-    # @param element What element to remove.
-    # @exception ValueError If a matching element could not be found.
-    # @exception AssertionError If the element is not a valid object.
-
-    def remove(self, element):
-        assert iselement(element)
-        self._children.remove(element)
-
-    ##
-    # Returns all subelements.  The elements are returned in document
-    # order.
-    #
-    # @return A list of subelements.
-    # @defreturn list of Element instances
-
-    def getchildren(self):
-        return self._children
-
-    ##
-    # Finds the first matching subelement, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @return The first matching element, or None if no element was found.
-    # @defreturn Element or None
-
-    def find(self, path):
-        return ElementPath.find(self, path)
-
-    ##
-    # Finds text for the first matching subelement, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @param default What to return if the element was not found.
-    # @return The text content of the first matching element, or the
-    #     default value no element was found.  Note that if the element
-    #     has is found, but has no text content, this method returns an
-    #     empty string.
-    # @defreturn string
-
-    def findtext(self, path, default=None):
-        return ElementPath.findtext(self, path, default)
-
-    ##
-    # Finds all matching subelements, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @return A list or iterator containing all matching elements,
-    #    in document order.
-    # @defreturn list of Element instances
-
-    def findall(self, path):
-        return ElementPath.findall(self, path)
-
-    ##
-    # Resets an element.  This function removes all subelements, clears
-    # all attributes, and sets the text and tail attributes to None.
-
-    def clear(self):
-        self.attrib.clear()
-        self._children = []
-        self.text = self.tail = None
-
-    ##
-    # Gets an element attribute.
-    #
-    # @param key What attribute to look for.
-    # @param default What to return if the attribute was not found.
-    # @return The attribute value, or the default value, if the
-    #     attribute was not found.
-    # @defreturn string or None
-
-    def get(self, key, default=None):
-        return self.attrib.get(key, default)
-
-    ##
-    # Sets an element attribute.
-    #
-    # @param key What attribute to set.
-    # @param value The attribute value.
-
-    def set(self, key, value):
-        self.attrib[key] = value
-
-    ##
-    # Gets a list of attribute names.  The names are returned in an
-    # arbitrary order (just like for an ordinary Python dictionary).
-    #
-    # @return A list of element attribute names.
-    # @defreturn list of strings
-
-    def keys(self):
-        return self.attrib.keys()
-
-    ##
-    # Gets element attributes, as a sequence.  The attributes are
-    # returned in an arbitrary order.
-    #
-    # @return A list of (name, value) tuples for all attributes.
-    # @defreturn list of (string, string) tuples
-
-    def items(self):
-        return self.attrib.items()
-
-    ##
-    # Creates a tree iterator.  The iterator loops over this element
-    # and all subelements, in document order, and returns all elements
-    # with a matching tag.
-    # <p>
-    # If the tree structure is modified during iteration, the result
-    # is undefined.
-    #
-    # @param tag What tags to look for (default is to return all elements).
-    # @return A list or iterator containing all the matching elements.
-    # @defreturn list or iterator
-
-    def getiterator(self, tag=None):
-        nodes = []
-        if tag == "*":
-            tag = None
-        if tag is None or self.tag == tag:
-            nodes.append(self)
-        for node in self._children:
-            nodes.extend(node.getiterator(tag))
-        return nodes
-
-# compatibility
-_Element = _ElementInterface
-
-##
-# Element factory.  This function returns an object implementing the
-# standard Element interface.  The exact class or type of that object
-# is implementation dependent, but it will always be compatible with
-# the {@link #_ElementInterface} class in this module.
-# <p>
-# The element name, attribute names, and attribute values can be
-# either 8-bit ASCII strings or Unicode strings.
-#
-# @param tag The element name.
-# @param attrib An optional dictionary, containing element attributes.
-# @param **extra Additional attributes, given as keyword arguments.
-# @return An element instance.
-# @defreturn Element
-
-def Element(tag, attrib={}, **extra):
-    attrib = attrib.copy()
-    attrib.update(extra)
-    return _ElementInterface(tag, attrib)
-
-##
-# Subelement factory.  This function creates an element instance, and
-# appends it to an existing element.
-# <p>
-# The element name, attribute names, and attribute values can be
-# either 8-bit ASCII strings or Unicode strings.
-#
-# @param parent The parent element.
-# @param tag The subelement name.
-# @param attrib An optional dictionary, containing element attributes.
-# @param **extra Additional attributes, given as keyword arguments.
-# @return An element instance.
-# @defreturn Element
-
-def SubElement(parent, tag, attrib={}, **extra):
-    attrib = attrib.copy()
-    attrib.update(extra)
-    element = parent.makeelement(tag, attrib)
-    parent.append(element)
-    return element
-
-##
-# Comment element factory.  This factory function creates a special
-# element that will be serialized as an XML comment.
-# <p>
-# The comment string can be either an 8-bit ASCII string or a Unicode
-# string.
-#
-# @param text A string containing the comment string.
-# @return An element instance, representing a comment.
-# @defreturn Element
-
-def Comment(text=None):
-    element = Element(Comment)
-    element.text = text
-    return element
-
-##
-# PI element factory.  This factory function creates a special element
-# that will be serialized as an XML processing instruction.
-#
-# @param target A string containing the PI target.
-# @param text A string containing the PI contents, if any.
-# @return An element instance, representing a PI.
-# @defreturn Element
-
-def ProcessingInstruction(target, text=None):
-    element = Element(ProcessingInstruction)
-    element.text = target
-    if text:
-        element.text = element.text + " " + text
-    return element
-
-PI = ProcessingInstruction
-
-##
-# QName wrapper.  This can be used to wrap a QName attribute value, in
-# order to get proper namespace handling on output.
-#
-# @param text A string containing the QName value, in the form {uri}local,
-#     or, if the tag argument is given, the URI part of a QName.
-# @param tag Optional tag.  If given, the first argument is interpreted as
-#     an URI, and this argument is interpreted as a local name.
-# @return An opaque object, representing the QName.
-
-class QName:
-    def __init__(self, text_or_uri, tag=None):
-        if tag:
-            text_or_uri = "{%s}%s" % (text_or_uri, tag)
-        self.text = text_or_uri
-    def __str__(self):
-        return self.text
-    def __hash__(self):
-        return hash(self.text)
-    def __cmp__(self, other):
-        if isinstance(other, QName):
-            return cmp(self.text, other.text)
-        return cmp(self.text, other)
-
-##
-# ElementTree wrapper class.  This class represents an entire element
-# hierarchy, and adds some extra support for serialization to and from
-# standard XML.
-#
-# @param element Optional root element.
-# @keyparam file Optional file handle or name.  If given, the
-#     tree is initialized with the contents of this XML file.
-
-class ElementTree:
-
-    def __init__(self, element=None, file=None):
-        assert element is None or iselement(element)
-        self._root = element # first node
-        if file:
-            self.parse(file)
-
-    ##
-    # Gets the root element for this tree.
-    #
-    # @return An element instance.
-    # @defreturn Element
-
-    def getroot(self):
-        return self._root
-
-    ##
-    # Replaces the root element for this tree.  This discards the
-    # current contents of the tree, and replaces it with the given
-    # element.  Use with care.
-    #
-    # @param element An element instance.
-
-    def _setroot(self, element):
-        assert iselement(element)
-        self._root = element
-
-    ##
-    # Loads an external XML document into this element tree.
-    #
-    # @param source A file name or file object.
-    # @param parser An optional parser instance.  If not given, the
-    #     standard {@link XMLTreeBuilder} parser is used.
-    # @return The document root element.
-    # @defreturn Element
-
-    def parse(self, source, parser=None):
-        if not hasattr(source, "read"):
-            source = open(source, "rb")
-        if not parser:
-            parser = XMLTreeBuilder()
-        while 1:
-            data = source.read(32768)
-            if not data:
-                break
-            parser.feed(data)
-        self._root = parser.close()
-        return self._root
-
-    ##
-    # Creates a tree iterator for the root element.  The iterator loops
-    # over all elements in this tree, in document order.
-    #
-    # @param tag What tags to look for (default is to return all elements)
-    # @return An iterator.
-    # @defreturn iterator
-
-    def getiterator(self, tag=None):
-        assert self._root is not None
-        return self._root.getiterator(tag)
-
-    ##
-    # Finds the first toplevel element with given tag.
-    # Same as getroot().find(path).
-    #
-    # @param path What element to look for.
-    # @return The first matching element, or None if no element was found.
-    # @defreturn Element or None
-
-    def find(self, path):
-        assert self._root is not None
-        if path[:1] == "/":
-            path = "." + path
-        return self._root.find(path)
-
-    ##
-    # Finds the element text for the first toplevel element with given
-    # tag.  Same as getroot().findtext(path).
-    #
-    # @param path What toplevel element to look for.
-    # @param default What to return if the element was not found.
-    # @return The text content of the first matching element, or the
-    #     default value no element was found.  Note that if the element
-    #     has is found, but has no text content, this method returns an
-    #     empty string.
-    # @defreturn string
-
-    def findtext(self, path, default=None):
-        assert self._root is not None
-        if path[:1] == "/":
-            path = "." + path
-        return self._root.findtext(path, default)
-
-    ##
-    # Finds all toplevel elements with the given tag.
-    # Same as getroot().findall(path).
-    #
-    # @param path What element to look for.
-    # @return A list or iterator containing all matching elements,
-    #    in document order.
-    # @defreturn list of Element instances
-
-    def findall(self, path):
-        assert self._root is not None
-        if path[:1] == "/":
-            path = "." + path
-        return self._root.findall(path)
-
-    ##
-    # Writes the element tree to a file, as XML.
-    #
-    # @param file A file name, or a file object opened for writing.
-    # @param encoding Optional output encoding (default is US-ASCII).
-
-    def write(self, file, encoding="us-ascii"):
-        assert self._root is not None
-        if not hasattr(file, "write"):
-            file = open(file, "wb")
-        if not encoding:
-            encoding = "us-ascii"
-        elif encoding != "utf-8" and encoding != "us-ascii":
-            file.write("<?xml version='1.0' encoding='%s'?>\n" % encoding)
-        self._write(file, self._root, encoding, {})
-
-    def _write(self, file, node, encoding, namespaces):
-        # write XML to file
-        tag = node.tag
-        if tag is Comment:
-            file.write("<!-- %s -->" % _escape_cdata(node.text, encoding))
-        elif tag is ProcessingInstruction:
-            file.write("<?%s?>" % _escape_cdata(node.text, encoding))
-        else:
-            items = node.items()
-            xmlns_items = [] # new namespaces in this scope
-            try:
-                if isinstance(tag, QName) or tag[:1] == "{":
-                    tag, xmlns = fixtag(tag, namespaces)
-                    if xmlns: xmlns_items.append(xmlns)
-            except TypeError:
-                _raise_serialization_error(tag)
-            file.write("<" + _encode(tag, encoding))
-            if items or xmlns_items:
-                items.sort() # lexical order
-                for k, v in items:
-                    try:
-                        if isinstance(k, QName) or k[:1] == "{":
-                            k, xmlns = fixtag(k, namespaces)
-                            if xmlns: xmlns_items.append(xmlns)
-                    except TypeError:
-                        _raise_serialization_error(k)
-                    try:
-                        if isinstance(v, QName):
-                            v, xmlns = fixtag(v, namespaces)
-                            if xmlns: xmlns_items.append(xmlns)
-                    except TypeError:
-                        _raise_serialization_error(v)
-                    file.write(" %s=\"%s\"" % (_encode(k, encoding),
-                                               _escape_attrib(v, encoding)))
-                for k, v in xmlns_items:
-                    file.write(" %s=\"%s\"" % (_encode(k, encoding),
-                                               _escape_attrib(v, encoding)))
-            if node.text or len(node):
-                file.write(">")
-                if node.text:
-                    file.write(_escape_cdata(node.text, encoding))
-                for n in node:
-                    self._write(file, n, encoding, namespaces)
-                file.write("</" + _encode(tag, encoding) + ">")
-            else:
-                file.write(" />")
-            for k, v in xmlns_items:
-                del namespaces[v]
-        if node.tail:
-            file.write(_escape_cdata(node.tail, encoding))
-
-# --------------------------------------------------------------------
-# helpers
-
-##
-# Checks if an object appears to be a valid element object.
-#
-# @param An element instance.
-# @return A true value if this is an element object.
-# @defreturn flag
-
-def iselement(element):
-    # FIXME: not sure about this; might be a better idea to look
-    # for tag/attrib/text attributes
-    return isinstance(element, _ElementInterface) or hasattr(element, "tag")
-
-##
-# Writes an element tree or element structure to sys.stdout.  This
-# function should be used for debugging only.
-# <p>
-# The exact output format is implementation dependent.  In this
-# version, it's written as an ordinary XML file.
-#
-# @param elem An element tree or an individual element.
-
-def dump(elem):
-    # debugging
-    if not isinstance(elem, ElementTree):
-        elem = ElementTree(elem)
-    elem.write(sys.stdout)
-    tail = elem.getroot().tail
-    if not tail or tail[-1] != "\n":
-        sys.stdout.write("\n")
-
-def _encode(s, encoding):
-    try:
-        return s.encode(encoding)
-    except AttributeError:
-        return s # 1.5.2: assume the string uses the right encoding
-
-if sys.version[:3] == "1.5":
-    _escape = re.compile(r"[&<>\"\x80-\xff]+") # 1.5.2
-else:
-    _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"'))
-
-_escape_map = {
-    "&": "&amp;",
-    "<": "&lt;",
-    ">": "&gt;",
-    '"': "&quot;",
-}
-
-_namespace_map = {
-    # "well-known" namespace prefixes
-    "http://www.w3.org/XML/1998/namespace": "xml",
-    "http://www.w3.org/1999/xhtml": "html",
-    "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
-    "http://schemas.xmlsoap.org/wsdl/": "wsdl",
-}
-
-def _raise_serialization_error(text):
-    raise TypeError(
-        "cannot serialize %r (type %s)" % (text, type(text).__name__)
-        )
-
-def _encode_entity(text, pattern=_escape):
-    # map reserved and non-ascii characters to numerical entities
-    def escape_entities(m, map=_escape_map):
-        out = []
-        append = out.append
-        for char in m.group():
-            text = map.get(char)
-            if text is None:
-                text = "&#%d;" % ord(char)
-            append(text)
-        return string.join(out, "")
-    try:
-        return _encode(pattern.sub(escape_entities, text), "ascii")
-    except TypeError:
-        _raise_serialization_error(text)
-
-#
-# the following functions assume an ascii-compatible encoding
-# (or "utf-16")
-
-def _escape_cdata(text, encoding=None, replace=string.replace):
-    # escape character data
-    try:
-        if encoding:
-            try:
-                text = _encode(text, encoding)
-            except UnicodeError:
-                return _encode_entity(text)
-        text = replace(text, "&", "&amp;")
-        text = replace(text, "<", "&lt;")
-        text = replace(text, ">", "&gt;")
-        return text
-    except (TypeError, AttributeError):
-        _raise_serialization_error(text)
-
-def _escape_attrib(text, encoding=None, replace=string.replace):
-    # escape attribute value
-    try:
-        if encoding:
-            try:
-                text = _encode(text, encoding)
-            except UnicodeError:
-                return _encode_entity(text)
-        text = replace(text, "&", "&amp;")
-        text = replace(text, "'", "&apos;") # FIXME: overkill
-        text = replace(text, "\"", "&quot;")
-        text = replace(text, "<", "&lt;")
-        text = replace(text, ">", "&gt;")
-        return text
-    except (TypeError, AttributeError):
-        _raise_serialization_error(text)
-
-def fixtag(tag, namespaces):
-    # given a decorated tag (of the form {uri}tag), return prefixed
-    # tag and namespace declaration, if any
-    if isinstance(tag, QName):
-        tag = tag.text
-    namespace_uri, tag = string.split(tag[1:], "}", 1)
-    prefix = namespaces.get(namespace_uri)
-    if prefix is None:
-        prefix = _namespace_map.get(namespace_uri)
-        if prefix is None:
-            prefix = "ns%d" % len(namespaces)
-        namespaces[namespace_uri] = prefix
-        if prefix == "xml":
-            xmlns = None
-        else:
-            xmlns = ("xmlns:%s" % prefix, namespace_uri)
-    else:
-        xmlns = None
-    return "%s:%s" % (prefix, tag), xmlns
-
-##
-# Parses an XML document into an element tree.
-#
-# @param source A filename or file object containing XML data.
-# @param parser An optional parser instance.  If not given, the
-#     standard {@link XMLTreeBuilder} parser is used.
-# @return An ElementTree instance
-
-def parse(source, parser=None):
-    tree = ElementTree()
-    tree.parse(source, parser)
-    return tree
-
-##
-# Parses an XML document into an element tree incrementally, and reports
-# what's going on to the user.
-#
-# @param source A filename or file object containing XML data.
-# @param events A list of events to report back.  If omitted, only "end"
-#     events are reported.
-# @return A (event, elem) iterator.
-
-class iterparse:
-
-    def __init__(self, source, events=None):
-        if not hasattr(source, "read"):
-            source = open(source, "rb")
-        self._file = source
-        self._events = []
-        self._index = 0
-        self.root = self._root = None
-        self._parser = XMLTreeBuilder()
-        # wire up the parser for event reporting
-        parser = self._parser._parser
-        append = self._events.append
-        if events is None:
-            events = ["end"]
-        for event in events:
-            if event == "start":
-                try:
-                    parser.ordered_attributes = 1
-                    parser.specified_attributes = 1
-                    def handler(tag, attrib_in, event=event, append=append,
-                                start=self._parser._start_list):
-                        append((event, start(tag, attrib_in)))
-                    parser.StartElementHandler = handler
-                except AttributeError:
-                    def handler(tag, attrib_in, event=event, append=append,
-                                start=self._parser._start):
-                        append((event, start(tag, attrib_in)))
-                    parser.StartElementHandler = handler
-            elif event == "end":
-                def handler(tag, event=event, append=append,
-                            end=self._parser._end):
-                    append((event, end(tag)))
-                parser.EndElementHandler = handler
-            elif event == "start-ns":
-                def handler(prefix, uri, event=event, append=append):
-                    try:
-                        uri = _encode(uri, "ascii")
-                    except UnicodeError:
-                        pass
-                    append((event, (prefix or "", uri)))
-                parser.StartNamespaceDeclHandler = handler
-            elif event == "end-ns":
-                def handler(prefix, event=event, append=append):
-                    append((event, None))
-                parser.EndNamespaceDeclHandler = handler
-
-    def next(self):
-        while 1:
-            try:
-                item = self._events[self._index]
-            except IndexError:
-                if self._parser is None:
-                    self.root = self._root
-                    try:
-                        raise StopIteration
-                    except NameError:
-                        raise IndexError
-                # load event buffer
-                del self._events[:]
-                self._index = 0
-                data = self._file.read(16384)
-                if data:
-                    self._parser.feed(data)
-                else:
-                    self._root = self._parser.close()
-                    self._parser = None
-            else:
-                self._index = self._index + 1
-                return item
-
-    try:
-        iter
-        def __iter__(self):
-            return self
-    except NameError:
-        def __getitem__(self, index):
-            return self.next()
-
-##
-# Parses an XML document from a string constant.  This function can
-# be used to embed "XML literals" in Python code.
-#
-# @param source A string containing XML data.
-# @return An Element instance.
-# @defreturn Element
-
-def XML(text):
-    parser = XMLTreeBuilder()
-    parser.feed(text)
-    return parser.close()
-
-##
-# Parses an XML document from a string constant, and also returns
-# a dictionary which maps from element id:s to elements.
-#
-# @param source A string containing XML data.
-# @return A tuple containing an Element instance and a dictionary.
-# @defreturn (Element, dictionary)
-
-def XMLID(text):
-    parser = XMLTreeBuilder()
-    parser.feed(text)
-    tree = parser.close()
-    ids = {}
-    for elem in tree.getiterator():
-        id = elem.get("id")
-        if id:
-            ids[id] = elem
-    return tree, ids
-
-##
-# Parses an XML document from a string constant.  Same as {@link #XML}.
-#
-# @def fromstring(text)
-# @param source A string containing XML data.
-# @return An Element instance.
-# @defreturn Element
-
-fromstring = XML
-
-##
-# Generates a string representation of an XML element, including all
-# subelements.
-#
-# @param element An Element instance.
-# @return An encoded string containing the XML data.
-# @defreturn string
-
-def tostring(element, encoding=None):
-    class dummy:
-        pass
-    data = []
-    file = dummy()
-    file.write = data.append
-    ElementTree(element).write(file, encoding)
-    return string.join(data, "")
-
-##
-# Generic element structure builder.  This builder converts a sequence
-# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link
-# #TreeBuilder.end} method calls to a well-formed element structure.
-# <p>
-# You can use this class to build an element structure using a custom XML
-# parser, or a parser for some other XML-like format.
-#
-# @param element_factory Optional element factory.  This factory
-#    is called to create new Element instances, as necessary.
-
-class TreeBuilder:
-
-    def __init__(self, element_factory=None):
-        self._data = [] # data collector
-        self._elem = [] # element stack
-        self._last = None # last element
-        self._tail = None # true if we're after an end tag
-        if element_factory is None:
-            element_factory = _ElementInterface
-        self._factory = element_factory
-
-    ##
-    # Flushes the parser buffers, and returns the toplevel documen
-    # element.
-    #
-    # @return An Element instance.
-    # @defreturn Element
-
-    def close(self):
-        assert len(self._elem) == 0, "missing end tags"
-        assert self._last != None, "missing toplevel element"
-        return self._last
-
-    def _flush(self):
-        if self._data:
-            if self._last is not None:
-                text = string.join(self._data, "")
-                if self._tail:
-                    assert self._last.tail is None, "internal error (tail)"
-                    self._last.tail = text
-                else:
-                    assert self._last.text is None, "internal error (text)"
-                    self._last.text = text
-            self._data = []
-
-    ##
-    # Adds text to the current element.
-    #
-    # @param data A string.  This should be either an 8-bit string
-    #    containing ASCII text, or a Unicode string.
-
-    def data(self, data):
-        self._data.append(data)
-
-    ##
-    # Opens a new element.
-    #
-    # @param tag The element name.
-    # @param attrib A dictionary containing element attributes.
-    # @return The opened element.
-    # @defreturn Element
-
-    def start(self, tag, attrs):
-        self._flush()
-        self._last = elem = self._factory(tag, attrs)
-        if self._elem:
-            self._elem[-1].append(elem)
-        self._elem.append(elem)
-        self._tail = 0
-        return elem
-
-    ##
-    # Closes the current element.
-    #
-    # @param tag The element name.
-    # @return The closed element.
-    # @defreturn Element
-
-    def end(self, tag):
-        self._flush()
-        self._last = self._elem.pop()
-        assert self._last.tag == tag,\
-               "end tag mismatch (expected %s, got %s)" % (
-                   self._last.tag, tag)
-        self._tail = 1
-        return self._last
-
-##
-# Element structure builder for XML source data, based on the
-# <b>expat</b> parser.
-#
-# @keyparam target Target object.  If omitted, the builder uses an
-#     instance of the standard {@link #TreeBuilder} class.
-# @keyparam html Predefine HTML entities.  This flag is not supported
-#     by the current implementation.
-# @see #ElementTree
-# @see #TreeBuilder
-
-class XMLTreeBuilder:
-
-    def __init__(self, html=0, target=None):
-        try:
-            from xml.parsers import expat
-        except ImportError:
-            raise ImportError(
-                "No module named expat; use SimpleXMLTreeBuilder instead"
-                )
-        self._parser = parser = expat.ParserCreate(None, "}")
-        if target is None:
-            target = TreeBuilder()
-        self._target = target
-        self._names = {} # name memo cache
-        # callbacks
-        parser.DefaultHandlerExpand = self._default
-        parser.StartElementHandler = self._start
-        parser.EndElementHandler = self._end
-        parser.CharacterDataHandler = self._data
-        # let expat do the buffering, if supported
-        try:
-            self._parser.buffer_text = 1
-        except AttributeError:
-            pass
-        # use new-style attribute handling, if supported
-        try:
-            self._parser.ordered_attributes = 1
-            self._parser.specified_attributes = 1
-            parser.StartElementHandler = self._start_list
-        except AttributeError:
-            pass
-        encoding = None
-        if not parser.returns_unicode:
-            encoding = "utf-8"
-        # target.xml(encoding, None)
-        self._doctype = None
-        self.entity = {}
-
-    def _fixtext(self, text):
-        # convert text string to ascii, if possible
-        try:
-            return _encode(text, "ascii")
-        except UnicodeError:
-            return text
-
-    def _fixname(self, key):
-        # expand qname, and convert name string to ascii, if possible
-        try:
-            name = self._names[key]
-        except KeyError:
-            name = key
-            if "}" in name:
-                name = "{" + name
-            self._names[key] = name = self._fixtext(name)
-        return name
-
-    def _start(self, tag, attrib_in):
-        fixname = self._fixname
-        tag = fixname(tag)
-        attrib = {}
-        for key, value in attrib_in.items():
-            attrib[fixname(key)] = self._fixtext(value)
-        return self._target.start(tag, attrib)
-
-    def _start_list(self, tag, attrib_in):
-        fixname = self._fixname
-        tag = fixname(tag)
-        attrib = {}
-        if attrib_in:
-            for i in range(0, len(attrib_in), 2):
-                attrib[fixname(attrib_in[i])] = self._fixtext(attrib_in[i+1])
-        return self._target.start(tag, attrib)
-
-    def _data(self, text):
-        return self._target.data(self._fixtext(text))
-
-    def _end(self, tag):
-        return self._target.end(self._fixname(tag))
-
-    def _default(self, text):
-        prefix = text[:1]
-        if prefix == "&":
-            # deal with undefined entities
-            try:
-                self._target.data(self.entity[text[1:-1]])
-            except KeyError:
-                from xml.parsers import expat
-                raise expat.error(
-                    "undefined entity %s: line %d, column %d" %
-                    (text, self._parser.ErrorLineNumber,
-                    self._parser.ErrorColumnNumber)
-                    )
-        elif prefix == "<" and text[:9] == "<!DOCTYPE":
-            self._doctype = [] # inside a doctype declaration
-        elif self._doctype is not None:
-            # parse doctype contents
-            if prefix == ">":
-                self._doctype = None
-                return
-            text = string.strip(text)
-            if not text:
-                return
-            self._doctype.append(text)
-            n = len(self._doctype)
-            if n > 2:
-                type = self._doctype[1]
-                if type == "PUBLIC" and n == 4:
-                    name, type, pubid, system = self._doctype
-                elif type == "SYSTEM" and n == 3:
-                    name, type, system = self._doctype
-                    pubid = None
-                else:
-                    return
-                if pubid:
-                    pubid = pubid[1:-1]
-                self.doctype(name, pubid, system[1:-1])
-                self._doctype = None
-
-    ##
-    # Handles a doctype declaration.
-    #
-    # @param name Doctype name.
-    # @param pubid Public identifier.
-    # @param system System identifier.
-
-    def doctype(self, name, pubid, system):
-        pass
-
-    ##
-    # Feeds data to the parser.
-    #
-    # @param data Encoded data.
-
-    def feed(self, data):
-        self._parser.Parse(data, 0)
-
-    ##
-    # Finishes feeding data to the parser.
-    #
-    # @return An element structure.
-    # @defreturn Element
-
-    def close(self):
-        self._parser.Parse("", 1) # end of data
-        tree = self._target.close()
-        del self._target, self._parser # get rid of circular references
-        return tree
index 29b2d2b2c2ab1a521c4e5137b1aad2a51a78f157..9586575c8d6eafebf90a26c41b3f6c3082236ea8 100644 (file)
@@ -95,9 +95,9 @@ def test():
   }
   display(G)
   I=invert(G)
-  print reachable(G,2)
-  print reachable(I,6)
-  print reachable(G,2) & reachable(I,6)
+  print(reachable(G,2))
+  print(reachable(I,6))
+  print(reachable(G,2) & reachable(I,6))
 
 if __name__ == "__main__":
   test()
index 09431ab255a58ec45102ff53bf099dbf27f5c55b..6e59de5422290a006d425f23f5819ea95203b3f8 100644 (file)
@@ -26,9 +26,9 @@
 
 import sys,os
 try:
-  import cElementTree as ElementTree
+  from xml.etree import cElementTree as ElementTree
 except ImportError:
-  import ElementTree
+  from xml.etree import ElementTree
 
 #from sets import Set
 Set=set
@@ -69,22 +69,22 @@ class SalomeLoader:
     """
     tree = ElementTree.ElementTree(file=filename)
     root = tree.getroot()
-    if debug:print "root.tag:",root.tag,root
+    if debug:print("root.tag:",root.tag,root)
 
     procs=[]
     if root.tag == "dataflow":
       #only one dataflow
       dataflow=root
-      if debug:print dataflow
+      if debug:print(dataflow)
       proc=SalomeProc(dataflow)
       procs.append(proc)
     else:
       #one or more dataflows. The graph contains macros.
       #All macros are defined at the same level in the XML file.
       for dataflow in root.findall("dataflow"):
-        if debug:print dataflow
+        if debug:print(dataflow)
         proc=SalomeProc(dataflow)
-        if debug:print "dataflow name:",proc.name
+        if debug:print("dataflow name:",proc.name)
         procs.append(proc)
     return procs
 
@@ -105,10 +105,10 @@ class SalomeLoader:
     #Put macros in macro_dict
     macro_dict={}
     for p in procs:
-      if debug:print "proc_name:",p.name,"coupled_node:",p.coupled_node
+      if debug:print("proc_name:",p.name,"coupled_node:",p.coupled_node)
       macro_dict[p.name]=p
 
-    if debug:print filename
+    if debug:print(filename)
     yacsproc=ProcNode(proc,macro_dict,filename)
     return yacsproc.createNode()
 
@@ -223,17 +223,17 @@ class InlineNode(Node):
         n.setScript(self.codes[0])
       self.node=n
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddOutputPort(para.name,typeMap[para.type])
 
@@ -249,7 +249,7 @@ class ComputeNode(Node):
         return self.node
 
       r = pilot.getRuntime()
-      if self.container.components.has_key(self.sComponent):
+      if self.sComponent in self.container.components:
         #a node for this component already exists
         compo_node=self.container.components[self.sComponent]
         #It's a node associated with another node of the same component instance
@@ -271,27 +271,27 @@ class ComputeNode(Node):
 
       #add  dataflow ports in out 
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #Create the missing type and adds it into types table
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #Create the missing type and adds it into types table
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         pout=n.edAddOutputPort(para.name,typeMap[para.type])
 
       #add datastream ports in and out
       for para in self.inStreams:
-        if debug:print para.name,para.type,para.dependency,para.schema, para.interpolation,
-        if debug:print para.extrapolation
+        if debug:print(para.name,para.type,para.dependency,para.schema, para.interpolation, end=' ')
+        if debug:print(para.extrapolation)
         pin=n.edAddInputDataStreamPort(para.name,typeMap[streamTypes[para.type]])
       for para in self.outStreams:
-        if debug:print para.name,para.type,para.dependency,para.values
+        if debug:print(para.name,para.type,para.dependency,para.values)
         pout=n.edAddOutputDataStreamPort(para.name,typeMap[streamTypes[para.type]])
 
       for d in self.datas:
@@ -323,11 +323,11 @@ class ComposedNode(Node):
         n.inner_nodes=loops[n]
         n.G=graph.InducedSubgraph(loops[n],G)
 
-    if debug:print "all loops"
-    if debug:print loops
+    if debug:print("all loops")
+    if debug:print(loops)
 
     #Get most external loops 
-    outer_loops=loops.keys()
+    outer_loops=list(loops.keys())
     for l in loops:
       for ll in outer_loops:
         if loops[l] < loops[ll]:
@@ -337,7 +337,7 @@ class ComposedNode(Node):
           break
 
     #In the end all remaining loops in outer_loops are the most external
-    if debug:print outer_loops
+    if debug:print(outer_loops)
 
     #We remove all internal nodes of most external loops 
     for l in outer_loops:
@@ -354,14 +354,14 @@ class ComposedNode(Node):
       #outcoming links of internal nodes. Probably not complete.
       inputs={}
       for link in l.endloop.links:
-        if debug:print link.from_node,link.to_node,link.from_param,link.to_param
+        if debug:print(link.from_node,link.to_node,link.from_param,link.to_param)
         inputs[link.to_param]=link.from_node,link.from_param
 
       for s in suiv:
         for link in s.links:
           if link.from_node == l.endloop:
             link.from_node,link.from_param=inputs[link.from_param]
-          if debug:print link.from_node,link.to_node,link.from_param,link.to_param
+          if debug:print(link.from_node,link.to_node,link.from_param,link.to_param)
 
       if debug:graph.display(G)
 
@@ -373,7 +373,7 @@ class ComposedNode(Node):
     """This method connects the salome macros in macro_dict to the master YACS Proc.
        
     """
-    if debug:print "connect_macros",self.node,macro_dict
+    if debug:print("connect_macros",self.node,macro_dict)
     for node in self.G:
       if isinstance(node,MacroNode):
         #node is a macro, connect its definition to self.
@@ -382,7 +382,7 @@ class ComposedNode(Node):
         #node.node is the YACS Bloc equivalent to node
         p=macro_dict[node.coupled_node]
         bloc=node.node
-        if debug:print "macronode:",node.name,node.coupled_node,p
+        if debug:print("macronode:",node.name,node.coupled_node,p)
         #Create a hierarchical graph from the salome graph
         G=p.create_graph()
         node.G=G
@@ -486,17 +486,17 @@ class LoopNode(ComposedNode):
       init.setScript(self.codes[0])
       init.setFname(self.fnames[0])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         init.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         init.edAddOutputPort(para.name,typeMap[para.type])
       bloop.edAddChild(init)
@@ -515,17 +515,17 @@ class LoopNode(ComposedNode):
       next.setScript(self.codes[2])
       next.setFname(self.fnames[2])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         next.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         next.edAddOutputPort(para.name,typeMap[para.type])
       blnode.edAddChild(next)
@@ -537,18 +537,18 @@ class LoopNode(ComposedNode):
       more.setScript(self.codes[1])
       more.setFname(self.fnames[1])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         more.edAddInputPort(para.name,typeMap[para.type])
       more.edAddOutputPort("DoLoop",typeMap["int"])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         more.edAddOutputPort(para.name,typeMap[para.type])
       blnode.edAddChild(more)
@@ -678,7 +678,7 @@ class ProcNode(ComposedNode):
     currentProc.typeMap["CALCIUM_real"]=typeMap["CALCIUM_real"]
 
     #create all containers
-    for name,container in _containers.items():
+    for name,container in list(_containers.items()):
       cont=r.createContainer()
       cont.setName(name)
       cont.setProperty("hostname",container.mach)
@@ -767,23 +767,23 @@ class SalomeProc(ComposedNode):
         #each node has 2 lists of datastream links (inStreams, outStreams)
 
     def parse(self,dataflow):
-        if debug:print "All XML nodes"
+        if debug:print("All XML nodes")
         for node in dataflow:
-            if debug:print node.tag,node
+            if debug:print(node.tag,node)
 
         #Parse dataflow info-list
         self.dataflow_info=self.parseService(dataflow.find("info-list/node/service"))
-        if debug:print self.dataflow_info
-        if debug:print self.dataflow_info.inParameters
-        if debug:print self.dataflow_info.outParameters
+        if debug:print(self.dataflow_info)
+        if debug:print(self.dataflow_info.inParameters)
+        if debug:print(self.dataflow_info.outParameters)
         if debug:
             for para in self.dataflow_info.inParameters:
-                print "inParam:",para.name,para.name.split("__",1)
+                print("inParam:",para.name,para.name.split("__",1))
 
         self.name=dataflow.findtext("info-list/node/node-name")
         self.coupled_node=dataflow.findtext("info-list/node/coupled-node")
 
-        if debug:print "All XML nodes dataflow/node-list"
+        if debug:print("All XML nodes dataflow/node-list")
         nodes=[]
         node_dict={}
         #Parse all nodes
@@ -811,7 +811,7 @@ class SalomeProc(ComposedNode):
               node.container= getContainer(container)
               if not node.container:
                 node.container=addContainer(container)
-              if debug:print "\tcontainer",node.container
+              if debug:print("\tcontainer",node.container)
 
             elif kind == "3":
               #It's a python function
@@ -855,15 +855,15 @@ class SalomeProc(ComposedNode):
               node=MacroNode()
               node.kind=10
             else:
-              raise UnknownKind,kind
+              raise UnknownKind(kind)
 
             node.name=name
             node.service=None
             node.coupled_node=coupled_node
             #Put nodes in a dict to ease search
             node_dict[node.name]=node
-            if debug:print "\tnode-name",node.name
-            if debug:print "\tkind",node.kind,node.__class__.__name__
+            if debug:print("\tnode-name",node.name)
+            if debug:print("\tkind",node.kind,node.__class__.__name__)
 
             s=n.find("service")
             if s:
@@ -871,7 +871,7 @@ class SalomeProc(ComposedNode):
 
 
             #Parse datastream ports
-            if debug:print "DataStream ports"
+            if debug:print("DataStream ports")
             inStreams=[]
             for indata in n.findall("DataStream-list/inParameter"):
                 inStreams.append(self.parseInData(indata))
@@ -884,7 +884,7 @@ class SalomeProc(ComposedNode):
                 outStreams_dict[p.name]=p
             node.outStreams=outStreams
             node.outStreams_dict=outStreams_dict
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
             nodes.append(node)
 
         self.nodes=nodes
@@ -900,9 +900,9 @@ class SalomeProc(ComposedNode):
         <coord-list/>
         </link>
         """
-        if debug:print "All XML nodes dataflow/link-list"
+        if debug:print("All XML nodes dataflow/link-list")
         links=[]
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
         for link in dataflow.findall('link-list/link'):
             l=Link()
             l.from_name=link.findtext("fromnode-name")
@@ -910,52 +910,52 @@ class SalomeProc(ComposedNode):
             l.from_param=link.findtext("fromserviceparameter-name")
             l.to_param=link.findtext("toserviceparameter-name")
             links.append(l)
-            if debug:print "\tfromnode-name",l.from_name
-            if debug:print "\tfromserviceparameter-name",l.from_param
-            if debug:print "\ttonode-name",l.to_name
-            if debug:print "\ttoserviceparameter-name",l.to_param
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\tfromnode-name",l.from_name)
+            if debug:print("\tfromserviceparameter-name",l.from_param)
+            if debug:print("\ttonode-name",l.to_name)
+            if debug:print("\ttoserviceparameter-name",l.to_param)
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         self.links=links
-        if debug:print "All XML nodes dataflow/data-list"
+        if debug:print("All XML nodes dataflow/data-list")
         datas=[]
         for data in dataflow.findall('data-list/data'):
             d=self.parseData(data)
             datas.append(d)
-            if debug:print "\ttonode-name",d.tonode
-            if debug:print "\ttoserviceparameter-name",d.tonodeparam
-            if debug:print "\tparameter-value",d.value
-            if debug:print "\tparameter-type",d.type
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\ttonode-name",d.tonode)
+            if debug:print("\ttoserviceparameter-name",d.tonodeparam)
+            if debug:print("\tparameter-value",d.value)
+            if debug:print("\tparameter-type",d.type)
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         self.datas=datas
 
     def parseService(self,s):
         service=Service()
         service.name=s.findtext("service-name")
-        if debug:print "\tservice-name",service.name
+        if debug:print("\tservice-name",service.name)
 
         inParameters=[]
         for inParam in s.findall("inParameter-list/inParameter"):
             p=Parameter()
             p.name=inParam.findtext("inParameter-name")
             p.type=typeName(inParam.findtext("inParameter-type"))
-            if debug:print "\tinParameter-name",p.name
-            if debug:print "\tinParameter-type",p.type
+            if debug:print("\tinParameter-name",p.name)
+            if debug:print("\tinParameter-type",p.type)
             inParameters.append(p)
         service.inParameters=inParameters
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         outParameters=[]
         for outParam in s.findall("outParameter-list/outParameter"):
             p=Parameter()
             p.name=outParam.findtext("outParameter-name")
             p.type=typeName(outParam.findtext("outParameter-type"))
-            if debug:print "\toutParameter-name",p.name
-            if debug:print "\toutParameter-type",p.type
+            if debug:print("\toutParameter-name",p.name)
+            if debug:print("\toutParameter-type",p.type)
             outParameters.append(p)
         service.outParameters=outParameters
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
         return service
 
     def parseData(self,d):
@@ -969,8 +969,8 @@ class SalomeProc(ComposedNode):
         return da
 
     def parsePyFunction(self,pyfunc):
-        if debug:print pyfunc.tag,":",pyfunc
-        if debug:print "\tFuncName",pyfunc.findtext("FuncName")
+        if debug:print(pyfunc.tag,":",pyfunc)
+        if debug:print("\tFuncName",pyfunc.findtext("FuncName"))
         text=""
         for cdata in pyfunc.findall("PyFunc"):
             if text:text=text+'\n'
@@ -994,7 +994,7 @@ class SalomeProc(ComposedNode):
     """
 
     def parseInData(self,d):
-        if debug:print d.tag,":",d
+        if debug:print(d.tag,":",d)
         p=Parameter()
         p.name=d.findtext("inParameter-name")
         p.type=typeName(d.findtext("inParameter-type"))
@@ -1002,17 +1002,17 @@ class SalomeProc(ComposedNode):
         p.schema=d.findtext("inParameter-schema")
         p.interpolation=d.findtext("inParameter-interpolation")
         p.extrapolation=d.findtext("inParameter-extrapolation")
-        if debug:print "\tinParameter-name",p.name
+        if debug:print("\tinParameter-name",p.name)
         return p
 
     def parseOutData(self,d):
-        if debug:print d.tag,":",d
+        if debug:print(d.tag,":",d)
         p=Parameter()
         p.name=d.findtext("outParameter-name")
         p.type=typeName(d.findtext("outParameter-type"))
         p.dependency=d.findtext("outParameter-dependency")
         p.values=d.findtext("outParameter-values")
-        if debug:print "\toutParameter-name",p.name
+        if debug:print("\toutParameter-name",p.name)
         return p
 
     def create_graph(self):
@@ -1030,14 +1030,14 @@ class SalomeProc(ComposedNode):
         from_node=self.node_dict[link.from_name]
         if link.from_param == "Gate" or link.to_param == "Gate":
           #control link salome : add to_name node to neighbours
-          if debug:print "add control link",link.from_name,link.to_name
+          if debug:print("add control link",link.from_name,link.to_name)
           G[self.node_dict[link.from_name]].add(self.node_dict[link.to_name])
 
-        elif from_node.outStreams_dict.has_key(link.from_param):
+        elif link.from_param in from_node.outStreams_dict:
           # datastream link : 
           # 1- add link in link list
           # 2- add in link references on from_node and to_node
-          if debug:print "add stream link",link.from_name,link.to_name
+          if debug:print("add stream link",link.from_name,link.to_name)
           self.node_dict[link.to_name].inStreamLinks.append(link)
           self.node_dict[link.from_name].outStreamLinks.append(link)
           link.from_node=self.node_dict[link.from_name]
@@ -1052,10 +1052,10 @@ class SalomeProc(ComposedNode):
           if isinstance(to_node,LoopNode):
             # If it's the link from EndOfLoop to Loop , we ignore it
             if to_node.coupled_node == from_node.name:
-              if debug:print "backlink loop:",from_node,to_node
+              if debug:print("backlink loop:",from_node,to_node)
               #ignored
               continue
-          if debug:print "add dataflow link",link.from_name,link.to_name
+          if debug:print("add dataflow link",link.from_name,link.to_name)
           G[self.node_dict[link.from_name]].add(self.node_dict[link.to_name])
 
           if link.from_param != "DoLoop" and link.to_param != "DoLoop":
@@ -1074,12 +1074,12 @@ class SalomeProc(ComposedNode):
              and isinstance(self.node_dict[link.to_name],InlineNode):
             #Store the end loop inline node in attribute endloop
             #self.node_dict[link.to_name] is the end node of the head loop node self.node_dict[link.from_name]
-            if debug:print "add loop",link.from_name,link.to_name
+            if debug:print("add loop",link.from_name,link.to_name)
             self.node_dict[link.from_name].endloop=self.node_dict[link.to_name]
             self.node_dict[link.to_name].loop=self.node_dict[link.from_name]
 
       for data in self.datas:
-        if debug:print "datas",data
+        if debug:print("datas",data)
         self.node_dict[data.tonode].datas.append(data)
 
       self.G=G
@@ -1126,7 +1126,7 @@ def main():
     salomeFile=sys.argv[1]
     convertedFile=sys.argv[2]
   except :
-    print usage%(sys.argv[0])
+    print(usage%(sys.argv[0]))
     sys.exit(3)
 
   SALOMERuntime.RuntimeSALOME_setRuntime()
@@ -1144,7 +1144,7 @@ def main():
 
   logger=p.getLogger("parser")
   if not logger.isEmpty():
-    print logger.getStr()
+    print(logger.getStr())
     sys.exit(1)
 
 if __name__ == "__main__":
index da16e5775ea88030005ed135e9bc205923da5bf2..16e2ea5fb975bf57f05535adebc8338239201ab1 100644 (file)
       <PyFunc><![CDATA[    index = min        ]]></PyFunc>
       <PyFunc><![CDATA[  else :        ]]></PyFunc>
       <PyFunc><![CDATA[    index = max        ]]></PyFunc>
-      <PyFunc><![CDATA[  print "Init :" ]]></PyFunc>
-      <PyFunc><![CDATA[  print index,min,max,couronne,Rcouronne,Rsphere       ]]></PyFunc>
+      <PyFunc><![CDATA[  print("Init :") ]]></PyFunc>
+      <PyFunc><![CDATA[  print(index,min,max,couronne,Rcouronne,Rsphere)       ]]></PyFunc>
       <PyFunc><![CDATA[  couronne.Register() ]]></PyFunc>
       <PyFunc><![CDATA[  return index,min,max,couronne,Rcouronne,Rsphere    ]]></PyFunc>
       <PyFunc><![CDATA[?]]></PyFunc>
       <PyFunc><![CDATA[  OutLoop = 0       ]]></PyFunc>
       <PyFunc><![CDATA[  if max > index :        ]]></PyFunc>
       <PyFunc><![CDATA[    OutLoop = 1       ]]></PyFunc>
-      <PyFunc><![CDATA[  print "More :" ]]></PyFunc>
-      <PyFunc><![CDATA[  print OutLoop,index,min,max,couronne,Rcouronne,Rsphere       ]]></PyFunc>
+      <PyFunc><![CDATA[  print("More :") ]]></PyFunc>
+      <PyFunc><![CDATA[  print(OutLoop,index,min,max,couronne,Rcouronne,Rsphere)       ]]></PyFunc>
       <PyFunc><![CDATA[  couronne.Register() ]]></PyFunc>
       <PyFunc><![CDATA[  return OutLoop,index,min,max,couronne,Rcouronne,Rsphere        ]]></PyFunc>
       <PyFunc><![CDATA[?]]></PyFunc>
       <FuncName>Next</FuncName>
       <PyFunc><![CDATA[def Next(index,min,max,couronne,Rcouronne,Rsphere):         ]]></PyFunc>
       <PyFunc><![CDATA[  index = index + 1   ]]></PyFunc>
-      <PyFunc><![CDATA[  print "Next :"       ]]></PyFunc>
-      <PyFunc><![CDATA[  print index,min,max,couronne,Rcouronne,Rsphere        ]]></PyFunc>
+      <PyFunc><![CDATA[  print("Next :")       ]]></PyFunc>
+      <PyFunc><![CDATA[  print(index,min,max,couronne,Rcouronne,Rsphere)        ]]></PyFunc>
       <PyFunc><![CDATA[  couronne.Register() ]]></PyFunc>
       <PyFunc><![CDATA[  return index,min,max,couronne,Rcouronne,Rsphere        ]]></PyFunc>
       <PyFunc><![CDATA[?]]></PyFunc>
index e087e44d5aeaa394c9f9c31a758ae98663e83b57..fc0d95ff63d4c7c32f1bb2a44dfab8751b41ddd4 100644 (file)
       <PyFunc><![CDATA[    naming_service = SALOME_NamingServicePy_i(orb)    ]]></PyFunc>
       <PyFunc><![CDATA[    # --- load visu component                          ]]></PyFunc>
       <PyFunc><![CDATA[    aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU")       ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> aVisu ", aVisu         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> aVisu ", aVisu)         ]]></PyFunc>
       <PyFunc><![CDATA[    time.sleep(2)         ]]></PyFunc>
       <PyFunc><![CDATA[    aViewManager=aVisu.GetViewManager()         ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> aViewManager ", aViewManager         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> aViewManager ", aViewManager)         ]]></PyFunc>
       <PyFunc><![CDATA[    #time.sleep(2)         ]]></PyFunc>
       <PyFunc><![CDATA[    #aView=aViewManager.GetCurrentView()         ]]></PyFunc>
       <PyFunc><![CDATA[    aView=aViewManager.Create3DView()         ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> aView ", aView         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> aView ", aView)         ]]></PyFunc>
       <PyFunc><![CDATA[    #time.sleep(2)         ]]></PyFunc>
       <PyFunc><![CDATA[    medFile = "TimeStamps.med"       ]]></PyFunc>
       <PyFunc><![CDATA[    medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile       ]]></PyFunc>
       <PyFunc><![CDATA[    myResult = aVisu.ImportFile(medFile)       ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> myResult ", myResult         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> myResult ", myResult)         ]]></PyFunc>
       <PyFunc><![CDATA[    return aVisu,aView,myResult       ]]></PyFunc>
       </PyFunction>    </PyFunction-list>
     <creation-date>8/4/2005 - 14:3:47</creation-date>
       <PyFunc><![CDATA[        index = min      ]]></PyFunc>
       <PyFunc><![CDATA[    else :     ]]></PyFunc>
       <PyFunc><![CDATA[        index = max  ]]></PyFunc>
-      <PyFunc><![CDATA[    print "---- Init ",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+      <PyFunc><![CDATA[    print("---- Init ",index,min,max,aVisu,aView,myResult,x1) ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    myResult.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    return index,min,max,aVisu,aView,myResult,x1  ]]></PyFunc>     </PyFunction>
       <PyFunc><![CDATA[        DoLoop = 1       ]]></PyFunc>
       <PyFunc><![CDATA[    else :       ]]></PyFunc>
       <PyFunc><![CDATA[        DoLoop = 0       ]]></PyFunc>
-      <PyFunc><![CDATA[    print "---- More",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+      <PyFunc><![CDATA[    print("---- More",index,min,max,aVisu,aView,myResult,x1) ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    myResult.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    return DoLoop,index,min,max,aVisu,aView,myResult,x1   ]]></PyFunc>     </PyFunction>
       <PyFunc><![CDATA[def Next(index,min,max,aVisu,aView,myResult,x1):   ]]></PyFunc>
       <PyFunc><![CDATA[    index = index + 1 ]]></PyFunc>
       <PyFunc><![CDATA[    x1=x1+1.0 ]]></PyFunc>
-      <PyFunc><![CDATA[    print "---- Next",index,min,max,aVisu,aView,myResult,x1   ]]></PyFunc>
+      <PyFunc><![CDATA[    print("---- Next",index,min,max,aVisu,aView,myResult,x1)   ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    myResult.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    return index,min,max,aVisu,aView,myResult,x1   ]]></PyFunc>     </PyFunction>    </PyFunction-list>
       <PyFunc><![CDATA[import os                               ]]></PyFunc>
       <PyFunc><![CDATA[import time                               ]]></PyFunc>
       <PyFunc><![CDATA[def DisplayVitesse(index,aVisu,aView,aResult,x1):                          ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 1 index = ", index,aVisu,aView,aResult,x1                    ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 1 index = ", index,aVisu,aView,aResult,x1)                    ]]></PyFunc>
       <PyFunc><![CDATA[    aMeshName ="dom"                               ]]></PyFunc>
       <PyFunc><![CDATA[    myFieldName = "vitesse"                     ]]></PyFunc>
       <PyFunc><![CDATA[    anEntity = VISU.NODE                               ]]></PyFunc>
       <PyFunc><![CDATA[    aMesh = aVisu.MeshOnEntity(aResult, aMeshName, anEntity)     ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 2 ", aMesh                 ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 2 ", aMesh)                 ]]></PyFunc>
       <PyFunc><![CDATA[    x1=int(x1)                 ]]></PyFunc>
       <PyFunc><![CDATA[    aScalarMap=aVisu.ScalarMapOnField(aResult,aMeshName,anEntity,myFieldName,x1)  ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 4"                         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 4")                         ]]></PyFunc>
       <PyFunc><![CDATA[    if aScalarMap is not None:                               ]]></PyFunc>
       <PyFunc><![CDATA[        aScalarMap.SetScaling(VISU.LINEAR)                               ]]></PyFunc>
       <PyFunc><![CDATA[    else:                               ]]></PyFunc>
-      <PyFunc><![CDATA[        print "Null scalar map is created"                               ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 5"           ]]></PyFunc>
+      <PyFunc><![CDATA[        print("Null scalar map is created")                               ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 5")           ]]></PyFunc>
       <PyFunc><![CDATA[    aView.DisplayOnly(aScalarMap)                               ]]></PyFunc>
       <PyFunc><![CDATA[    aView.FitAll()                               ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Update()                              ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 6"                         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 6")                         ]]></PyFunc>
       <PyFunc><![CDATA[    theResult=aResult                           ]]></PyFunc>
       <PyFunc><![CDATA[    #time.sleep(2)                   ]]></PyFunc>
       <PyFunc><![CDATA[    theResult.Register() ]]></PyFunc>
index b8633dd6d81354ea3329246b9dbb57221e997c4f..64a41e321aa5afbf4bbd2e7beadbe47132a9016e 100755 (executable)
@@ -72,10 +72,9 @@ class TestSalomeLoader(unittest.TestCase):
     p.saveSchema("tata.xml")
 
 U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/salomeloader: testSalomeLoader.py\n")
-suite = unittest.makeSuite(TestSalomeLoader)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
+with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+  f.write("  --- TEST src/salomeloader: testSalomeLoader.py\n")
+  suite = unittest.makeSuite(TestSalomeLoader)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
 sys.exit(not result.wasSuccessful())
 
index ddbcdd7229d8869bdf08aa49292a9f5f8c7ba5e0..acff4fd670545a1cabd28022a5d90ac070341da4 100755 (executable)
@@ -70,7 +70,7 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
        AC_MSG_CHECKING(python extra libraries)
        PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
                 conf = distutils.sysconfig.get_config_var; \
-                print conf('LOCALMODLIBS')+' '+conf('LIBS')"
+                print(conf('LOCALMODLIBS')+' '+conf('LIBS'))"
        AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
        AC_SUBST(PYTHON_EXTRA_LIBS)
 ])
index 03e8b8f1cd10085cb2d3342fd46cf31f177d22a6..8542a7e93698a29d1b9ebcba5d46d52d0f6b3734 100644 (file)
@@ -51,7 +51,7 @@ AC_DEFUN(CHECK_PYTHON,
   AC_SUBST(PYTHONHOME)
 
   changequote(<<, >>)dnl
-  PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+  PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[:3])"`
   changequote([, ])dnl
   AC_SUBST(PYTHON_VERSION)
 
@@ -73,7 +73,7 @@ AC_DEFUN(CHECK_PYTHON,
   dnl to know which OS Python thinks this is.
 
   AC_SUBST(PYTHON_PLATFORM)
-  PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+  PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
 
   AC_SUBST(PYTHON_SITE)
   AC_ARG_WITH(python-site,
index 372ea87195b7f501662ce89c3f5e5fe42e6ba618..6f4a75411abe145d19add79a71b0a623a88b81a6 100644 (file)
@@ -28,7 +28,7 @@ namespace MEDMEM {
 
 class Cpp_Template_
 {
-// Méthodes publiques
+// Méthodes publiques
 public:
     Cpp_Template_();
     MEDMEM::FIELD<double>* createField();
index a9496dd7070e9ea3df225940f7e3dc6dc1ef37e3..2714c438da8fc6f021509083167cf681182d3bff 100644 (file)
@@ -29,7 +29,7 @@ else:
 pass
 #
 #
-print "Test Program of Cpp_Template_ component"
+print("Test Program of Cpp_Template_ component")
 
 # ...
 
index 6e3eb3af945b2bc058569a9245ed10dde818624d..a05241110242c0ad5be471801f896a01cc71d302 100644 (file)
@@ -75,7 +75,7 @@ AC_DEFUN([CHECK_PYTHON],[
        AC_MSG_CHECKING(python extra libraries)
        PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
                 conf = distutils.sysconfig.get_config_var; \
-                print conf('LOCALMODLIBS')+' '+conf('LIBS')"
+                print(conf('LOCALMODLIBS')+' '+conf('LIBS'))"
        AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
        AC_SUBST(PYTHON_EXTRA_LIBS)
 ])
index aee8a99b4c516901dee6b97bbcadd01e05c06200..ab53018b439d78607f049758faf7a255e22d2e44 100755 (executable)
@@ -23,40 +23,40 @@ usage="""USAGE: runSalome.py [options]
 [command line options] :
 --help                        : affichage de l'aide
 --gui                         : lancement du GUI
---logger                     : redirection des messages dans un fichier
---xterm                              : les serveurs ouvrent une fen�tre xterm et les messages sont affich�s dans cette fen�tre
---modules=module1,module2,... : o� modulen est le nom d'un module Salome ï¿½ charger dans le catalogue
+--logger                      : redirection des messages dans un fichier
+--xterm                       : les serveurs ouvrent une fen??tre xterm et les messages sont affich??s dans cette fen??tre
+--modules=module1,module2,... : o?? modulen est le nom d'un module Salome ?? charger dans le catalogue
 --containers=cpp,python,superv: lancement des containers cpp, python et de supervision
---killall                    : arr�t des serveurs de salome
+--killall                     : arr??t des serveurs de salome
 
- La variable d'environnement <modulen>_ROOT_DIR doit etre pr�alablement
- positionn�e (modulen doit etre en majuscule).
+ La variable d'environnement <modulen>_ROOT_DIR doit etre pr??alablement
+ positionn??e (modulen doit etre en majuscule).
  KERNEL_ROOT_DIR est obligatoire.
 """
 
 # -----------------------------------------------------------------------------
 #
-# Fonction d'arr�t de salome
+# Fonction d'arr??t de salome
 #
 
 def killSalome():
-   print "arret des serveurs SALOME"
-   for pid, cmd in process_id.items():
-      print "arret du process %s : %s"% (pid, cmd[0])
-      try:
-       os.kill(pid,signal.SIGKILL)
-      except:
-         print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-   print "arret du naming service"
-   os.system("killall -9 omniNames")
-   
+    print("arret des serveurs SALOME")
+    for pid, cmd in list(process_id.items()):
+        print("arret du process %s : %s"% (pid, cmd[0]))
+        try:
+            os.kill(pid,signal.SIGKILL)
+        except:
+            print("  ------------------ process %s : %s inexistant"% (pid, cmd[0]))
+    print("arret du naming service")
+    os.system("killall -9 omniNames")
+
 # -----------------------------------------------------------------------------
 #
 # Fonction message
 #
 
 def message(code, msg=''):
-    if msg: print msg
+    if msg: print(msg)
     sys.exit(code)
 
 import sys,os,string,glob,time,signal,pickle,getopt
@@ -76,79 +76,79 @@ with_container_python=0
 with_container_superv=0
 
 try:
-  for o, a in opts:
-    if o in ('-h', '--help'):
-      print usage
-      sys.exit(1)
-    elif o in ('-g', '--gui'):
-      with_gui=1
-    elif o in ('-l', '--logger'):
-      with_logger=1
-    elif o in ('-x', '--xterm'):
-      with_xterm=1
-    elif o in ('-m', '--modules'):
-      liste_modules = [x.upper() for x in a.split(',')]
-    elif o in ('-c', '--containers'):
-      liste_containers = [x.lower() for x in a.split(',')]
-      for r in liste_containers:
-        if r not in ('cpp', 'python', 'superv'):
-          message(1, 'Invalid -c/--containers option: %s' % a)
-      if 'cpp' in liste_containers:
-          with_container_cpp=1
-      else:
-          with_container_cpp=0
-      if 'python' in liste_containers:
-          with_container_python=1
-      else:
-          with_container_python=0
-      if 'superv' in liste_containers:
-          with_container_superv=1
-      else:
-          with_container_superv=0
-    elif o in ('-k', '--killall'):
-      filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-      #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-      found = 0
-      try:
-         fpid=open(filedict, 'r')
-        found = 1
-      except:
-         print "le fichier %s des process SALOME n'est pas accessible"% filedict
-
-      if found:
-         process_id=pickle.load(fpid)
-         fpid.close()
-         killSalome()
-        process_id={}
-         os.remove(filedict)
-       
-except getopt.error, msg:
-  print usage
-  sys.exit(1)
+    for o, a in opts:
+        if o in ('-h', '--help'):
+            print(usage)
+            sys.exit(1)
+        elif o in ('-g', '--gui'):
+            with_gui=1
+        elif o in ('-l', '--logger'):
+            with_logger=1
+        elif o in ('-x', '--xterm'):
+            with_xterm=1
+        elif o in ('-m', '--modules'):
+            liste_modules = [x.upper() for x in a.split(',')]
+        elif o in ('-c', '--containers'):
+            liste_containers = [x.lower() for x in a.split(',')]
+            for r in liste_containers:
+                if r not in ('cpp', 'python', 'superv'):
+                    message(1, 'Invalid -c/--containers option: %s' % a)
+            if 'cpp' in liste_containers:
+                with_container_cpp=1
+            else:
+                with_container_cpp=0
+            if 'python' in liste_containers:
+                with_container_python=1
+            else:
+                with_container_python=0
+            if 'superv' in liste_containers:
+                with_container_superv=1
+            else:
+                with_container_superv=0
+        elif o in ('-k', '--killall'):
+            filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+            #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+            found = 0
+            try:
+                fpid=open(filedict, 'r')
+                found = 1
+            except:
+                print("le fichier %s des process SALOME n'est pas accessible"% filedict)
+
+            if found:
+                process_id=pickle.load(fpid)
+                fpid.close()
+                killSalome()
+                process_id={}
+                os.remove(filedict)
+
+except getopt.error as msg:
+    print(usage)
+    sys.exit(1)
 
 # -----------------------------------------------------------------------------
 #
-# V�rification des variables d'environnement
+# V??rification des variables d'environnement
 #
 try:
-  kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
-  modules_root_dir["KERNEL"]=kernel_root_dir
+    kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+    modules_root_dir["KERNEL"]=kernel_root_dir
 except:
-  print usage
-  sys.exit(1)
+    print(usage)
+    sys.exit(1)
 
 for module in liste_modules :
-   try:
-      module=module.upper()
-      module_root_dir=os.environ[module +"_ROOT_DIR"]
-      modules_root_dir[module]=module_root_dir
-   except:
-      print usage
-      sys.exit(1)
+    try:
+        module=module.upper()
+        module_root_dir=os.environ[module +"_ROOT_DIR"]
+        modules_root_dir[module]=module_root_dir
+    except:
+        print(usage)
+        sys.exit(1)
 
 # il faut KERNEL en premier dans la liste des modules
 # - l'ordre des modules dans le catalogue sera identique
-# - la liste des modules presents dans le catalogue est exploit�e pour charger les modules CORBA python,
+# - la liste des modules presents dans le catalogue est exploit??e pour charger les modules CORBA python,
 #   il faut charger les modules python du KERNEL en premier
 
 if "KERNEL" in liste_modules:liste_modules.remove("KERNEL")
@@ -156,75 +156,75 @@ liste_modules[:0]=["KERNEL"]
 #print liste_modules
 #print modules_root_dir
 
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(list(modules_root_dir.values()))
 if "SUPERV" in liste_modules:with_container_superv=1
 
 
 # -----------------------------------------------------------------------------
 #
-# D�finition des classes d'objets pour le lancement des Server CORBA
+# D??finition des classes d'objets pour le lancement des Server CORBA
 #
 
 class Server:
-   CMD=[]
-   if with_xterm:
-       ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
-   else:
-       ARGS=[] 
-
-   def run(self):
-      args = self.ARGS+self.CMD
-      #print "args = ", args
-      pid = os.spawnvp(os.P_NOWAIT, args[0], args)
-      process_id[pid]=self.CMD
+    CMD=[]
+    if with_xterm:
+        ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
+    else:
+        ARGS=[]
+
+    def run(self):
+        args = self.ARGS+self.CMD
+        #print "args = ", args
+        pid = os.spawnvp(os.P_NOWAIT, args[0], args)
+        process_id[pid]=self.CMD
 
 class CatalogServer(Server):
-   SCMD1=['SALOME_ModuleCatalog_Server','-common']
-   SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml'] 
-
-   def setpath(self,liste_modules):
-      cata_path=[]
-      for module in liste_modules:
-          module_root_dir=modules_root_dir[module]
-          module_cata=module+"Catalog.xml"
-          print "   ", module_cata
-          cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
-      self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+    SCMD1=['SALOME_ModuleCatalog_Server','-common']
+    SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml']
+
+    def setpath(self,liste_modules):
+        cata_path=[]
+        for module in liste_modules:
+            module_root_dir=modules_root_dir[module]
+            module_cata=module+"Catalog.xml"
+            print("   ", module_cata)
+            cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
+        self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
 class SalomeDSServer(Server):
-   CMD=['SALOMEDS_Server']
+    CMD=['SALOMEDS_Server']
 
 class RegistryServer(Server):
-   CMD=['SALOME_Registry_Server', '--salome_session','theSession']
+    CMD=['SALOME_Registry_Server', '--salome_session','theSession']
 
 class ContainerCPPServer(Server):
-   CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerPYServer(Server):
-   CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerSUPERVServer(Server):
-   CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
 
 class LoggerServer(Server):
-   CMD=['SALOME_Logger_Server', 'logger.log']
+    CMD=['SALOME_Logger_Server', 'logger.log']
 
 class SessionLoader(Server):
-   CMD=['SALOME_Session_Loader']
-   if with_container_cpp:
-       CMD=CMD+['CPP']
-   if with_container_python:
-       CMD=CMD+['PY']
-   if with_container_superv:
-       CMD=CMD+['SUPERV']
-   if with_gui:
-       CMD=CMD+['GUI']
+    CMD=['SALOME_Session_Loader']
+    if with_container_cpp:
+        CMD=CMD+['CPP']
+    if with_container_python:
+        CMD=CMD+['PY']
+    if with_container_superv:
+        CMD=CMD+['SUPERV']
+    if with_gui:
+        CMD=CMD+['GUI']
 
 class SessionServer(Server):
-   CMD=['SALOME_Session_Server']
+    CMD=['SALOME_Session_Server']
 
 class NotifyServer(Server):
-   CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
+    CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
 
 # -----------------------------------------------------------------------------
 #
@@ -232,16 +232,16 @@ class NotifyServer(Server):
 #
 
 def test(clt):
-   """
-        Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
-        usage : hello=test(clt)
-   """
-   # create an LifeCycleCORBA instance
-   import LifeCycleCORBA 
-   lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
-   import HXX2SALOME_GENERIC_CLASS_NAME_ORB
-   hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
-   return hello
+    """
+         Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
+         usage : hello=test(clt)
+    """
+    # create an LifeCycleCORBA instance
+    import LifeCycleCORBA
+    lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
+    import HXX2SALOME_GENERIC_CLASS_NAME_ORB
+    hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
+    return hello
 
 # -----------------------------------------------------------------------------
 #
@@ -249,14 +249,14 @@ def test(clt):
 #
 
 def add_path(directory):
-   os.environ["PATH"]=directory + ":" + os.environ["PATH"]
+    os.environ["PATH"]=directory + ":" + os.environ["PATH"]
 
 def add_ld_library_path(directory):
-   os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
+    os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
 
 def add_python_path(directory):
-   os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
-   sys.path[:0]=[directory]
+    os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
+    sys.path[:0]=[directory]
 
 # -----------------------------------------------------------------------------
 #
@@ -304,221 +304,220 @@ import orbmodule
 #
 
 def startGUI():
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Activation du GUI de Session Server
+    #
+
+    session.GetInterface()
 
-  #
-  # Activation du GUI de Session Server
-  #
-       
-  session.GetInterface()
-  
 #
 # -----------------------------------------------------------------------------
 #
 
 def startSalome():
 
-  #
-  # Lancement Session Loader
-  #
-  SessionLoader().run()
-
-  #
-  # Initialisation ORB et Naming Service
-  #
-  clt=orbmodule.client()
-
-  # (non obligatoire) Lancement Logger Server et attente de sa 
-  #  disponibilite dans le naming service
-  #
-  if with_logger:
-       LoggerServer().run()
-       clt.waitLogger("Logger")
-
-  #
-  # Lancement Registry Server
-  #
-  RegistryServer().run()
-
-  #
-  # Attente de la disponibilit� du Registry dans le Naming Service
-  #
-  clt.waitNS("/Registry")
-
-  #
-  # Lancement Catalog Server
-  #
-  cataServer=CatalogServer()
-  cataServer.setpath(liste_modules)
-  cataServer.run()
-
-  #
-  # Attente de la disponibilit� du Catalog Server dans le Naming Service
-  #
-  import SALOME_ModuleCatalog
-  clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
-
-  #
-  # Lancement SalomeDS Server
-  #
-  os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  SalomeDSServer().run()
-
-  if "GEOM" in liste_modules:
-       print "GEOM OCAF Resources"
-       os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
-
-
-  #
-  # Attente de la disponibilit� du SalomeDS dans le Naming Service
-  #
-  clt.waitNS("/Study")
-
-  #
-  # Lancement Session Server
-  #
-  SessionServer().run()
-
-  #
-  # Attente de la disponibilit� du Session Server dans le Naming Service
-  #
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
-
-  #
-  # Lancement containers
-  #
-  theComputer = os.getenv("HOSTNAME")
-  theComputer = theComputer.split('.')[0]
-
-  #
-  # Lancement Container C++ local
-  #
-  if with_container_cpp:
-         ContainerCPPServer().run()
-         #
-         # Attente de la disponibilit� du Container C++ local 
-          # dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
-  #
-  # Lancement Container Python local
-  #
-  if with_container_python:
-         ContainerPYServer().run()
-         #
-         # Attente de la disponibilit� du Container Python local 
-          #  dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
-
-  if with_container_superv:
-       #
-       # Lancement Container Supervision local
-       #
-       ContainerSUPERVServer().run()
-       #
-       # Attente de la disponibilit� du Container Supervision local 
+    #
+    # Lancement Session Loader
+    #
+    SessionLoader().run()
+
+    #
+    # Initialisation ORB et Naming Service
+    #
+    clt=orbmodule.client()
+
+    # (non obligatoire) Lancement Logger Server et attente de sa
+    #  disponibilite dans le naming service
+    #
+    if with_logger:
+        LoggerServer().run()
+        clt.waitLogger("Logger")
+
+    #
+    # Lancement Registry Server
+    #
+    RegistryServer().run()
+
+    #
+    # Attente de la disponibilit?? du Registry dans le Naming Service
+    #
+    clt.waitNS("/Registry")
+
+    #
+    # Lancement Catalog Server
+    #
+    cataServer=CatalogServer()
+    cataServer.setpath(liste_modules)
+    cataServer.run()
+
+    #
+    # Attente de la disponibilit?? du Catalog Server dans le Naming Service
+    #
+    import SALOME_ModuleCatalog
+    clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
+
+    #
+    # Lancement SalomeDS Server
+    #
+    os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    SalomeDSServer().run()
+
+    if "GEOM" in liste_modules:
+        print("GEOM OCAF Resources")
+        os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
+
+
+    #
+    # Attente de la disponibilit?? du SalomeDS dans le Naming Service
+    #
+    clt.waitNS("/myStudyManager")
+
+    #
+    # Lancement Session Server
+    #
+    SessionServer().run()
+
+    #
+    # Attente de la disponibilit?? du Session Server dans le Naming Service
+    #
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Lancement containers
+    #
+    theComputer = os.getenv("HOSTNAME")
+    theComputer = theComputer.split('.')[0]
+
+    #
+    # Lancement Container C++ local
+    #
+    if with_container_cpp:
+        ContainerCPPServer().run()
+        #
+        # Attente de la disponibilit?? du Container C++ local
         # dans le Naming Service
-       #
-       clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
-  #
-  # Activation du GUI de Session Server
-  #
-  #session.GetInterface()
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
+    #
+    # Lancement Container Python local
+    #
+    if with_container_python:
+        ContainerPYServer().run()
+        #
+        # Attente de la disponibilit?? du Container Python local
+        #  dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
+
+    if with_container_superv:
+        #
+        # Lancement Container Supervision local
+        #
+        ContainerSUPERVServer().run()
+        #
+        # Attente de la disponibilit?? du Container Supervision local
+        # dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
+    #
+    # Activation du GUI de Session Server
+    #
+    #session.GetInterface()
 
-  end_time = os.times()
-  print
-  print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])
+    end_time = os.times()
+    print()
+    print("Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]))
 
-  return clt
+    return clt
 
 #
 # -----------------------------------------------------------------------------
 #
 
 if __name__ == "__main__":
-   clt=None
-   try:
-      clt = startSalome()
-   except:
-      print
-      print
-      print "--- erreur au lancement Salome ---"
-   
-   #print process_id
-   
-   
-   filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-   #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-   
-   fpid=open(filedict, 'w')
-   pickle.dump(process_id,fpid)
-   fpid.close()
-   
-   print """
-
-Sauvegarde du dictionnaire des process dans , %s
-Pour tuer les process SALOME, executer : python killSalome.py depuis
-une console, ou bien killSalome() depuis le present interpreteur,
-s'il n'est pas ferm�.
-
-runSalome, avec l'option --killall, commence par tuer les process restants 
-d'une execution pr�c�dente.
-
-Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
-s'il n'est pas ferm�.
-
-""" % filedict
-   
-   #
-   #  Impression arborescence Naming Service
-   #
-   
-   if clt != None:
-     print
-     print " --- registered objects tree in Naming Service ---"
-     clt.showNS()
-     session=clt.waitNS("/Kernel/Session")
-     catalog=clt.waitNS("/Kernel/ModulCatalog")
-     import socket
-     container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
-   
-   if os.path.isfile("~/.salome/pystartup"):
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      PYTHONSTARTUP=f.read()
-      f.close()
-   else:
-      PYTHONSTARTUP="""
-# Add auto-completion and a stored history file of commands to your Python
-# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
-# bound to the TAB key by default (you can change it - see readline docs).
-#
-# Store the history in ~/.salome/pyhistory, 
-#
-import atexit
-import os
-import readline
-import rlcompleter
-readline.parse_and_bind('tab: complete')
+    clt=None
+    try:
+        clt = startSalome()
+    except:
+        print()
+        print()
+        print("--- erreur au lancement Salome ---")
+
+    #print process_id
+
+
+    filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+    #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+
+    fpid=open(filedict, 'w')
+    pickle.dump(process_id,fpid)
+    fpid.close()
+
+    print("""
+
+ Sauvegarde du dictionnaire des process dans , %s
+ Pour tuer les process SALOME, executer : python killSalome.py depuis
+ une console, ou bien killSalome() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ runSalome, avec l'option --killall, commence par tuer les process restants
+ d'une execution pr??c??dente.
+
+ Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ """ % filedict)
+
+    #
+    #  Impression arborescence Naming Service
+    #
+
+    if clt != None:
+        print()
+        print(" --- registered objects tree in Naming Service ---")
+        clt.showNS()
+        session=clt.waitNS("/Kernel/Session")
+        catalog=clt.waitNS("/Kernel/ModulCatalog")
+        import socket
+        container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
+
+    if os.path.isfile("~/.salome/pystartup"):
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        PYTHONSTARTUP=f.read()
+        f.close()
+    else:
+        PYTHONSTARTUP="""
+  # Add auto-completion and a stored history file of commands to your Python
+  # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
+  # bound to the TAB key by default (you can change it - see readline docs).
+  #
+  # Store the history in ~/.salome/pyhistory,
+  #
+  import atexit
+  import os
+  import readline
+  import rlcompleter
+  readline.parse_and_bind('tab: complete')
 
-historyPath = os.path.expanduser("~/.salome/pyhistory")
+  historyPath = os.path.expanduser("~/.salome/pyhistory")
 
-def save_history(historyPath=historyPath):
-    import readline
-    readline.write_history_file(historyPath)
+  def save_history(historyPath=historyPath):
+      import readline
+      readline.write_history_file(historyPath)
 
-if os.path.exists(historyPath):
-    readline.read_history_file(historyPath)
+  if os.path.exists(historyPath):
+      readline.read_history_file(historyPath)
 
-atexit.register(save_history)
-del os, atexit, readline, rlcompleter, save_history, historyPath
-"""
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      f.write(PYTHONSTARTUP)
-      f.close()
+  atexit.register(save_history)
+  del os, atexit, readline, rlcompleter, save_history, historyPath
+  """
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        f.write(PYTHONSTARTUP)
+        f.close()
 
-   exec PYTHONSTARTUP in {}
-   
+    exec(PYTHONSTARTUP, {})
index 336194cd20b7e7867771bc2f5f19adeaa4c6dd74..9a54816e8c0ced49b8a2ee78ebe4492aa2b6edac 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-mport salome
+import salome
 import HXX2SALOME_GENERIC_CLASS_NAME_ORB
 myHXX2SALOME_GENERIC_CLASS_NAME = salome.lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
 #
 #
-print "Hello HXX2SALOME_GENERIC_CLASS_NAME"
+print("Hello HXX2SALOME_GENERIC_CLASS_NAME")
 # Test here some of HXX2SALOME_GENERIC_CLASS_NAME methods ...
index 9307da0bdbfcd68913cce1338dfc2f1975b6cdda..b564b5de264d3a5754faa23132541f9009d206bf 100644 (file)
@@ -43,34 +43,34 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
 msgstr "Ceci est un simple test"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_CHECK"
-msgstr "Cochée"
+msgstr "Cochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_UNCHECK"
-msgstr "Décochée"
+msgstr "Décochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TITLE"
 msgstr "Dialogue example de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
-msgstr "Les préférences sont : \n\tCase Ã  cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
+msgstr "Les préférences sont : \n\tCase Ã  cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
 
 msgid "TLT_MY_NEW_ITEM"
-msgstr "Un article de menu propre Ã  HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Un article de menu propre Ã  HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_MY_NEW_ITEM"
 msgstr "Mon menu"
 
 msgid "STS_MY_NEW_ITEM"
-msgstr "Affiche une boîte de dialogue simple"
+msgstr "Affiche une boîte de dialogue simple"
 
 msgid "TLT_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "STS_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_FILE"
 msgstr "&File"
@@ -89,10 +89,10 @@ msgstr "HXX2SALOME_GENERIC_CLASS_NAME"
 #-------------------------------------------------------------------------
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_TAB_GENERAL"
-msgstr "Général"
+msgstr "Général"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_GROUP_DEFAULTS"
-msgstr "Valeurs par défaut"
+msgstr "Valeurs par défaut"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_BOOL"
 msgstr "Cochez-moi"
@@ -101,19 +101,19 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_INTEGER"
 msgstr "Entrez un entier :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPININT"
-msgstr "Cliquez sur les flèches (entier) :"
+msgstr "Cliquez sur les flèches (entier) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPINDBL"
-msgstr "Cliquez sur les flèches (double) :"
+msgstr "Cliquez sur les flèches (double) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SELECTOR"
 msgstr "Choisissez une option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_0"
-msgstr "Première option"
+msgstr "Première option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_1"
 msgstr "Seconde option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_2"
-msgstr "Troisième option"
+msgstr "Troisième option"
index 5124e064d59459ded0cacf3b46cacb4274479566..e5d83bec94901eb99066586a7bda54293328767c 100644 (file)
@@ -56,7 +56,7 @@ AC_DEFUN([CHECK_PYTHON],
   AC_SUBST(PYTHONHOME)
 
   changequote(<<, >>)dnl
-  PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+  PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[:3])"`
   changequote([, ])dnl
   AC_SUBST(PYTHON_VERSION)
 
@@ -79,7 +79,7 @@ AC_DEFUN([CHECK_PYTHON],
   dnl to know which OS Python thinks this is.
 
   AC_SUBST(PYTHON_PLATFORM)
-  PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+  PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
 
   AC_SUBST(PYTHON_SITE)
   AC_ARG_WITH(python-site,
index f5d4fdc5888e9acb6a69a1cfa7f2cec9987c6fed..301908db422bf375f1bac593da5c001c5cfa1104 100755 (executable)
@@ -78,12 +78,12 @@ $PYTHON -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules...'
+print('Byte-compiling python modules...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" || exit $?
@@ -93,12 +93,12 @@ $PYTHON -O -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules (optimized versions) ...'
+print('Byte-compiling python modules (optimized versions) ...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" 2>/dev/null || :
index aee8a99b4c516901dee6b97bbcadd01e05c06200..ab53018b439d78607f049758faf7a255e22d2e44 100755 (executable)
@@ -23,40 +23,40 @@ usage="""USAGE: runSalome.py [options]
 [command line options] :
 --help                        : affichage de l'aide
 --gui                         : lancement du GUI
---logger                     : redirection des messages dans un fichier
---xterm                              : les serveurs ouvrent une fen�tre xterm et les messages sont affich�s dans cette fen�tre
---modules=module1,module2,... : o� modulen est le nom d'un module Salome ï¿½ charger dans le catalogue
+--logger                      : redirection des messages dans un fichier
+--xterm                       : les serveurs ouvrent une fen??tre xterm et les messages sont affich??s dans cette fen??tre
+--modules=module1,module2,... : o?? modulen est le nom d'un module Salome ?? charger dans le catalogue
 --containers=cpp,python,superv: lancement des containers cpp, python et de supervision
---killall                    : arr�t des serveurs de salome
+--killall                     : arr??t des serveurs de salome
 
- La variable d'environnement <modulen>_ROOT_DIR doit etre pr�alablement
- positionn�e (modulen doit etre en majuscule).
+ La variable d'environnement <modulen>_ROOT_DIR doit etre pr??alablement
+ positionn??e (modulen doit etre en majuscule).
  KERNEL_ROOT_DIR est obligatoire.
 """
 
 # -----------------------------------------------------------------------------
 #
-# Fonction d'arr�t de salome
+# Fonction d'arr??t de salome
 #
 
 def killSalome():
-   print "arret des serveurs SALOME"
-   for pid, cmd in process_id.items():
-      print "arret du process %s : %s"% (pid, cmd[0])
-      try:
-       os.kill(pid,signal.SIGKILL)
-      except:
-         print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-   print "arret du naming service"
-   os.system("killall -9 omniNames")
-   
+    print("arret des serveurs SALOME")
+    for pid, cmd in list(process_id.items()):
+        print("arret du process %s : %s"% (pid, cmd[0]))
+        try:
+            os.kill(pid,signal.SIGKILL)
+        except:
+            print("  ------------------ process %s : %s inexistant"% (pid, cmd[0]))
+    print("arret du naming service")
+    os.system("killall -9 omniNames")
+
 # -----------------------------------------------------------------------------
 #
 # Fonction message
 #
 
 def message(code, msg=''):
-    if msg: print msg
+    if msg: print(msg)
     sys.exit(code)
 
 import sys,os,string,glob,time,signal,pickle,getopt
@@ -76,79 +76,79 @@ with_container_python=0
 with_container_superv=0
 
 try:
-  for o, a in opts:
-    if o in ('-h', '--help'):
-      print usage
-      sys.exit(1)
-    elif o in ('-g', '--gui'):
-      with_gui=1
-    elif o in ('-l', '--logger'):
-      with_logger=1
-    elif o in ('-x', '--xterm'):
-      with_xterm=1
-    elif o in ('-m', '--modules'):
-      liste_modules = [x.upper() for x in a.split(',')]
-    elif o in ('-c', '--containers'):
-      liste_containers = [x.lower() for x in a.split(',')]
-      for r in liste_containers:
-        if r not in ('cpp', 'python', 'superv'):
-          message(1, 'Invalid -c/--containers option: %s' % a)
-      if 'cpp' in liste_containers:
-          with_container_cpp=1
-      else:
-          with_container_cpp=0
-      if 'python' in liste_containers:
-          with_container_python=1
-      else:
-          with_container_python=0
-      if 'superv' in liste_containers:
-          with_container_superv=1
-      else:
-          with_container_superv=0
-    elif o in ('-k', '--killall'):
-      filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-      #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-      found = 0
-      try:
-         fpid=open(filedict, 'r')
-        found = 1
-      except:
-         print "le fichier %s des process SALOME n'est pas accessible"% filedict
-
-      if found:
-         process_id=pickle.load(fpid)
-         fpid.close()
-         killSalome()
-        process_id={}
-         os.remove(filedict)
-       
-except getopt.error, msg:
-  print usage
-  sys.exit(1)
+    for o, a in opts:
+        if o in ('-h', '--help'):
+            print(usage)
+            sys.exit(1)
+        elif o in ('-g', '--gui'):
+            with_gui=1
+        elif o in ('-l', '--logger'):
+            with_logger=1
+        elif o in ('-x', '--xterm'):
+            with_xterm=1
+        elif o in ('-m', '--modules'):
+            liste_modules = [x.upper() for x in a.split(',')]
+        elif o in ('-c', '--containers'):
+            liste_containers = [x.lower() for x in a.split(',')]
+            for r in liste_containers:
+                if r not in ('cpp', 'python', 'superv'):
+                    message(1, 'Invalid -c/--containers option: %s' % a)
+            if 'cpp' in liste_containers:
+                with_container_cpp=1
+            else:
+                with_container_cpp=0
+            if 'python' in liste_containers:
+                with_container_python=1
+            else:
+                with_container_python=0
+            if 'superv' in liste_containers:
+                with_container_superv=1
+            else:
+                with_container_superv=0
+        elif o in ('-k', '--killall'):
+            filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+            #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+            found = 0
+            try:
+                fpid=open(filedict, 'r')
+                found = 1
+            except:
+                print("le fichier %s des process SALOME n'est pas accessible"% filedict)
+
+            if found:
+                process_id=pickle.load(fpid)
+                fpid.close()
+                killSalome()
+                process_id={}
+                os.remove(filedict)
+
+except getopt.error as msg:
+    print(usage)
+    sys.exit(1)
 
 # -----------------------------------------------------------------------------
 #
-# V�rification des variables d'environnement
+# V??rification des variables d'environnement
 #
 try:
-  kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
-  modules_root_dir["KERNEL"]=kernel_root_dir
+    kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+    modules_root_dir["KERNEL"]=kernel_root_dir
 except:
-  print usage
-  sys.exit(1)
+    print(usage)
+    sys.exit(1)
 
 for module in liste_modules :
-   try:
-      module=module.upper()
-      module_root_dir=os.environ[module +"_ROOT_DIR"]
-      modules_root_dir[module]=module_root_dir
-   except:
-      print usage
-      sys.exit(1)
+    try:
+        module=module.upper()
+        module_root_dir=os.environ[module +"_ROOT_DIR"]
+        modules_root_dir[module]=module_root_dir
+    except:
+        print(usage)
+        sys.exit(1)
 
 # il faut KERNEL en premier dans la liste des modules
 # - l'ordre des modules dans le catalogue sera identique
-# - la liste des modules presents dans le catalogue est exploit�e pour charger les modules CORBA python,
+# - la liste des modules presents dans le catalogue est exploit??e pour charger les modules CORBA python,
 #   il faut charger les modules python du KERNEL en premier
 
 if "KERNEL" in liste_modules:liste_modules.remove("KERNEL")
@@ -156,75 +156,75 @@ liste_modules[:0]=["KERNEL"]
 #print liste_modules
 #print modules_root_dir
 
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(list(modules_root_dir.values()))
 if "SUPERV" in liste_modules:with_container_superv=1
 
 
 # -----------------------------------------------------------------------------
 #
-# D�finition des classes d'objets pour le lancement des Server CORBA
+# D??finition des classes d'objets pour le lancement des Server CORBA
 #
 
 class Server:
-   CMD=[]
-   if with_xterm:
-       ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
-   else:
-       ARGS=[] 
-
-   def run(self):
-      args = self.ARGS+self.CMD
-      #print "args = ", args
-      pid = os.spawnvp(os.P_NOWAIT, args[0], args)
-      process_id[pid]=self.CMD
+    CMD=[]
+    if with_xterm:
+        ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
+    else:
+        ARGS=[]
+
+    def run(self):
+        args = self.ARGS+self.CMD
+        #print "args = ", args
+        pid = os.spawnvp(os.P_NOWAIT, args[0], args)
+        process_id[pid]=self.CMD
 
 class CatalogServer(Server):
-   SCMD1=['SALOME_ModuleCatalog_Server','-common']
-   SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml'] 
-
-   def setpath(self,liste_modules):
-      cata_path=[]
-      for module in liste_modules:
-          module_root_dir=modules_root_dir[module]
-          module_cata=module+"Catalog.xml"
-          print "   ", module_cata
-          cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
-      self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+    SCMD1=['SALOME_ModuleCatalog_Server','-common']
+    SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml']
+
+    def setpath(self,liste_modules):
+        cata_path=[]
+        for module in liste_modules:
+            module_root_dir=modules_root_dir[module]
+            module_cata=module+"Catalog.xml"
+            print("   ", module_cata)
+            cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
+        self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
 class SalomeDSServer(Server):
-   CMD=['SALOMEDS_Server']
+    CMD=['SALOMEDS_Server']
 
 class RegistryServer(Server):
-   CMD=['SALOME_Registry_Server', '--salome_session','theSession']
+    CMD=['SALOME_Registry_Server', '--salome_session','theSession']
 
 class ContainerCPPServer(Server):
-   CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerPYServer(Server):
-   CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerSUPERVServer(Server):
-   CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
 
 class LoggerServer(Server):
-   CMD=['SALOME_Logger_Server', 'logger.log']
+    CMD=['SALOME_Logger_Server', 'logger.log']
 
 class SessionLoader(Server):
-   CMD=['SALOME_Session_Loader']
-   if with_container_cpp:
-       CMD=CMD+['CPP']
-   if with_container_python:
-       CMD=CMD+['PY']
-   if with_container_superv:
-       CMD=CMD+['SUPERV']
-   if with_gui:
-       CMD=CMD+['GUI']
+    CMD=['SALOME_Session_Loader']
+    if with_container_cpp:
+        CMD=CMD+['CPP']
+    if with_container_python:
+        CMD=CMD+['PY']
+    if with_container_superv:
+        CMD=CMD+['SUPERV']
+    if with_gui:
+        CMD=CMD+['GUI']
 
 class SessionServer(Server):
-   CMD=['SALOME_Session_Server']
+    CMD=['SALOME_Session_Server']
 
 class NotifyServer(Server):
-   CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
+    CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
 
 # -----------------------------------------------------------------------------
 #
@@ -232,16 +232,16 @@ class NotifyServer(Server):
 #
 
 def test(clt):
-   """
-        Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
-        usage : hello=test(clt)
-   """
-   # create an LifeCycleCORBA instance
-   import LifeCycleCORBA 
-   lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
-   import HXX2SALOME_GENERIC_CLASS_NAME_ORB
-   hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
-   return hello
+    """
+         Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
+         usage : hello=test(clt)
+    """
+    # create an LifeCycleCORBA instance
+    import LifeCycleCORBA
+    lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
+    import HXX2SALOME_GENERIC_CLASS_NAME_ORB
+    hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
+    return hello
 
 # -----------------------------------------------------------------------------
 #
@@ -249,14 +249,14 @@ def test(clt):
 #
 
 def add_path(directory):
-   os.environ["PATH"]=directory + ":" + os.environ["PATH"]
+    os.environ["PATH"]=directory + ":" + os.environ["PATH"]
 
 def add_ld_library_path(directory):
-   os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
+    os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
 
 def add_python_path(directory):
-   os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
-   sys.path[:0]=[directory]
+    os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
+    sys.path[:0]=[directory]
 
 # -----------------------------------------------------------------------------
 #
@@ -304,221 +304,220 @@ import orbmodule
 #
 
 def startGUI():
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Activation du GUI de Session Server
+    #
+
+    session.GetInterface()
 
-  #
-  # Activation du GUI de Session Server
-  #
-       
-  session.GetInterface()
-  
 #
 # -----------------------------------------------------------------------------
 #
 
 def startSalome():
 
-  #
-  # Lancement Session Loader
-  #
-  SessionLoader().run()
-
-  #
-  # Initialisation ORB et Naming Service
-  #
-  clt=orbmodule.client()
-
-  # (non obligatoire) Lancement Logger Server et attente de sa 
-  #  disponibilite dans le naming service
-  #
-  if with_logger:
-       LoggerServer().run()
-       clt.waitLogger("Logger")
-
-  #
-  # Lancement Registry Server
-  #
-  RegistryServer().run()
-
-  #
-  # Attente de la disponibilit� du Registry dans le Naming Service
-  #
-  clt.waitNS("/Registry")
-
-  #
-  # Lancement Catalog Server
-  #
-  cataServer=CatalogServer()
-  cataServer.setpath(liste_modules)
-  cataServer.run()
-
-  #
-  # Attente de la disponibilit� du Catalog Server dans le Naming Service
-  #
-  import SALOME_ModuleCatalog
-  clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
-
-  #
-  # Lancement SalomeDS Server
-  #
-  os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  SalomeDSServer().run()
-
-  if "GEOM" in liste_modules:
-       print "GEOM OCAF Resources"
-       os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
-
-
-  #
-  # Attente de la disponibilit� du SalomeDS dans le Naming Service
-  #
-  clt.waitNS("/Study")
-
-  #
-  # Lancement Session Server
-  #
-  SessionServer().run()
-
-  #
-  # Attente de la disponibilit� du Session Server dans le Naming Service
-  #
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
-
-  #
-  # Lancement containers
-  #
-  theComputer = os.getenv("HOSTNAME")
-  theComputer = theComputer.split('.')[0]
-
-  #
-  # Lancement Container C++ local
-  #
-  if with_container_cpp:
-         ContainerCPPServer().run()
-         #
-         # Attente de la disponibilit� du Container C++ local 
-          # dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
-  #
-  # Lancement Container Python local
-  #
-  if with_container_python:
-         ContainerPYServer().run()
-         #
-         # Attente de la disponibilit� du Container Python local 
-          #  dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
-
-  if with_container_superv:
-       #
-       # Lancement Container Supervision local
-       #
-       ContainerSUPERVServer().run()
-       #
-       # Attente de la disponibilit� du Container Supervision local 
+    #
+    # Lancement Session Loader
+    #
+    SessionLoader().run()
+
+    #
+    # Initialisation ORB et Naming Service
+    #
+    clt=orbmodule.client()
+
+    # (non obligatoire) Lancement Logger Server et attente de sa
+    #  disponibilite dans le naming service
+    #
+    if with_logger:
+        LoggerServer().run()
+        clt.waitLogger("Logger")
+
+    #
+    # Lancement Registry Server
+    #
+    RegistryServer().run()
+
+    #
+    # Attente de la disponibilit?? du Registry dans le Naming Service
+    #
+    clt.waitNS("/Registry")
+
+    #
+    # Lancement Catalog Server
+    #
+    cataServer=CatalogServer()
+    cataServer.setpath(liste_modules)
+    cataServer.run()
+
+    #
+    # Attente de la disponibilit?? du Catalog Server dans le Naming Service
+    #
+    import SALOME_ModuleCatalog
+    clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
+
+    #
+    # Lancement SalomeDS Server
+    #
+    os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    SalomeDSServer().run()
+
+    if "GEOM" in liste_modules:
+        print("GEOM OCAF Resources")
+        os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
+
+
+    #
+    # Attente de la disponibilit?? du SalomeDS dans le Naming Service
+    #
+    clt.waitNS("/myStudyManager")
+
+    #
+    # Lancement Session Server
+    #
+    SessionServer().run()
+
+    #
+    # Attente de la disponibilit?? du Session Server dans le Naming Service
+    #
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Lancement containers
+    #
+    theComputer = os.getenv("HOSTNAME")
+    theComputer = theComputer.split('.')[0]
+
+    #
+    # Lancement Container C++ local
+    #
+    if with_container_cpp:
+        ContainerCPPServer().run()
+        #
+        # Attente de la disponibilit?? du Container C++ local
         # dans le Naming Service
-       #
-       clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
-  #
-  # Activation du GUI de Session Server
-  #
-  #session.GetInterface()
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
+    #
+    # Lancement Container Python local
+    #
+    if with_container_python:
+        ContainerPYServer().run()
+        #
+        # Attente de la disponibilit?? du Container Python local
+        #  dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
+
+    if with_container_superv:
+        #
+        # Lancement Container Supervision local
+        #
+        ContainerSUPERVServer().run()
+        #
+        # Attente de la disponibilit?? du Container Supervision local
+        # dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
+    #
+    # Activation du GUI de Session Server
+    #
+    #session.GetInterface()
 
-  end_time = os.times()
-  print
-  print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])
+    end_time = os.times()
+    print()
+    print("Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]))
 
-  return clt
+    return clt
 
 #
 # -----------------------------------------------------------------------------
 #
 
 if __name__ == "__main__":
-   clt=None
-   try:
-      clt = startSalome()
-   except:
-      print
-      print
-      print "--- erreur au lancement Salome ---"
-   
-   #print process_id
-   
-   
-   filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-   #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-   
-   fpid=open(filedict, 'w')
-   pickle.dump(process_id,fpid)
-   fpid.close()
-   
-   print """
-
-Sauvegarde du dictionnaire des process dans , %s
-Pour tuer les process SALOME, executer : python killSalome.py depuis
-une console, ou bien killSalome() depuis le present interpreteur,
-s'il n'est pas ferm�.
-
-runSalome, avec l'option --killall, commence par tuer les process restants 
-d'une execution pr�c�dente.
-
-Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
-s'il n'est pas ferm�.
-
-""" % filedict
-   
-   #
-   #  Impression arborescence Naming Service
-   #
-   
-   if clt != None:
-     print
-     print " --- registered objects tree in Naming Service ---"
-     clt.showNS()
-     session=clt.waitNS("/Kernel/Session")
-     catalog=clt.waitNS("/Kernel/ModulCatalog")
-     import socket
-     container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
-   
-   if os.path.isfile("~/.salome/pystartup"):
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      PYTHONSTARTUP=f.read()
-      f.close()
-   else:
-      PYTHONSTARTUP="""
-# Add auto-completion and a stored history file of commands to your Python
-# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
-# bound to the TAB key by default (you can change it - see readline docs).
-#
-# Store the history in ~/.salome/pyhistory, 
-#
-import atexit
-import os
-import readline
-import rlcompleter
-readline.parse_and_bind('tab: complete')
+    clt=None
+    try:
+        clt = startSalome()
+    except:
+        print()
+        print()
+        print("--- erreur au lancement Salome ---")
+
+    #print process_id
+
+
+    filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+    #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+
+    fpid=open(filedict, 'w')
+    pickle.dump(process_id,fpid)
+    fpid.close()
+
+    print("""
+
+ Sauvegarde du dictionnaire des process dans , %s
+ Pour tuer les process SALOME, executer : python killSalome.py depuis
+ une console, ou bien killSalome() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ runSalome, avec l'option --killall, commence par tuer les process restants
+ d'une execution pr??c??dente.
+
+ Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ """ % filedict)
+
+    #
+    #  Impression arborescence Naming Service
+    #
+
+    if clt != None:
+        print()
+        print(" --- registered objects tree in Naming Service ---")
+        clt.showNS()
+        session=clt.waitNS("/Kernel/Session")
+        catalog=clt.waitNS("/Kernel/ModulCatalog")
+        import socket
+        container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
+
+    if os.path.isfile("~/.salome/pystartup"):
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        PYTHONSTARTUP=f.read()
+        f.close()
+    else:
+        PYTHONSTARTUP="""
+  # Add auto-completion and a stored history file of commands to your Python
+  # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
+  # bound to the TAB key by default (you can change it - see readline docs).
+  #
+  # Store the history in ~/.salome/pyhistory,
+  #
+  import atexit
+  import os
+  import readline
+  import rlcompleter
+  readline.parse_and_bind('tab: complete')
 
-historyPath = os.path.expanduser("~/.salome/pyhistory")
+  historyPath = os.path.expanduser("~/.salome/pyhistory")
 
-def save_history(historyPath=historyPath):
-    import readline
-    readline.write_history_file(historyPath)
+  def save_history(historyPath=historyPath):
+      import readline
+      readline.write_history_file(historyPath)
 
-if os.path.exists(historyPath):
-    readline.read_history_file(historyPath)
+  if os.path.exists(historyPath):
+      readline.read_history_file(historyPath)
 
-atexit.register(save_history)
-del os, atexit, readline, rlcompleter, save_history, historyPath
-"""
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      f.write(PYTHONSTARTUP)
-      f.close()
+  atexit.register(save_history)
+  del os, atexit, readline, rlcompleter, save_history, historyPath
+  """
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        f.write(PYTHONSTARTUP)
+        f.close()
 
-   exec PYTHONSTARTUP in {}
-   
+    exec(PYTHONSTARTUP, {})
index d6e900b30e6c0be041761d67eebaf95637253792..f0b8e5dc63a065ba37cc71b50b283aea6a4e990e 100755 (executable)
@@ -107,40 +107,32 @@ import sys, os, string, py_compile
 
 files = '''$files'''
 
-print 'Byte-compiling python modules...'
+print('Byte-compiling python modules...')
 for file in string.split(files):
     $pathtrans
     $filetrans
     if not os.path.exists(filepath) or not (len(filepath) >= 3
                                             and filepath[-3:] == '.py'):
-       continue
-    print file,
+        continue
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(filepath, filepath + 'c', path)
-print" || exit $?
+print()" || exit $?
 
 # this will fail for python < 1.5, but that doesn't matter ...
 $PYTHON -O -c "
 import sys, os, string, py_compile
 
 files = '''$files'''
-print 'Byte-compiling python modules (optimized versions) ...'
+print('Byte-compiling python modules (optimized versions) ...')
 for file in string.split(files):
     $pathtrans
     $filetrans
     if not os.path.exists(filepath) or not (len(filepath) >= 3
                                             and filepath[-3:] == '.py'):
-       continue
-    print file,
+        continue
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(filepath, filepath + 'o', path)
-print" 2>/dev/null || :
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+print()" 2>/dev/null || :
+
index 9307da0bdbfcd68913cce1338dfc2f1975b6cdda..b564b5de264d3a5754faa23132541f9009d206bf 100644 (file)
@@ -43,34 +43,34 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
 msgstr "Ceci est un simple test"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_CHECK"
-msgstr "Cochée"
+msgstr "Cochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_UNCHECK"
-msgstr "Décochée"
+msgstr "Décochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TITLE"
 msgstr "Dialogue example de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
-msgstr "Les préférences sont : \n\tCase Ã  cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
+msgstr "Les préférences sont : \n\tCase Ã  cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
 
 msgid "TLT_MY_NEW_ITEM"
-msgstr "Un article de menu propre Ã  HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Un article de menu propre Ã  HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_MY_NEW_ITEM"
 msgstr "Mon menu"
 
 msgid "STS_MY_NEW_ITEM"
-msgstr "Affiche une boîte de dialogue simple"
+msgstr "Affiche une boîte de dialogue simple"
 
 msgid "TLT_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "STS_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_FILE"
 msgstr "&File"
@@ -89,10 +89,10 @@ msgstr "HXX2SALOME_GENERIC_CLASS_NAME"
 #-------------------------------------------------------------------------
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_TAB_GENERAL"
-msgstr "Général"
+msgstr "Général"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_GROUP_DEFAULTS"
-msgstr "Valeurs par défaut"
+msgstr "Valeurs par défaut"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_BOOL"
 msgstr "Cochez-moi"
@@ -101,19 +101,19 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_INTEGER"
 msgstr "Entrez un entier :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPININT"
-msgstr "Cliquez sur les flèches (entier) :"
+msgstr "Cliquez sur les flèches (entier) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPINDBL"
-msgstr "Cliquez sur les flèches (double) :"
+msgstr "Cliquez sur les flèches (double) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SELECTOR"
 msgstr "Choisissez une option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_0"
-msgstr "Première option"
+msgstr "Première option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_1"
 msgstr "Seconde option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_2"
-msgstr "Troisième option"
+msgstr "Troisième option"
index 336194cd20b7e7867771bc2f5f19adeaa4c6dd74..9a54816e8c0ced49b8a2ee78ebe4492aa2b6edac 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-mport salome
+import salome
 import HXX2SALOME_GENERIC_CLASS_NAME_ORB
 myHXX2SALOME_GENERIC_CLASS_NAME = salome.lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
 #
 #
-print "Hello HXX2SALOME_GENERIC_CLASS_NAME"
+print("Hello HXX2SALOME_GENERIC_CLASS_NAME")
 # Test here some of HXX2SALOME_GENERIC_CLASS_NAME methods ...
index d9d71f8ad893c26655a1763d2b0ca98c8f27dbc6..c14d066dd0bcad67a119dd31cc44962b92cbc513 100755 (executable)
@@ -388,5 +388,5 @@ BEGIN {
 #
 #
 END {
-# CNC peut Ãªtre mis dans le template directement printf "\nprivate:\n    std::auto_ptr<%s> cppImpl_;\n",class_name >> hxx_file
+# CNC peut Ãªtre mis dans le template directement printf "\nprivate:\n    std::auto_ptr<%s> cppImpl_;\n",class_name >> hxx_file
 }
index 71a9807f818689ea6286e6f49d71ebd45c1ca2e7..1754ea07142bbc3a865ef03190e66f69ad841409 100644 (file)
@@ -51,6 +51,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index e226522b3c34ec1c131f64e3550e5eb45dbce721..5595702639493acb199d2f648e8ecbf813534421 100644 (file)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index aded3b161eb7f4af0db340bb80590ba129de1faf..15d995133fb905af2d681552804c0d661e639a4b 100644 (file)
@@ -53,16 +53,20 @@ int driverTest(Proc* &p, const char* schema)
 
   YACSLoader loader;
   Executor executor;
-  
   try
     {
       p=loader.load(schema);
+        
+      std::cerr << __FILE__ << std::endl;
       DEBTRACE("Proc *p = " << p);
       std::ofstream f("toto");
       p->writeDot(f);
       f.close();
       DEBTRACE("+++++++++++++++++++ BEGIN execution " << schema);
+      std::cerr << __FILE__ << std::endl;    
       executor.RunW(p,0);
+      std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("+++++++++++++++++++   END execution " << schema);
       std::ofstream g("titi");
       p->writeDot(g);
@@ -73,13 +77,20 @@ int driverTest(Proc* &p, const char* schema)
   catch (YACS::Exception& e)
     {
       DEBTRACE("YACS exception caught: ");
+        std::cerr << __FILE__ << std::endl;
       DEBTRACE(e.what());
+        std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
       return 1;
     }
   catch (const std::ios_base::failure&)
     {
+        std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("io failure");
+  std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
       return 1;
     }
@@ -92,10 +103,13 @@ int driverTest(Proc* &p, const char* schema)
       const char *p = tc->name();
       if ( *p != '\0' )
         {
+            std::cerr << __FILE__ << std::endl;
+
           DEBTRACE(p);
         }
       else
         {
+  std::cerr << __FILE__ << std::endl;
           DEBTRACE(tc->id());
         }
       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
@@ -238,7 +252,7 @@ void YacsLoaderTest::eschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyString_AsString(data);
+      char *text = PyUnicode_AsUTF8(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
       delete p;
     }
@@ -254,7 +268,7 @@ void YacsLoaderTest::fschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyString_AsString(data);;
+      char *text = PyUnicode_AsUTF8(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
       delete p;
     }
index ce286e163e18e3b393fc32508b2a545388fd7cb5..993fbc0465aa788b7ae349da767a7e9196c8e897 100644 (file)
@@ -52,7 +52,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def startToTakeDecision(self):
     """This method is called only once to launch the algorithm. It must
@@ -66,7 +66,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
        pool, do nothing (wait for more samples), or empty the pool and
        return to finish the evaluation.
     """
-    print "startToTakeDecision"
+    print("startToTakeDecision")
     # fill the pool with samples
     iter=0
     self.pool.pushInSample(0, 0.5)
@@ -77,7 +77,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
       currentId=self.pool.getCurrentId()
       valIn = self.pool.getCurrentInSample().getDoubleValue()
       valOut = self.pool.getCurrentOutSample().getIntValue()
-      print "Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+      print("Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
       iter=iter+1
       
       if iter < 3:
@@ -89,7 +89,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index 8c03ab25aa8825fcae59e2609e54fe4a589efa3f..d5bed597d2328d07c07fc152083b7cf332f7bb95 100644 (file)
@@ -52,11 +52,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 0.5)
@@ -69,7 +69,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getDoubleValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -80,7 +80,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index 3cb08f02fc67e63588415dde2a343e0aa865addc..c129dbf5e5c0cdce44d6b75a2ce834f498904b28 100644 (file)
@@ -34,7 +34,7 @@ obj         = orb.resolve_initial_references("NameService")
 rootContext = obj._narrow(CosNaming.NamingContext)
 
 if rootContext is None:
-    print "Failed to narrow the root naming context"
+    print("Failed to narrow the root naming context")
     sys.exit(1)
 
 # Resolve the name "test.my_context/Echo.Object"
@@ -44,22 +44,22 @@ name = [CosNaming.NameComponent("test", "my_context"),
 try:
     obj = rootContext.resolve(name)
 
-except CosNaming.NamingContext.NotFound, ex:
-    print "Name not found"
+except CosNaming.NamingContext.NotFound as ex:
+    print("Name not found")
     sys.exit(1)
 
 # Narrow the object to an eo::Echo
 echo = obj._narrow(eo.Echo)
 
 if echo is None:
-    print "Object reference is not an eo::Echo"
+    print("Object reference is not an eo::Echo")
     sys.exit(1)
 
 # Invoke the echoString operation
 message = "Hello from Python"
 result  = echo.echoString(message)
 
-print "I said '%s'. The object said '%s'." % (message,result)
+print("I said '%s'. The object said '%s'." % (message,result))
 
 """
   struct S1
@@ -80,32 +80,32 @@ s1=eo.S1(x=1,y=2,s="aa",b=True,vd=[1,2])
 s2=eo.S2(s1)
 
 r=echo.echoStruct(s2)
-print r
+print(r)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=None)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 ob=echo.createObj(3)
-print ob
+print(ob)
 oc=echo.createC()
-print oc
+print(oc)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=ob)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=oc)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 r=echo.echoObjectVec([ob,ob])
-print r
+print(r)
 
 r=echo.echoObjectVec([oc,oc])
-print r
+print(r)
 
 r=echo.echoObjectVec([ob,oc])
-print r
+print(r)
 
 #echo.shutdown()
index 4d6e8b0503e34313bf929718d357894fc87d2548..bf41ea19a56bb8c0ecaac27bb806ee3038f56d14 100644 (file)
@@ -26,7 +26,7 @@ def triangle(n):
     The last node gives the sum of rank n (=2**n) and also a direct calculation of 2**n.
     """
        
-    print """
+    print("""
 <proc>
     <!-- types -->
     <!-- inline -->
@@ -34,60 +34,60 @@ def triangle(n):
 <inline name="node_0_0" >
 <script><code>
 import time
-from decimal import *"""
-    print "getcontext().prec = " + str(1+n/3)
-    print """
+from decimal import *""")
+    print("getcontext().prec = " + str(1+n/3))
+    print("""
 aa=Decimal(a)
 bb=Decimal(b)
 cc=aa+bb
 c=str(cc)
-print "cc=",cc
+print("cc=",cc)
 time.sleep(1)
 </code></script>
 <inport name="a" type="string"/>
 <inport name="b" type="string"/>
 <outport name="c" type="string"/>
-</inline>"""
+</inline>""")
 
-    print """
+    print("""
 <inline name="collect" >
-<script><code>"""
-    print "import time"
-    print "from decimal import *"
-    print "getcontext().prec = " + str(1+n/3)
-    print "tot = Decimal(0)"
-    print "for i in range (" + str(n+1) + "):"
-    print "    v='a' + str(i)"
-    print "    tot+=Decimal(eval(v))"
-    print "print tot"
-    print "result=str(tot)"
-    print "ref=Decimal(2)**" + str(n)
-    print "reference=str(ref)"
-    print "time.sleep(1)"
-    print "</code></script>"
+<script><code>""")
+    print("import time")
+    print("from decimal import *")
+    print("getcontext().prec = " + str(1+n/3))
+    print("tot = Decimal(0)")
+    print("for i in range (" + str(n+1) + "):")
+    print("    v='a' + str(i)")
+    print("    tot+=Decimal(eval(v))")
+    print("print(tot)")
+    print("result=str(tot)")
+    print("ref=Decimal(2)**" + str(n))
+    print("reference=str(ref)")
+    print("time.sleep(1)")
+    print("</code></script>")
     for i in range (n+1):
         inport='<inport name="a' + str(i) + '" type="string"/>'
-        print inport
+        print(inport)
         pass
-    print '<outport name="result" type="string"/>'
-    print '<outport name="reference" type="string"/>'
-    print "</inline>"
-    print
+    print('<outport name="result" type="string"/>')
+    print('<outport name="reference" type="string"/>')
+    print("</inline>")
+    print()
     
     for i in range (1,n+1):
         for j in range (i+1):
             node="node_" + str(i)   +"_" + str(j)
             nodetxt='<node name="'+node+'" type="node_0_0"></node>'
-            print nodetxt
+            print(nodetxt)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- service -->
     <!-- control -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -96,21 +96,21 @@ time.sleep(1)
             tonode2="node_" + str(i+1)   +"_" + str(j+1)
             control1='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode1+'</tonode> </control>'
             control2='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode2+'</tonode> </control>'
-            print control1
-            print control2
+            print(control1)
+            print(control2)
             pass
         pass
     for i in range (n+1):
         fromnode="node_" + str(n)   +"_" + str(i)
         control='<control> <fromnode>'+fromnode+'</fromnode> <tonode>collect</tonode> </control>'
-        print control
+        print(control)
         pass
 
-    print """
+    print("""
 
     <!-- datalinks -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -120,14 +120,14 @@ time.sleep(1)
             datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
             datato1 ='<tonode>'   + tonode1  + '</tonode> <toport>b</toport>'
             datato2 ='<tonode>'   + tonode2  + '</tonode> <toport>a</toport>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato1
-            print '</datalink>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato2
-            print '</datalink>'
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato1)
+            print('</datalink>')
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato2)
+            print('</datalink>')
             pass
         pass
     for i in range (n+1):
@@ -135,19 +135,19 @@ time.sleep(1)
         datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
         toport='a' + str(i)
         datato  ='<tonode>collect</tonode> <toport>' + toport + '</toport>'
-        print '<datalink>'
-        print '   ' + datafrom
-        print '   ' + datato
-        print '</datalink>'
+        print('<datalink>')
+        print('   ' + datafrom)
+        print('   ' + datato)
+        print('</datalink>')
         
         
-    print """
+    print("""
 
     <!--parameters -->
 
-    """
+    """)
 
-    print """
+    print("""
     <parameter>
         <tonode>node_0_0</tonode> <toport>a</toport>
         <value><string>0</string></value>
@@ -156,27 +156,27 @@ time.sleep(1)
         <tonode>node_0_0</tonode> <toport>b</toport>
         <value><string>1</string></value>
     </parameter>
-    """
+    """)
 
     for i in range (1,n+1):
         node1="node_" + str(i)   +"_" + str(0)
         node2="node_" + str(i)   +"_" + str(i)
         tonode1 ='   <tonode>' + node1 + '</tonode> <toport>a</toport>'
         tonode2 ='   <tonode>' + node2 + '</tonode> <toport>b</toport>'
-        print '<parameter>'
-        print tonode1
-        print '   <value><string>0</string></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode1)
+        print('   <value><string>0</string></value>')
+        print('</parameter>')
         
-        print '<parameter>'
-        print tonode2
-        print '   <value><string>0</string></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode2)
+        print('   <value><string>0</string></value>')
+        print('</parameter>')
 
-    print """
+    print("""
 
 </proc>
-    """
+    """)
      
 if __name__ == "__main__":
     import sys
@@ -188,7 +188,7 @@ if __name__ == "__main__":
         if rank <2:
             raise ValueError("rank must be >1")
     except (IndexError, ValueError):
-        print usage%(sys.argv[0])
+        print(usage%(sys.argv[0]))
         sys.exit(1)
         pass
     triangle(rank)
index d3e45b9c64cc0c1f5fe4ff2599584239e24a7eaf..27df4d950b829f6bc8402e4f970f8de9da238d28 100644 (file)
@@ -26,7 +26,7 @@ debut="""
 <inline name="node_0_0" >
 <script><code>
 c=a+b
-print c
+print(c)
 </code></script>
 <inport name="a" type="int"/>
 <inport name="b" type="int"/>
@@ -45,43 +45,43 @@ def triangle(n):
     The last node gives the sum of rank n (=2**n) and also a direct calculation of 2**n.
     """
     
-    print debut
+    print(debut)
     
-    print """
+    print("""
 <inline name="collect" >
-<script><code>"""
-    print "tot = 0"
-    print "for i in range (" + str(n+1) + "):"
-    print "    v='a' + str(i)"
-    print "    tot+=eval(v)"
-    print "result=tot"
-    print "print result"
-    print "reference=2**" + str(n)
-    print "print reference"
-    print "</code></script>"
+<script><code>""")
+    print("tot = 0")
+    print("for i in range (" + str(n+1) + "):")
+    print("    v='a' + str(i)")
+    print("    tot+=eval(v)")
+    print("result=tot")
+    print("print result")
+    print("reference=2**" + str(n))
+    print("print reference")
+    print("</code></script>")
     for i in range (n+1):
         inport='<inport name="a' + str(i) + '" type="int"/>'
-        print inport
+        print(inport)
         pass
-    print '<outport name="result" type="int"/>'
-    print '<outport name="reference" type="int"/>'
-    print "</inline>"
-    print
+    print('<outport name="result" type="int"/>')
+    print('<outport name="reference" type="int"/>')
+    print("</inline>")
+    print()
     
     for i in range (1,n+1):
         for j in range (i+1):
             node="node_" + str(i)   +"_" + str(j)
             nodetxt='<node name="'+node+'" type="node_0_0"></node>'
-            print nodetxt
+            print(nodetxt)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- service -->
     <!-- control -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -90,16 +90,16 @@ def triangle(n):
             tonode2="node_" + str(i+1)   +"_" + str(j+1)
             control1='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode1+'</tonode> </control>'
             control2='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode2+'</tonode> </control>'
-            print control1
-            print control2
+            print(control1)
+            print(control2)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- datalinks -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -109,14 +109,14 @@ def triangle(n):
             datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
             datato1 ='<tonode>'   + tonode1  + '</tonode> <toport>b</toport>'
             datato2 ='<tonode>'   + tonode2  + '</tonode> <toport>a</toport>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato1
-            print '</datalink>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato2
-            print '</datalink>'
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato1)
+            print('</datalink>')
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato2)
+            print('</datalink>')
             pass
         pass
 
@@ -125,18 +125,18 @@ def triangle(n):
         datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
         toport='a' + str(i)
         datato  ='<tonode>collect</tonode> <toport>' + toport + '</toport>'
-        print '<datalink>'
-        print '   ' + datafrom
-        print '   ' + datato
-        print '</datalink>'
+        print('<datalink>')
+        print('   ' + datafrom)
+        print('   ' + datato)
+        print('</datalink>')
     
-    print """
+    print("""
 
     <!--parameters -->
 
-    """
+    """)
 
-    print """
+    print("""
     <parameter>
         <tonode>node_0_0</tonode> <toport>a</toport>
         <value><int>0</int></value>
@@ -145,27 +145,27 @@ def triangle(n):
         <tonode>node_0_0</tonode> <toport>b</toport>
         <value><int>1</int></value>
     </parameter>
-    """
+    """)
 
     for i in range (1,n+1):
         node1="node_" + str(i)   +"_" + str(0)
         node2="node_" + str(i)   +"_" + str(i)
         tonode1 ='   <tonode>' + node1 + '</tonode> <toport>a</toport>'
         tonode2 ='   <tonode>' + node2 + '</tonode> <toport>b</toport>'
-        print '<parameter>'
-        print tonode1
-        print '   <value><int>0</int></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode1)
+        print('   <value><int>0</int></value>')
+        print('</parameter>')
         
-        print '<parameter>'
-        print tonode2
-        print '   <value><int>0</int></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode2)
+        print('   <value><int>0</int></value>')
+        print('</parameter>')
 
-    print """
+    print("""
 
 </proc>
-    """
+    """)
      
 if __name__ == "__main__":
     import sys
@@ -179,7 +179,7 @@ if __name__ == "__main__":
         if rank >31:
             raise ValueError("rank must be <32")
     except (IndexError, ValueError):
-        print usage%(sys.argv[0])
+        print(usage%(sys.argv[0]))
         sys.exit(1)
         pass
     triangle(rank)
index d43d070b34d77a30460fb7da46d12ba93ce23298..9cf592a8dd18ef832976bbeb5993f28b05e5abf9 100644 (file)
@@ -33,11 +33,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 1)
@@ -50,7 +50,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getIntValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -61,7 +61,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index c0ba0a2389803565b705496862b55c13e73158cd..7021c61105c36089ee502d32c1a4d445ed97f07c 100644 (file)
@@ -20,8 +20,7 @@
 
 import os
 import orbmodule
-import salome_utils    
+import salome_utils
 clt = orbmodule.client()
 FactoryContainer = "/Containers/" + salome_utils.getShortHostName() + "/FactoryServer"
 clt.waitNS(FactoryContainer)
-
index 87f29f7f14bf57db5799845ffe1eaa2f3e8f2e13..0aa03dbad430b3814f296c9f52c664cfc1a1702b 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 #example
 data="""
@@ -32,7 +32,7 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print "args=",args
+  print("args=",args)
   if not args:
     return None
   elif len(args) == 1:
@@ -40,10 +40,9 @@ def echo(args):
   else:
     return args
 
-f=open("input")
-data=f.read()
-f.close()
-print data
+with open("input",'r') as f:
+  data=f.read()
+print(data)
 
 class Objref:
   """Wrapper for objrefs """
@@ -51,10 +50,32 @@ class Objref:
     self.data=data
   def __str__(self):
     return self.data or ""
-  def __cmp__(self, other):
+
+# __cmp__ is not defined in Python 3 : strict ordering
+  def __le__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data <= other
+  def __lt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data < other
+  def __ge__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data >= other
+  def __gt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data > other
+  def __eq__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data == other
+  def __ne__(self, other):
     if isinstance(other, Binary):
       other = other.data
-    return cmp(self.data, other)
+    return self.data != other
 
   def decode(self, data):
     self.data = data
@@ -64,28 +85,27 @@ class Objref:
     out.write(self.data or "")
     out.write("</objref></value>\n")
 
-xmlrpclib.WRAPPERS=xmlrpclib.WRAPPERS+(Objref,)
+xmlrpc.client.WRAPPERS=xmlrpc.client.WRAPPERS+(Objref,)
 
 def end_objref(self,data):
   self.append(Objref(data))
   self._value=0
 
-xmlrpclib.Unmarshaller.end_objref=end_objref
-xmlrpclib.Unmarshaller.dispatch["objref"]=end_objref
+xmlrpc.client.Unmarshaller.end_objref=end_objref
+xmlrpc.client.Unmarshaller.dispatch["objref"]=end_objref
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
-   call=eval(method)
-   response=call(params)
-   response = (response,)
+  call=eval(method)
+  response=call(params)
+  response = (response,)
 except:
-   # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+  # report exception back to server
+  response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+  response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
-f=open("output",'w')
-f.write(response)
-f.close()
+print(response)
+with open("output",'w') as f:
+  f.write(response)
index 12bcd320caaaee511bf46d409df908cbe6edd37e..470accd5c4e24dbad53942467a40b66d9389a14d 100644 (file)
@@ -56,7 +56,7 @@ void parser::SetUserDataAndPush(parser* pp)
 {
   XML_SetUserData(saxContext,pp);
   _stackParser.push(pp);
-  DEBTRACE("parser::SetUserDataAndPush, stack size: " << sp.size());
+  DEBTRACE("parser::SetUserDataAndPush, stack size: " << pp->_level);
 }
 
 void parser::onEnd(const XML_Char *el, parser* child)
index c43db52792d2f7dc64277a4ceff1b192c9662f72..c578f3655091592bfd0af4729eb133100a5e5c6f 100755 (executable)
@@ -27,6 +27,7 @@ ADD_DEFINITIONS(
 INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PTHREADS_INCLUDE_DIRS}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index c57552a774d23d500c613c8cb9f9151b829548f5..2da46f01637ea4c8f9615a8f33b5666bb018085e 100644 (file)
 
     <inline name="node98" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="objvec"/>
     </inline>
     <inline name="node1" state="disabled">
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="int"/>
     </inline>
     <inline name="node11" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="string"/>
     </inline>
     <inline name="node12" >
         <script>
-            <code>print p1</code>
-            <code>print "coucou"</code>
+            <code>print(p1)</code>
+            <code>print("coucou")</code>
         </script>
         <inport name="p1" type="dblevec"/>
     </inline>
     <inline name="node13" >
         <script>
-            <code><![CDATA[print p1]]></code>
-            <code><![CDATA[print "coucou"]]> </code>
+            <code><![CDATA[print(p1)]]></code>
+            <code><![CDATA[print("coucou")]]> </code>
             <code><![CDATA[a=1/0]]> </code>
         </script>
         <inport name="p1" type="dblevecvec"/>
         <script>
            <code>import eo</code>
            <code>obj=obj._narrow(eo.Echo)</code>
-           <code>print p1</code>
-           <code>print obj</code>
+           <code>print(p1)</code>
+           <code>print(obj)</code>
            <code>p2=obj.echoC(p1)</code>
-           <code>print p2</code>
+           <code>print(p2)</code>
         </script>
         <inport name="p1" type="eo/C"/>
         <inport name="obj" type="Echo"/>
     </inline>
     <inline name="node34" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="eo/C"/>
         <outport name="p2" type="eo/C"/>
     </inline>
     <inline name="node35" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="eo/C"/>
         <outport name="p2" type="eo/C"/>
index ffe2cb572bcfe13bd8e0b263ed03dcf1b7cbb1a4..ce964b51571adc2609c7341927c61ebf523a5a7a 100644 (file)
@@ -43,7 +43,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index a3bee62a3729eedd2335a69b25f4f515979231e8..e944911763e70043224178ec54fc14625b0a8428 100644 (file)
@@ -43,7 +43,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index 52dcf1e8e205bd954391281da8c80b21781ea672..f2c16169760e4765c5f999cc39365f612d39127d 100644 (file)
@@ -57,8 +57,8 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
-                    <code>  print "coucou b1.b2.node1" </code>
+                    <code>  print(p1);p1=2*p1 </code>
+                    <code>  print("coucou b1.b2.node1") </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index f399e2149e65ed603370483af4dee31d74326072..6ba9c0f1e83562d8019298ada8b63c8b600ce7a9 100644 (file)
@@ -52,7 +52,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>  def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index 403da740dd14d09d7c69919752e5df168ccdb02a..af5c4830096fd3c9dce2a52b72fed3269f6a0856 100644 (file)
@@ -51,7 +51,7 @@
         <inline name="node2" >
                 <function name="f">
                     <code>def f(s1):</code>
-                    <code>  print s1 </code>
+                    <code>  print(s1) </code>
                     <code>  return s1 </code>
                 </function>
                 <inport name="s1" type="dblevec"/>
@@ -61,7 +61,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index 3b22aff59e9fc8cfdcbfb6fd8d0b34acdb179ea4..fa9eb98894415a1aedd687471c8e511d57446771 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="boolvec"/>
       <outport name="p1" type="boolvec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="boolvec"/>
       <outport name="p1" type="boolvec"/>
index a876aac3739b3555efcd9ff3eb945fe0dccce744..4c3fcf616898c952657644d3cbdcd1813b990ff4 100644 (file)
@@ -63,7 +63,7 @@
 
     <inline name="pyth1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
 
     <inline name="pyth2" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
     </inline>
     <inline name="pyth3" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
     </inline>
     <inline name="pyth4" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
     </foreach>
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
index d6969aee2484b46318cc42f302a83c2cfd043fca..195b154ed7a7025f093dd1ed1c262713e2943967 100644 (file)
         </datanode>
 
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
 
         <bloc name="b">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index f9e59bad6a903e57e645b2dc7b60ab858092c11b..78b723f6547b7d6f07c4440f1d77840d491e1721 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
index cd3d0ddcddcb52328a8170a3a92092d8e5cd68f7..315ee6ad3d804b80283f1f994656bac3212d6c36 100644 (file)
@@ -27,7 +27,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -45,7 +45,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
         <code>#a=1/0</code>
       </script>
       <outport name="p1" type="string"/>
index 052eb3a2e656673290961b731b6abc176e4538b1..aac6b1dd9087cfa6da51076c25bc12d0fda90c85 100644 (file)
@@ -28,7 +28,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -46,7 +46,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
         <code>#a=1/0</code>
       </script>
       <inport name="p1" type="string"/>
index 9b6457f5aec16f90c5696366ba56bda05b494f83..cbe545edd5003abaa21cd090ae98d65de669be02 100644 (file)
@@ -28,7 +28,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -46,7 +46,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
         <code>a=1/0</code>
       </script>
       <outport name="p1" type="string"/>
index 11da35a8b1007d65be26edeb8f317f3f31e34171..aa6615787b6319fb67a2bd2b8b8583482ea662ac 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 1ea4b9fe1c62c93a74c2d6ab3cf02cdeed25d7d2..a4d607c2451206b51cacb1a607f78759ec31719a 100644 (file)
@@ -25,7 +25,7 @@
     <!-- service -->
 
     <inline name="node1" >
-        <script><code>print p1;p1=2*p1</code></script>
+        <script><code>print(p1);p1=2*p1</code></script>
         <inport name="p1" type="string"/>
         <outport name="p1" type="string"/>
     </inline>
index b7edf020237bc7ab4f39d9b7c09511bbc0e409a7..a96253974e62194bb3522f00e6b474d4b82ed72e 100644 (file)
@@ -31,7 +31,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -56,7 +56,7 @@
 
     <inline name="node3" >
       <script>
-        <code>print "node3:",p1</code>
+        <code>print("node3:",p1)</code>
       </script>
       <inport name="p1" type="file"/>
     </inline>
index 76ba81a087c6ce8ea633b06acc7dddacdb78e69c..a67426a469c1f250901bcf498e54ad7aabc54d4f 100644 (file)
@@ -38,9 +38,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -49,7 +49,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index a3aded2e1c99ddaeed443bd0dc11c30608fd5323..3032ba15d992d75f599959bd118b1a19ce96671f 100644 (file)
@@ -39,9 +39,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -55,7 +55,7 @@
   </bloc>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 053d2fc04ade1e303aad6f6106510e04ffb2ce15..37237001868fb3f2d545c9e0feee0f1cc73c73e5 100644 (file)
@@ -38,9 +38,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -49,7 +49,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
     </inline>
index 5979d101f2aed6a3bcaa8a91e73b068f28feb405..fcb5076a11bc56b1978015667e88d4dd5ac8f445 100644 (file)
@@ -41,7 +41,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index f180683df53f86c1acf4135d05aa88ba6c06029d..7474bad55ec5c8af61ff284244b9b982c54b0672 100644 (file)
@@ -43,7 +43,7 @@
     </foreach>
     <inline name="node3" >
       <script>
-        <code>print "coucou"</code>
+        <code>print("coucou")</code>
       </script>
     </inline>
     <service name="node4" >
@@ -65,7 +65,7 @@
   </bloc>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 4ac15ad328e67450f2ab49e5c5688062d950ebb1..1d2706b8f2df3779d5ddb0b9c04f0dabf77b6c19 100644 (file)
 
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvecvec"/>
       <outport name="p1" type="intvecvec"/>
     </inline>
     <inline name="node3" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvecvec"/>
     </inline>
index e84535d4b7943a451adfe9769aeebcc5ee228284..edbcdb72223eca0d4a811ce5f5342d118967cca6 100644 (file)
@@ -83,7 +83,7 @@ for run in range(numberOfRun):
     runs[run].append(medFile)
     runs[run].append(meshName)
     pass
-print "There is(are) ",numberOfRun," runs of Fake Compo on process ",os.getpid()
+print("There is(are) ",numberOfRun," runs of Fake Compo on process ",os.getpid())
 ]]></code></script>
       <outport name="numberOfRun" type="int"/>
       <outport name="runs" type="seqpyobj"/>
index 63d600d66b3a8c3037fbf2ff5ee0d74be04822f8..873811842f55394bed6a3ea2de33c2422375b04a 100644 (file)
@@ -41,7 +41,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 8a378b6ca2df63e50f0a31abc4ca71c0b98a5ca9..e719e421ad5ff117df574a81e88b9d3b4d718445 100644 (file)
@@ -36,9 +36,9 @@
         <function name="f">
             <code>import time</code>
             <code>def f(p1):</code>
-            <code>  print "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ start ", p1</code>
+            <code>  print("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ start ", p1)</code>
             <code>  time.sleep(0.1)</code>
-            <code>  print "----------------------------------------- stop  ", p1</code>
+            <code>  print("----------------------------------------- stop  ", p1)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -47,7 +47,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 90507abb5970c67b3b3f55662d355bb9b7e4e123..1c298089005562393cf16da1035cd794d65dbb2b 100644 (file)
@@ -32,7 +32,7 @@
    <foreach name="ForEachLoop" nbranch="4" type="int">
       <initnode>
       <inline name="initScript">
-         <script><code><![CDATA[print "initnode"
+         <script><code><![CDATA[print("initnode")
 o1=7
 ]]></code></script>
          <outport name="o1" type="int"/>
@@ -51,7 +51,7 @@ o1=7
       </inline>
       <finalizenode>
       <inline name="finalizeScript">
-         <script><code><![CDATA[print "finalizenode"
+         <script><code><![CDATA[print("finalizenode")
 ]]></code></script>
          <inport name="i2" type="int"/>
       </inline>
@@ -62,9 +62,9 @@ o1=7
       </datalink>
    </foreach>
    <inline name="PostProc">
-      <script><code><![CDATA[print "Post-traitement"
+      <script><code><![CDATA[print("Post-traitement")
 for x in i5:
-    print x
+    print(x)
 ]]></code></script>
       <load container="DefaultContainer"/>
       <inport name="i5" type="seqint"/>
index b9b41e8580d19516223183a477e7cab441f3260a..29544e31b1008876be1b9896af02e90cce83a6d9 100644 (file)
@@ -29,9 +29,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index 86f441dfd29a8042b9390cd0cec95357689d2d12..03d27fa668cd5373bd78a0478583860d39e16c84 100644 (file)
@@ -29,9 +29,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print "a=",a</code>
+            <code>  print("a=",a)</code>
             <code>  a=a+p1</code>
-            <code>  print "a=",a</code>
+            <code>  print("a=",a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index 50082c8a37b75096b9861324f2d4ac5532ffceef..de0ef11eb65f5729f7e5447dd55e9adf8c44ade5 100644 (file)
@@ -35,9 +35,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index a9be274ad41c535de0d959455948575f7623529c..c648f4edd2abb362b84b75145d79fd5d765eae7f 100644 (file)
@@ -36,9 +36,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
           </function>
           <inport name="p1" type="double"/>
index 44329cc5f6feb6fcc7ad40155f3c2fd75a5be7b5..4ab87aee9a95f294c896abec29ee3f4627b1d16e 100644 (file)
@@ -37,9 +37,9 @@
                 <code>def f(p1):</code>
                 <code>  global a</code>
                 <code>  p1= p1+10.</code>
-                <code>  print a</code>
+                <code>  print(a)</code>
                 <code>  a=a+p1</code>
-                <code>  print a</code>
+                <code>  print(a)</code>
                 <code>  return p1</code>
               </function>
               <inport name="p1" type="double"/>
index 576a388ed4b53893156fb31e300389c11e5ea671..ca8f2d8d9c8de5f2ab3eac6fc3d94236060a0846 100644 (file)
@@ -39,9 +39,9 @@
                   <code>def f(p1):</code>
                   <code>  global a</code>
                   <code>  p1= p1+10.</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  a=a+p1</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  return p1</code>
                 </function>
                 <inport name="p1" type="double"/>
index ad41800c8f9903eebe2d11e117a65abefcfdd3e8..49b778782fc2008dcd1b9477b5f72e2a214e410a 100644 (file)
@@ -37,9 +37,9 @@
                   <code>def f(p1):</code>
                   <code>  global a</code>
                   <code>  p1= p1+10.</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  a=a+p1</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  return p1</code>
                 </function>
                 <inport name="p1" type="double"/>
index b773e39baeb2cde79c0ae6ee70402f9b65261e5c..0f57b9e84c23edf1828c180ddf8a0b7e62c97610 100644 (file)
@@ -41,9 +41,9 @@
                   <code>def f(p1):</code>
                   <code>  global a</code>
                   <code>  p1= p1+10.</code>
-                  <code>  print "a:",a</code>
+                  <code>  print("a:",a)</code>
                   <code>  a=a+p1</code>
-                  <code>  print "p1:",p1</code>
+                  <code>  print("p1:",p1)</code>
                   <code><![CDATA[  condition=(p1 < 40.)]]> </code>
                   <code>  return p1,condition</code>
                 </function>
index 541b14498df0275be1b4b61e971b819d2ffb2670..6361b4c4aa883a892014658d9af9d79fe4bc0d77 100644 (file)
@@ -27,7 +27,7 @@
     <inline name="node1" >
         <function name="f">
             <code>def f(p1):</code>
-            <code>  print p1;p1=2*p1 </code>
+            <code>  print(p1);p1=2*p1 </code>
             <code>  return p1 </code>
         </function>
         <inport name="p1" type="string"/>
index 001f7e538a5722eac3bba584949512c48c4e951e..e33fd20505fc9b19a120208ab01aa7fcf1d24d0c 100644 (file)
@@ -55,7 +55,7 @@
       <script>
         <code>import SALOME_MED</code>
         <code>p1=p1._narrow(SALOME_MED.FIELD)</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="FIELDDOUBLE"/>
       <outport name="p1" type="FIELDDOUBLE"/>
@@ -90,7 +90,7 @@
 
     <inline name="pyth0" >
       <script>
-        <code>print "MEDFIELD:",p1</code>
+        <code>print (MEDFIELD:",p1)</code>
         <code>p1.Register()</code>
       </script>
       <inport name="p1" type="FIELDDOUBLE"/>
@@ -99,7 +99,7 @@
 
     <inline name="pyth1" >
       <script>
-        <code>print "MEDFIELD:",p1</code>
+        <code>print("MEDFIELD:",p1)</code>
       </script>
       <inport name="p1" type="FIELDDOUBLE"/>
     </inline>
index 3d140bb8bd1e57a03d39dcc76e0bd09d8bf5a53c..44e5b412c2ac788a68ac6725949f01eefe18751c 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvec"/>
       <outport name="p1" type="intvec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvec"/>
       <outport name="p1" type="intvec"/>
index a17139555ff8af5f3e52c6bce25846cc7ee2231d..ffff333b4d28e2c2905acf889cf65b6e6b32b7c1 100644 (file)
@@ -35,7 +35,7 @@
     <inline name="poly_7" >
        <script>
           <code>Pn=(429*x**7 -693*x**5+315*x**3 -35*x)/16</code>
-          <code>print "reference P7=",Pn</code>
+          <code>print("reference P7=",Pn)</code>
        </script>
        <inport name="x" type="double"/>
        <outport name="Pn" type="double"/>
@@ -73,7 +73,7 @@
           <inline name="iter1" >
              <script>
                 <code>Pn = ((2*n-1)*x*Pnm1 -(n-1)*Pnm2)/n</code>
-                <code>print "n=",n," Pn=",Pn</code>
+                <code>print("n=",n," Pn=",Pn)</code>
                 <code>n=n+1</code>
              </script>
              <inport name="Pnm1" type="double"/>
index 54842966aec9ebac433cf3518c5d203e712c6de8..2fde8b6cd1f95f9747a5c01ac3e2576c06cb89c1 100644 (file)
@@ -64,7 +64,7 @@
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="objvec"/>
       <outport name="p1" type="objvec"/>
@@ -96,7 +96,7 @@
     <foreach name="foreach4" nbranch="3" type="Obj" >
       <inline name="pyth" >
         <script>
-          <code>print p1</code>
+          <code>print(p1)</code>
         </script>
         <inport name="p1" type="Obj"/>
         <outport name="p1" type="Obj"/>
 
     <inline name="pyth7" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="objvec"/>
       <outport name="p1" type="objvec"/>
index 6339bdac81f2d9c8415d3fa154576a1c513b9a48..3257ec35b315e76da52ab56f44e9d64c088e99b6 100644 (file)
@@ -43,8 +43,8 @@
 
     <inline name="pyth0" >
       <script>
-        <code>print "p1",p1</code>
-        <code>print "p2",p2</code>
+        <code>print("p1",p1)</code>
+        <code>print("p2",p2)</code>
         <code>p1=[p1,p2,p2,p1]</code>
       </script>
       <inport name="p1" type="Obj"/>
index 3beb702e4121fc87b4e27ced83f75dfa85985ac3..b739870d17d5e6fc816c75200f18187a7e809c46 100644 (file)
@@ -27,7 +27,7 @@
       <inline name="node2" >
         <script >
             <code>p1= p1+10.</code>
-            <code>print "node2:",p1</code>
+            <code>print("node2:",p1)</code>
             <code>#a=p1/0</code>
             <code>p1=5</code>
         </script>
index 1fd8d295e50b3f476e1cf6868224172e8b0d4b29..928a0f713f4538ae79a2262a3ba6d690df733b9b 100644 (file)
@@ -28,7 +28,7 @@
       <inline name="node2" >
         <script >
             <code>p1= p1+10.</code>
-            <code>print "node2:",p1</code>
+            <code>print("node2:",p1)</code>
             <code>#a=p1/0</code>
             <code>p1=5</code>
         </script>
index f9a365920f938529fe9f0d15caaafc552d292e5a..9a2c2d52e9d5fe823e7887b2e8549aac670746d3 100644 (file)
@@ -49,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="libTestOptLoop" entry="createOptimizerAlgASyncExample">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 1f3ea790dbd865c2aa888d96b930dd974eb5bfa2..cf646d1a18f263e91df1d8682bed27820bc4c6f8 100644 (file)
@@ -49,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="algoasyncexample.py" entry="myalgoasync">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 186836cbd9916083df3ed4d2ecbebc32474f17cd..6b9dc597cfd424ac2511b281338e7d56c010ffe9 100644 (file)
@@ -49,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="libTestOptLoop" entry="createOptimizerAlgSyncExample">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 3aacba4346887d8bfc887e456c76264694533f6d..4a3357cb59c16427ca300c78960d3dc5a0752da8 100644 (file)
@@ -49,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="algosyncexample.py" entry="myalgosync">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 6e2439742e06c8047022dce6613ff0eec40f383e..33ee7856c97ecd1526761f78ee3e1e68bec3ae5e 100644 (file)
 
     <inline name="node1" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="int"/>
     </inline>
     <inline name="node11" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="string"/>
     </inline>
     <inline name="node12" >
         <script>
-            <code>print p1</code>
-            <code>print "coucou"</code>
+            <code>print(p1)</code>
+            <code>print("coucou")</code>
         </script>
         <inport name="p1" type="dblevec"/>
     </inline>
     <inline name="node13" >
         <script>
-            <code><![CDATA[print p1]]></code>
-            <code><![CDATA[print "coucou"]]> </code>
+            <code><![CDATA[print(p1)]]></code>
+            <code><![CDATA[print("coucou")]]> </code>
         </script>
         <inport name="p1" type="dblevecvec"/>
         <outport name="p1" type="dblevecvec"/>
         <script>
            <code>import eo</code>
            <code>obj=obj._narrow(eo.Echo)</code>
-           <code>print p1</code>
-           <code>print obj</code>
+           <code>print(p1)</code>
+           <code>print(obj)</code>
            <code>p2=obj.echoC(p1)</code>
-           <code>print p2</code>
+           <code>print(p2)</code>
         </script>
         <inport name="p1" type="C"/>
         <inport name="obj" type="Echo"/>
     </inline>
     <inline name="node34" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
     </inline>
     <inline name="node35" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
index 33aab9440527354c362bd341e59fecc3b5ab36b9..60fda24e5c3acad80aad488eb7b04e19e1a23a77 100644 (file)
@@ -43,9 +43,9 @@
       <function name="ff2">
          <code><![CDATA[
 def ff2(x,a):
-  print "coucou, x=",x
-  print "coucou, a=",a
-  print my_container
+  print("coucou, x=",x)
+  print("coucou, a=",a)
+  print(my_container)
   return x+" OK ca marche"+str(a),2*a+4.7
 ]]></code>
       </function>
@@ -57,8 +57,8 @@ def ff2(x,a):
    </remote>
    <inline name="node2">
       <script><code><![CDATA[
-print "dans node2 p1=",p1
-print "dans node2 p2=",p2
+print("dans node2 p1=",p1)
+print("dans node2 p2=",p2)
 ]]></code></script>
       <inport name="p1" type="string"/>
       <inport name="p2" type="double"/>
index bdbe514789dd852c9b515d98a1d65cd0ff485c29..6963e8a5232e6788080b23372a2c72d48ba81082 100644 (file)
@@ -46,9 +46,9 @@
          <code><![CDATA[import time
 
 def f():
-    print my_container
-    for n in xrange(15):
-      print time.time()
+    print(my_container)
+    for n in range(15):
+      print(time.time())
       time.sleep(1)
     
 ]]></code>
@@ -59,9 +59,9 @@ def f():
       <function name="f">
          <code><![CDATA[import time
 def f():
-    print my_container
-    for n in xrange(15):
-      print time.time()
+    print(my_container)
+    for n in range(15):
+      print(time.time())
       time.sleep(1)
 ]]></code>
       </function>
index 8e4f0f990e605703faad21cbf4c08034e8539cd7..d068f831166578867bd3a7f67cac4884248ef4f6 100644 (file)
             <code><![CDATA[import time
 
 def f(i5):
-    print my_container
-    print "nouvelle branche avec ", i5
-    for n in xrange(15):
-      print time.time()
+    print(my_container)
+    print("nouvelle branche avec ", i5)
+    for n in range(15):
+      print(time.time())
       time.sleep(1)
     
 ]]></code>
index 2105195c2cd54e475932368b51aa1018f1f9dc7a..c9d84d182d3f25285d46d242698c64b4463ca1c3 100644 (file)
    <remote name="Node6">
       <script>
          <code><![CDATA[
-print "coucou, x=",x
-print "coucou, a=",a
-print "my_container=",my_container
+print("coucou, x=",x)
+print("coucou, a=",a)
+print("my_container=",my_container)
 y= x+" OK ca marche"+str(a)
 z=2*a+4.7
-print y,z
+print(y,z)
 ]]></code>
       </script>
       <load container="cont1"/>
@@ -58,8 +58,8 @@ print y,z
    </remote>
    <inline name="node2">
       <script><code><![CDATA[
-print "dans node2 p1=",p1
-print "dans node2 p2=",p2
+print("dans node2 p1=",p1)
+print("dans node2 p2=",p2)
 ]]></code></script>
       <inport name="p1" type="string"/>
       <inport name="p2" type="double"/>
index f46c0552f021706021f50b4ffaa93012d820db57..9895ab4ca224d20f52cde4bbdc3a976a94e33396 100644 (file)
@@ -28,7 +28,7 @@
       <code>def f(p1):</code> 
       <code>   global a</code> 
       <code>   a=a+1</code> 
-      <code>   print a</code> 
+      <code>   print(a)</code> 
       <code>   return p1</code> 
     </function>
     <inport name="p1" type="int"/>
index 2fb838d7841b500c0a3a38a8fd8a5368dd65577c..b8b83b10f8a633ee945b7cf385b216c7377ee472 100644 (file)
 
     <inline name="node1" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="int"/>
     </inline>
     <inline name="node11" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="string"/>
     </inline>
     <inline name="node12" >
         <script>
-            <code>print p1</code>
-            <code>print "coucou"</code>
+            <code>print(p1)</code>
+            <code>print("coucou")</code>
         </script>
         <inport name="p1" type="dblevec"/>
     </inline>
     <inline name="node13" >
         <script>
-            <code><![CDATA[print p1]]></code>
-            <code><![CDATA[print "coucou"]]> </code>
+            <code><![CDATA[print(p1)]]></code>
+            <code><![CDATA[print("coucou")]]> </code>
         </script>
         <inport name="p1" type="dblevecvec"/>
         <outport name="p1" type="dblevecvec"/>
         <script>
            <code>import eo</code>
            <code>obj=obj._narrow(eo.Echo)</code>
-           <code>print p1</code>
-           <code>print obj</code>
+           <code>print(p1)</code>
+           <code>print(obj)</code>
            <code>p2=obj.echoC(p1)</code>
-           <code>print p2</code>
+           <code>print(p2)</code>
         </script>
         <inport name="p1" type="C"/>
         <inport name="obj" type="Echo"/>
     </inline>
     <inline name="node34" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
     </inline>
     <inline name="node35" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
index 48dd3ad69fd944cdd5d3185cf63fb7558cb5276b..6d607816fe1512d6e94b48e0fcd3f7a63f50360d 100644 (file)
@@ -59,10 +59,10 @@ if err > epsilon :
     msg += "refOutput - output : %f - %f \n"%(refOutput, output);
     msg += "Got abs relative diff  %f .\n"%err
     ret = False;
-    print msg;
+    print(msg)
     pass
 
-#print "+++ OK " , i , " +++", ret
+#print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputs" type="pyobj"/>
@@ -261,7 +261,7 @@ refOutputs = [
    <inline name="PyBuildLoopIndex">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal) :
-    print "In make_indexes" ;
+    print("In make_indexes")
     if ( len(inVal) != len(outVal) ) :
         msg = "len(inVal) (%i) != len(outVal) (%i). "%( len(inVal), len(outVal) ) ;
         raise ValueError(msg)       
@@ -289,7 +289,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -310,8 +310,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index 2d2b04e11350b4b2379f562e93f4ca48822eb8ee..253a7b24ff9518a92ba5875c2150883941d025fc 100644 (file)
@@ -66,10 +66,10 @@ msg += "ANN : ref = %f , out = %f, err = %f \n"%(refOutputANN, outputANN, errANN
 if errLR > epsilon or errANN > epsilon: 
     msg   += "KO valid with eps %f at pattern #%i: \n"%(epsilon, i) ;
     ret = False;
-    print msg;
+    print(msg);
     pass
 
-print "+++ OK " , i , " +++", ret
+print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputsLR" type="pyobj"/>
@@ -99,7 +99,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -115,7 +115,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -401,7 +401,7 @@ refOutputs_LR = [
    <inline name="PyBuildLoopIndex0">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal_LR, outVal_ANN) :
-    print "In make_indexes" ;
+    print("In make_indexes") ;
 
     if ( len(inVal) != len(outVal_LR) ) :
         msg = "len(inVal) (%i) != len(outVal_LR) (%i). "%( len(inVal), len(outVal_LR) ) ;
@@ -436,8 +436,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index 048553f6aa68cf78fc7937a7d9dd9eb60252e434..cceb188fc2cb165bf84e880fd70309ba343c10fb 100644 (file)
@@ -59,10 +59,10 @@ if err > epsilon :
     msg += "refOutput - output : %f - %f \n"%(refOutput, output);
     msg += "Got abs relative diff  %f .\n"%err
     ret = False;
-    print msg;
+    print(msg);
     pass
 
-#print "+++ OK " , i , " +++", ret
+#print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputs" type="pyobj"/>
@@ -263,7 +263,7 @@ refOutputs = [
    <inline name="PyBuildLoopIndex">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal) :
-    print "In make_indexes" ;
+    print("In make_indexes") ;
     if ( len(inVal) != len(outVal) ) :
         msg = "len(inVal) (%i) != len(outVal) (%i). "%( len(inVal), len(outVal) ) ;
         raise ValueError(msg)       
@@ -291,7 +291,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -312,8 +312,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index 524709d61d56c749bc5bbb6b930a2ee94d1cc8af..74dfd141f05e9613651ec325586396973066be82 100644 (file)
@@ -59,10 +59,10 @@ if err > epsilon :
     msg += "refOutput - output : %f - %f \n"%(refOutput, output);
     msg += "Got abs relative diff  %f .\n"%err
     ret = False;
-    print msg;
+    print(msg);
     pass
     
-print "+++ OK " , i , " +++", ret
+print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputs" type="pyobj"/>
@@ -261,7 +261,7 @@ refOutputs = [
    <inline name="PyBuildLoopIndex">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal) :
-    print "In make_indexes" ;
+    print("In make_indexes") ;
     if ( len(inVal) != len(outVal) ) :
         msg = "len(inVal) (%i) != len(outVal) (%i). "%( len(inVal), len(outVal) ) ;
         raise ValueError(msg)       
@@ -289,7 +289,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -310,8 +310,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index c783348a3ebfb68d08c206a0ba1f3a01d1505849..894f1e14a7e9f88a35b8cb574922fb1208ba7a8f 100644 (file)
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
index f24f02f1c13095918baad4db267c61bae87747ee..c4fa4d02019fddd59f18be988c1cc3fc27b39604 100644 (file)
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
index 6811f512a17f3ef0d7c3d223019e35728da8853e..a1852ddcf3ec7820a02317e7bda1330f44fcbbfc 100644 (file)
         <code>import salome</code>
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
-        <code>print __container__from__YACS__</code>
+        <code>print(__container__from__YACS__)</code>
         <code>machine,container=__container__from__YACS__.split('/')</code>
         <code>param={}</code>
         <code>param['hostname']=machine</code>
         <code>param['container_name']=container</code>
         <code>compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
         <code>def f(p1):</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
index aa30bb781fae81dc5bea005097f4bd3ff54fdf79..3a453009416f8c1ea71b569ef97f471b838f0f9b 100644 (file)
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
index cb6fef65db955a3b9f533aebd60ba64e14a3e34c..fb8eda9afb2f652fe082e528fea2dc49c16552eb 100644 (file)
           <code>import salome</code>
           <code>salome.salome_init()</code>
           <code>import PYHELLO_ORB</code>
-          <code>print __container__from__YACS__</code>
+          <code>print(__container__from__YACS__)</code>
           <code>machine,container=__container__from__YACS__.split('/')</code>
           <code>param={}</code>
           <code>param['hostname']=machine</code>
           <code>param['container_name']=container</code>
           <code>compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
           <code>def f(p1):</code>
-          <code>  print compo.makeBanner(p1)</code>
-          <code>  print p1</code>
+          <code>  print(compo.makeBanner(p1))</code>
+          <code>  print(p1)</code>
           <code>  return p1</code>
         </function>
         <load container="A"/>
@@ -58,7 +58,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="strvec"/>
     </inline>
index 83320d816405656cda23a41f663bae69417a086a..957db012f93ffdc1482a15e0eaf80ddcc55e8f6a 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="strvec"/>
       <outport name="p1" type="strvec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="strvec"/>
       <outport name="p1" type="strvec"/>
index a50dbe553cd6cbcc00cbecc6bd392d3ac6649882..b1406a17450a739807e94b1e344c9cc6b1da89c2 100644 (file)
 
     <inline name="pyth3" >
       <script>
-        <code>print s1</code>
+        <code>print(s1)</code>
       </script>
       <inport name="s1" type="eo/S2"/>
     </inline>
 
     <inline name="pyth9" >
       <script>
-        <code>print s1</code>
+        <code>print(s1)</code>
       </script>
       <inport name="s1" type="eo/S2"/>
     </inline>
 
     <inline name="pyth2" >
       <script>
-        <code>print s1</code>
+        <code>print(s1)</code>
       </script>
       <inport name="s1" type="eo/S2"/>
     </inline>
 
     <inline name="pyth0" >
       <script>
-        <code>print s1</code>
-        <code>print t1</code>
+        <code>print(s1)</code>
+        <code>print(t1)</code>
       </script>
       <inport name="p1" type="double"/>
       <inport name="s1" type="eo/S2"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
index 1b9a80f482972dd3c03fa4001aaf216a9d4d42b7..b2aa01aec58e1350eafe3e5d4298b523f89665ff 100644 (file)
@@ -37,7 +37,7 @@
       <script>
         <code>import GEOM</code>
         <code>p1=p1._narrow(GEOM.GEOM_Object)</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="GEOM/GEOM_Object"/>
       <outport name="p1" type="GEOM/GEOM_Object"/>
index 97d9610488b8d31938e13dfaf0d2d54c4968e831..95b6184142f0658c4d1d998e97d7fb4ccae5fc2c 100644 (file)
     <switch name="b1" select="3" >
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index e633f7894166dff40928a6bc3f3e6a6c6010c124..b9e73cb4543b8d16089a8aa28c9a539e626e7e5e 100644 (file)
       <outport name="select" type="int"/>
    </inline>
    <inline name="n2">
-      <script><code><![CDATA[print p1]]></code></script>
+      <script><code><![CDATA[print(p1)]]></code></script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
    </inline>
    <switch name="b1">
       <default>
          <inline name="n2">
-            <script><code><![CDATA[print p1]]></code></script>
+            <script><code><![CDATA[print(p1)]]></code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
          </inline>
       </default>
       <case id="1">
          <inline name="n2">
-            <script><code><![CDATA[print p1]]></code></script>
+            <script><code><![CDATA[print(p1)]]></code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
          </inline>
@@ -73,7 +73,7 @@ condition=p1 < 40. ]]></code></script>
             </default>
             <case id="1">
                <inline name="n2">
-                  <script><code><![CDATA[print p1
+                  <script><code><![CDATA[print(p1)
 p1=p1+20
 condition=p1 < 40. ]]></code></script>
                   <inport name="p1" type="double"/>
index 629c91826df64476547e5ee9a77379774a3de395..e33a13eb7955ce2cbff5bc0fbfb03272feadf923 100644 (file)
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index f3041938fa453b8e8950d7c350f7e96dd041a034..484f2f0c334f3af055a40550eaedf19f8652ad7f 100644 (file)
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 7487c6aa960c282b279ed24d4cd224d1e630dbd1..3b5e570d890e135a6d95b405a5c32ff0e2cfe710 100644 (file)
@@ -32,7 +32,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 653088bab4a226150adf3f02005163451ab9c951..5657b2a7c56d0a56d172d696d4637641d4f318e6 100644 (file)
@@ -32,7 +32,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -40,7 +40,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -48,7 +48,7 @@
       <case id="3">
         <bloc name="b">
           <inline name="n2" >
-            <script><code>print p1</code></script>
+            <script><code>print(p1)</code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
           </inline>
@@ -56,7 +56,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 047a06cddbff70911b27c5f14a5321e9c3ba2c34..2b72525caa3e75329e79b2ad747c6bf88994aaf8 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
           <inline name="n2" >
-            <script><code>print p1</code></script>
+            <script><code>print(p1)</code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
           </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 25392001486fd6607c34ba18ae7652275c2a55a4..4076df069edec04f5425dfa0396c478ba721acb7 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -39,7 +39,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -47,7 +47,7 @@
       <case id="3">
         <forloop name="b" nsteps="2">
           <inline name="n2" >
-            <script><code>print p1</code></script>
+            <script><code>print(p1)</code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
           </inline>
@@ -55,7 +55,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 7948c4873028f25dfe8362d9da6ef1842b3e2b0f..249c3840ed97caac9d8f451f2393d90f116ea925 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -39,7 +39,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -48,7 +48,7 @@
         <while name="b" >
           <inline name="n2" >
               <script>
-                  <code>print p1</code>
+                  <code>print(p1)</code>
                   <code>p1=p1+20</code>
                   <code><![CDATA[condition=p1 < 90.]]> </code>
               </script>
@@ -64,7 +64,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 22739275cae0eae2f3ed1f2bc8a30359cb976485..8471859bb22d584e05faf08de00a5f71c27b050d 100644 (file)
@@ -29,7 +29,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -37,7 +37,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -47,7 +47,7 @@
           <case id="1">
             <inline name="n2" >
               <script>
-                  <code>print p1</code>
+                  <code>print(p1)</code>
                   <code>p1=p1+20</code>
                   <code><![CDATA[condition=p1 < 40.]]> </code>
               </script>
@@ -70,7 +70,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 0babd48d6597c4f834b4be7a0fa8e4db4f41c66d..8d1658b5f469a26bf135ac438c288d2e37f8a856 100644 (file)
@@ -26,7 +26,7 @@
 <inline name="node_0_0" >
 <script><code>
 c=a+b
-print c
+print(c)
 </code></script>
 <inport name="a" type="int"/>
 <inport name="b" type="int"/>
@@ -43,7 +43,7 @@ print c
 <inline name="node_3_0" >
 <script><code>
 c=a+b/0
-print c
+print(c)
 </code></script>
 <inport name="a" type="int"/>
 <inport name="b" type="int"/>
index 723751e76c8dcb344e1188ddb3a09c3b6944196d..917f8a5430d2ab0207d0c6a1aa635924aa44464c 100644 (file)
@@ -37,9 +37,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print "p1:",p1</code>
+            <code>  print("p1:",p1)</code>
             <code><![CDATA[  condition=p1 < 40.]]> </code>
             <code>  return p1,condition</code>
         </function>
index 8500a93af24e8d550a2b54569422b30d3222b81b..ce6947c194461482d63c74a555b71994e95f0870 100644 (file)
@@ -38,9 +38,9 @@
             <code><![CDATA[def f(p1):]]> </code>
             <code><![CDATA[  global a]]> </code>
             <code><![CDATA[  p1= p1+10.]]> </code>
-            <code><![CDATA[  print a]]> </code>
+            <code><![CDATA[  print(a)]]> </code>
             <code><![CDATA[  a=a+p1]]> </code>
-            <code><![CDATA[  print "a:",a]]> </code>
+            <code><![CDATA[  print("a:",a)]]> </code>
             <code><![CDATA[  condition=p1 < 50.]]> </code>
             <code><![CDATA[  return p1,condition]]> </code>
           </function>
index bc48f23f5084df7ee5b9fe27ec23fc0559ffa86f..b4c6b17c2c05f79861547bcf1feff7f01ab6a9c5 100644 (file)
@@ -38,9 +38,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print "p1:",p1</code>
+            <code>  print("p1:",p1)</code>
             <code><![CDATA[  condition=p1 < 40.]]> </code>
             <code>  return p1,condition</code>
         </function>
index 285f6c8424741fac0c074e396bb6fbf8aaeefc22..ec7048e51fe0fe9a8c218e81603b9baa52e88fd4 100644 (file)
@@ -33,6 +33,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader
   ${PROJECT_BINARY_DIR}/src/engine_swig
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )
 
index d43d070b34d77a30460fb7da46d12ba93ce23298..9cf592a8dd18ef832976bbeb5993f28b05e5abf9 100644 (file)
@@ -33,11 +33,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 1)
@@ -50,7 +50,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getIntValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -61,7 +61,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index d172415f19e5a5c4d838fff97abf0814e2b02370..a3fc8aa4dec9cb42d4bfdb00b3dba5197695028d 100755 (executable)
@@ -34,33 +34,33 @@ class TestEdit(unittest.TestCase):
 
     def test1_edit(self):
         p = self.r.createProc("pr")
-        print p.typeMap
+        print(p.typeMap)
         t=p.getTypeCode("double")
-        print t.kind()
+        print(t.kind())
         t=p.typeMap["double"]
         
         td=p.createType("double","double")
         ti=p.createType("int","int")
         tc1=p.createInterfaceTc("","Obj",[])
-        print tc1.name(),tc1.id()
+        print(tc1.name(),tc1.id())
         tc2=p.createInterfaceTc("","Obj2",[tc1])
-        print tc2.name(),tc2.id()
+        print(tc2.name(),tc2.id())
         tc3=p.createSequenceTc("","seqdbl",td)
-        print tc3.name(),tc3.id(),tc3.contentType()
+        print(tc3.name(),tc3.id(),tc3.contentType())
         tc4=p.createSequenceTc("","seqObj2",tc2)
         tc5=p.createSequenceTc("","seqint",ti)
-        print tc4.name(),tc4.id()
-        print tc4.isA(tc1),0
-        print tc2.isA(tc1),1
-        print tc1.isA(tc2),0
-        print td.isA(ti),0
-        print td.isAdaptable(ti),1
-        print ti.isAdaptable(td),0
-        print tc5.isAdaptable(tc3),0
-        print tc3.isAdaptable(tc5),1
+        print(tc4.name(),tc4.id())
+        print(tc4.isA(tc1),0)
+        print(tc2.isA(tc1),1)
+        print(tc1.isA(tc2),0)
+        print(td.isA(ti),0)
+        print(td.isAdaptable(ti),1)
+        print(ti.isAdaptable(td),0)
+        print(tc5.isAdaptable(tc3),0)
+        print(tc3.isAdaptable(tc5),1)
         
         n=self.r.createScriptNode("","node1")
-        n.setScript("print 'coucou1'")
+        n.setScript("print('coucou1')")
         n.edAddInputPort("p1",ti)
         n.edAddOutputPort("p1",ti)
         p.edAddChild(n)
@@ -68,18 +68,18 @@ class TestEdit(unittest.TestCase):
         retex=None
         try:
             inport.edInitXML("<value><intt>5</int></value>")
-        except ValueError, ex:
-            print "Value Error: ", ex
+        except ValueError as ex:
+            print("Value Error: ", ex)
             retex=ex
-        except pilot.Exception,ex:
-            print "YACS exception:",ex.what()
+        except pilot.Exception as ex:
+            print("YACS exception:",ex.what())
             retex=ex.what()
-        self.assert_(retex is not None, "exception not raised, or wrong type")
+        self.assertTrue(retex is not None, "exception not raised, or wrong type")
         inport.edInitXML("<value><int>5</int></value>")
 
         # --- create script node node2
         n2=self.r.createScriptNode("","node2")
-        n2.setScript("print 'coucou2'")
+        n2.setScript("print('coucou2')")
         n2.edAddInputPort("p1",ti)
         p.edAddChild(n2)
         # --- end of node
@@ -95,7 +95,7 @@ class TestEdit(unittest.TestCase):
         n=self.r.createFuncNode("","node3")
         n.setScript("""
         def f():
-        print 'coucou3'
+        print('coucou3')
         """)
         n.setFname("f")
         p.edAddChild(n)
@@ -126,7 +126,7 @@ class TestEdit(unittest.TestCase):
         p.edAddChild(b)
         
         n=self.r.createScriptNode("","b1.node2")
-        n.setScript("print 'coucou2'")
+        n.setScript("print('coucou2')")
         b.edAddChild(n)
         # --- end bloc
 
@@ -137,7 +137,7 @@ class TestEdit(unittest.TestCase):
         ip.edInitInt(3)
 
         n=self.r.createScriptNode("","l1.node2")
-        n.setScript("print 'coucou2'")
+        n.setScript("print('coucou2')")
         lo.edSetNode(n)
         # --- end loop
 
@@ -151,7 +151,7 @@ class TestEdit(unittest.TestCase):
         n=self.r.createFuncNode("","w1.node3")
         n.setScript("""
 def f():
-  print 'coucou3'
+  print('coucou3')
   return 0
 """)
         n.setFname("f")
@@ -168,7 +168,7 @@ def f():
         n=self.r.createFuncNode("","sw1.node3")
         n.setScript("""
 def f():
-  print 'case1'
+  print('case1')
   return 0
 """)
         n.setFname("f")
@@ -177,7 +177,7 @@ def f():
         n=self.r.createFuncNode("","sw1.node4")
         n.setScript("""
 def f():
-  print 'default'
+  print('default')
   return 0
 """)
         n.setFname("f")
@@ -188,8 +188,8 @@ def f():
 
         try:
           self.e.RunW(p,0)
-        except pilot.Exception,ex:
-          print ex.what()
+        except pilot.Exception as ex:
+          print(ex.what())
           self.fail(ex)
         
         #self.e.displayDot(p)
index ca5a953ae33c083e5165ab56e8e14d0e82ecb5ce..0c599b48f44c99ad2d29aa09b8619110d31a9ed9 100755 (executable)
@@ -38,7 +38,7 @@ class TestExec(unittest.TestCase):
     def test1_StepByStep(self):
         # --- execution step by step
        
-        print "================= Start of STEPBYSTEP ==================="
+        print("================= Start of STEPBYSTEP ===================")
         self.e.setExecMode(1) # YACS::STEPBYSTEP
         
         run1 = threading.Thread(None, self.e.RunPy, "stepbystep", (self.p,0))
@@ -51,7 +51,7 @@ class TestExec(unittest.TestCase):
             self.e.waitPause()
             #e.displayDot(p)
             bp = self.e.getTasksToLoad()
-            print "nexts possible steps = ", bp
+            print("nexts possible steps = ", bp)
             if len(bp) > 0:
                 tte= bp[-1:] # only one node at each step, the last one in the list
                 r = self.e.setStepsToExecute(tte)
@@ -60,7 +60,7 @@ class TestExec(unittest.TestCase):
             else:
                 tocont = False
                 pass
-            print "toContinue = ", tocont
+            print("toContinue = ", tocont)
             pass
         
         self.e.resumeCurrentBreakPoint()
@@ -73,13 +73,13 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of STEPBYSTEP ====================="
+        print("================= End of STEPBYSTEP =====================")
         pass
 
     def test2_StopToBreakpoint(self):
         # --- start execution, set a breakpoint before node48, then continue
         time.sleep(1)
-        print "================= Start of BREAKPOINT ==================="
+        print("================= Start of BREAKPOINT ===================")
         brp=['node48']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -88,9 +88,9 @@ class TestExec(unittest.TestCase):
         time.sleep(0.1)
         self.e.waitPause()
         #self.e.displayDot(p)
-        print "================= reach BREAKPOINT ======================"
+        print("================= reach BREAKPOINT ======================")
         # --- resume from breakpoint
-        print "=========== BREAKPOINT, start RESUME ===================="
+        print("=========== BREAKPOINT, start RESUME ====================")
         time.sleep(1)
         self.e.setExecMode(0) # YACS::CONTINUE
         self.e.resumeCurrentBreakPoint()
@@ -106,14 +106,14 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of RESUME ========================="
+        print("================= End of RESUME =========================")
         pass
     
     def test3_RunWithoutBreakpoints(self):
         # --- start execution, run without breakpoints
         time.sleep(1)
         
-        print "================= Start of CONTINUE ====================="
+        print("================= Start of CONTINUE =====================")
         self.e.setExecMode(0) # YACS::CONTINUE
         run3 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
         run3.start()
@@ -129,14 +129,14 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of CONTINUE ======================="
+        print("================= End of CONTINUE =======================")
         pass
 
     def test4_StopOnError(self):
         # --- stop execution on first error and save state
         time.sleep(1)
 
-        print "================= Start of STOPONERROR =================="
+        print("================= Start of STOPONERROR ==================")
         self.e.setStopOnError()
         run4 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
         run4.start()
@@ -148,15 +148,15 @@ class TestExec(unittest.TestCase):
         #self.e.displayDot(self.p)
         s13 = self.p.getChildByName('node13').getEffectiveState()
         s43 = self.p.getChildByName('node43').getEffectiveState()
-        self.assert_((s13==999) or (s43==999))
-        print "================= End of STOPONERROR ====================="
+        self.assertTrue((s13==999) or (s43==999))
+        print("================= End of STOPONERROR =====================")
         pass
 
     def test5_PartialExec(self):
         # --- stop execution after breakpoint
         time.sleep(1)
 
-        print "================= Start of PARTIALEXEC ==================="
+        print("================= Start of PARTIALEXEC ===================")
         brp=['node35']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -173,17 +173,18 @@ class TestExec(unittest.TestCase):
         #self.e.displayDot(self.p)
         self.assertEqual(106, self.p.getChildByName('node34').getEffectiveState())
         self.assertEqual(101, self.p.getChildByName('node35').getEffectiveState())
-        print "================= reach BREAKPOINT PARTIAL EXEC =========="
+        print("================= reach BREAKPOINT PARTIAL EXEC ==========")
         pass
-                          
+
     pass
 
 if __name__ == '__main__':
-  import os
-  U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testExec.py\n")
-  suite = unittest.makeSuite(TestExec)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
-  sys.exit(not result.wasSuccessful())
\ No newline at end of file
+    import os
+    import sys
+    U = os.getenv('USER')
+    with open(os.path.join("/tmp", U, "UnitTestsResult"), 'a') as f:
+        f.write("  --- TEST src/yacsloader: testExec.py\n")
+        suite = unittest.makeSuite(TestExec)
+        result = unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+
+    sys.exit(not result.wasSuccessful())
index 42c5adcbf50a89b5e2f1a3ce527a5242bee819c8..0083871b6898ec80ce81eec813c5eaebdc3928d0 100755 (executable)
@@ -41,13 +41,13 @@ class TestLoader(unittest.TestCase):
     retex=None
     try:
       p = self.l.load("nonexisting")
-    except IOError, ex:
-      print "IO Error: ", ex
+    except IOError as ex:
+      print("IO Error: ", ex)
       retex=ex
-    #except pilot.invalid_argument,ex:
-    #  print "invalid_argument:",ex.what()
+    # except pilot.invalid_argument as ex:
+    #  print("invalid_argument:",str(ex))
     #  retex=ex.what()
-    self.assert_(retex is not None, "exception not raised, or wrong type")
+    self.assertTrue(retex is not None, "exception not raised, or wrong type")
     pass
 
   def test2_parseError(self):
@@ -55,29 +55,29 @@ class TestLoader(unittest.TestCase):
     retex=None
     try:
       p = self.l.load("samples/bid.xml")
-    except ValueError,ex:
-      print "Caught ValueError Exception:",ex
+    except ValueError as ex:
+      print("Caught ValueError Exception:",ex)
       retex = ex
     expected="LogRecord: parser:ERROR:from node node5 does not exist in control link: node5->b2 context: b1. (samples/bid.xml:53)\n"
-    self.assert_(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
+    self.assertTrue(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
     pass
 
   def test3_normal(self):
     # --- File exists and no parsing problem
     try:
       p = self.l.load("samples/aschema.xml")
-      print p.getLogger("parser").getStr()
-      print p
-      print p.getName()
-      for k in p.typeMap: print k
-      for k in p.nodeMap: print k
-      for k in p.inlineMap: print k
-      for k in p.serviceMap: print k
-      print self.e.getTasksToLoad()
+      print(p.getLogger("parser").getStr())
+      print(p)
+      print(p.getName())
+      for k in p.typeMap: print(k)
+      for k in p.nodeMap: print(k)
+      for k in p.inlineMap: print(k)
+      for k in p.serviceMap: print(k)
+      print(self.e.getTasksToLoad())
       self.e.RunW(p,0)
       self.assertEqual(106, p.getChildByName('node48').getEffectiveState())
-    except pilot.Exception,ex:
-      print "YACS exception:",ex
+    except pilot.Exception as ex:
+      print("YACS exception:",ex)
       self.fail(ex)
       pass
     pass
@@ -90,4 +90,4 @@ if __name__ == '__main__':
   suite = unittest.makeSuite(TestLoader)
   result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
   f.close()
-  sys.exit(not result.wasSuccessful())
\ No newline at end of file
+  sys.exit(not result.wasSuccessful())
index 700b43b0266de2025448060db47764614fd1e0ec..efd29c7827edc416211bedd56c15741ae8043054 100755 (executable)
@@ -31,14 +31,14 @@ class TestContainerRef(unittest.TestCase):
     """test delete following creation from class"""
     co=self.r.createContainer()
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test1(self):
     """test delete following creation from createContainer and delitem from containerMap"""
     co=self.p.createContainer("c2")
     del self.p.containerMap["c2"]
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
     del co
 
@@ -49,7 +49,7 @@ class TestContainerRef(unittest.TestCase):
     co=self.p.createContainer("c2")
     self.p.containerMap["c2"]=co
     del self.p.containerMap["c2"]
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
     del co
 
@@ -61,7 +61,7 @@ class TestContainerRef(unittest.TestCase):
     del self.p.containerMap["c9"]
     self.assertEqual(co.getName(), "c9")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test4(self):
@@ -70,7 +70,7 @@ class TestContainerRef(unittest.TestCase):
     del self.p.containerMap["c10"]
     self.assertEqual(co.getName(), "c10")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test5(self):
@@ -79,19 +79,19 @@ class TestContainerRef(unittest.TestCase):
     del self.p
     self.assertEqual(co.getName(), "c10")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test6(self):
     """test ownership of container on getitem from containerMap"""
     co=self.p.createContainer("c8")
     self.assertEqual(co.getRefCnt(), 2)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
     self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
     co=self.p.containerMap["c8"]
     self.assertEqual(co.getRefCnt(), 2)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
     self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
     del self.p.containerMap["c8"]
@@ -121,22 +121,22 @@ class TestContainerRef(unittest.TestCase):
   def test9(self):
     """test method values"""
     self.p.createContainer("c8")
-    for co in self.p.containerMap.values():
-      self.assert_(co.thisown)
+    for co in list(self.p.containerMap.values()):
+      self.assertTrue(co.thisown)
       self.assertEqual(co.getRefCnt(), 2)
 
   def test10(self):
     """test method items"""
     self.p.createContainer("c8")
-    for k,co in self.p.containerMap.items():
-      self.assert_(co.thisown)
+    for k,co in list(self.p.containerMap.items()):
+      self.assertTrue(co.thisown)
       self.assertEqual(co.getRefCnt(), 2)
 
   def test11(self):
     """test method clear"""
     co=self.p.createContainer("c8")
     self.p.containerMap.clear()
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
 
   def test12(self):
@@ -144,7 +144,7 @@ class TestContainerRef(unittest.TestCase):
     co=self.p.createContainer("c8")
     d={"c1":co}
     self.p.containerMap.update(d)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 3)
 
 class TestTypeCodeRef(unittest.TestCase):
@@ -156,13 +156,13 @@ class TestTypeCodeRef(unittest.TestCase):
     """test delete following creation from createSequenceTc"""
     tc=pilot.TypeCode(pilot.Double)
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test1(self):
     """test delete following creation from createInterfaceTc and delitem from typeMap"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p.typeMap["obj"]
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test2(self):
@@ -172,7 +172,7 @@ class TestTypeCodeRef(unittest.TestCase):
     tc=self.p.createInterfaceTc("","obj",[])
     self.p.typeMap["obj"]=tc
     del self.p.typeMap["obj"]
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test3(self):
@@ -182,32 +182,32 @@ class TestTypeCodeRef(unittest.TestCase):
     self.assertEqual(tc.getRefCnt(), 2)
     del self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test4(self):
     """test delete from typeMap following creation from createInterfaceTc"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test5(self):
     """test existence TypeCode following delete proc"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test6(self):
     """test ownership of TypeCode on getitem from typeMap"""
     tc=self.p.createInterfaceTc("","obj",[])
     self.assertEqual(tc.getRefCnt(), 2)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     del tc
     self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
     tc=self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 2)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     del tc
     self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
     del self.p.typeMap["obj"]
@@ -237,24 +237,24 @@ class TestTypeCodeRef(unittest.TestCase):
   def test9(self):
     """test method values"""
     self.p.createInterfaceTc("","obj",[])
-    for tc in self.p.typeMap.values():
+    for tc in list(self.p.typeMap.values()):
       if tc.name()!="obj":continue
-      self.assert_(tc.thisown)
+      self.assertTrue(tc.thisown)
       self.assertEqual(tc.getRefCnt(), 2)
 
   def test10(self):
     """test method items"""
     self.p.createInterfaceTc("","obj",[])
-    for k,tc in self.p.typeMap.items():
+    for k,tc in list(self.p.typeMap.items()):
       if tc.name()!="obj":continue
-      self.assert_(tc.thisown)
+      self.assertTrue(tc.thisown)
       self.assertEqual(tc.getRefCnt(), 2)
 
   def test11(self):
     """test method clear"""
     tc=self.p.createInterfaceTc("","obj",[])
     self.p.typeMap.clear()
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test12(self):
@@ -262,7 +262,7 @@ class TestTypeCodeRef(unittest.TestCase):
     tc=self.p.createInterfaceTc("","obj",[])
     d={"c1":tc}
     self.p.typeMap.update(d)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 3)
 
 if __name__ == '__main__':
index de5c7ed541350df2c92b7c4d97fe9660d2097cc7..f796f72cb06d9cc7181fcb3229199f31830922c8 100755 (executable)
@@ -39,7 +39,7 @@ class TestResume(unittest.TestCase):
         # --- stop execution after breakpoint
         time.sleep(1)
 
-        print "================= Start of PARTIALEXEC ==================="
+        print("================= Start of PARTIALEXEC ===================")
         brp=['b1.b2.node1']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -55,14 +55,14 @@ class TestResume(unittest.TestCase):
         #self.e.displayDot(self.p)
         self.assertEqual(101, self.p.getChildByName('b1.b2.node1').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
-        print "================= reach BREAKPOINT PARTIAL EXEC =========="
+        print("================= reach BREAKPOINT PARTIAL EXEC ==========")
         pass
 
     def test2_ExecFromLoadState(self):
         # --- reload state from previous partial execution then exec
         time.sleep(1)
 
-        print "================= Start of EXECLOADEDSTATE ==============="
+        print("================= Start of EXECLOADEDSTATE ===============")
         sp = loader.stateParser()
         sl = loader.stateLoader(sp,self.p)
         sl.parse('dumpPartialBloc2.xml')
@@ -81,7 +81,7 @@ class TestResume(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('b1.b2.node1').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.b2.node2').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.b2.loop1.node1').getEffectiveState())
-        print "================= End of EXECLOADEDSTATE ================="
+        print("================= End of EXECLOADEDSTATE =================")
                           
     pass
 
index be71e8bc24d378f3ceb46cdc3eb68813d9bff066..644c8d8b427a028a8d9c26d38a1396764103e539 100755 (executable)
@@ -69,12 +69,12 @@ class TestSave(unittest.TestCase):
                 s.save(saveSchema2)
                 e.RunW(p,0)
                 e.saveState(dumpSchema2)
-            except ValueError, ex:
-                print "Value Error: ", ex
+            except ValueError as ex:
+                print("Value Error: ", ex)
                 pb = "problem on " + fileOrig + " : ValueError"
                 self.fail(pb)
-            except pilot.Exception,ex:
-                print ex.what()
+            except pilot.Exception as ex:
+                print(ex.what())
                 pb = "problem on " + fileOrig + " : " + ex.what()
                 self.fail(pb)
             except:
index 6a35686d27828304e587f468ddf54d25a52dba5e..8cc06d351dd0cbfa41b68da84e0ccf0cd2817e21 100755 (executable)
@@ -50,13 +50,13 @@ def ff(nb,dbg):
     
     ref=datetime.datetime.now()
     t=0. ; pas=1./float(nb)
-    for i in xrange(nb):
-        for j in xrange(nb):
+    for i in range(nb):
+        for j in range(nb):
             x=j*pas
             t+=1.+cos(1.*(x*3.14159))
             pass
         pass
-    print "coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
+    print("coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref)))
     return t
 """
     script1="""
@@ -64,14 +64,14 @@ from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
+print("coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref)))
 """
-    for i in xrange(nbOfNodes):
+    for i in range(nbOfNodes):
       node0=self.r.createFuncNode("DistPython","node%i"%(i))
       p.edAddChild(node0)
       node0.setFname("ff")
@@ -109,17 +109,17 @@ print "coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
     st=datetime.datetime.now()
     # 1st exec
     ex.RunW(p,0)
-    print "Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 2nd exec using the same already launched remote python interpreters
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 3rd exec using the same already launched remote python interpreters
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     pass
 
@@ -144,13 +144,13 @@ def ff(nb,dbg):
     
     ref=datetime.datetime.now()
     t=0. ; pas=1./float(nb)
-    for i in xrange(nb):
-        for j in xrange(nb):
+    for i in range(nb):
+        for j in range(nb):
             x=j*pas
             t+=1.+cos(1.*(x*3.14159))
             pass
         pass
-    print "coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
+    print("coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref)))
     return t
 """
     # here in script1 aa is refered ! aa will exist thanks to HPCont Init Script
@@ -159,16 +159,16 @@ from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou %lf from script1-%i  -> %s"%(aa,dbg,str(datetime.datetime.now()-ref))
+print("coucou %lf from script1-%i  -> %s"%(aa,dbg,str(datetime.datetime.now()-ref)))
 aa+=1.
 """
     #
-    for i in xrange(nbOfNodes):
+    for i in range(nbOfNodes):
       nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i)) # PyFuncNode remote
       p.edAddChild(nodeMiddle)
       nodeMiddle.setFname("ff")
@@ -198,17 +198,17 @@ aa+=1.
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     pass
 
@@ -216,19 +216,19 @@ aa+=1.
     """ Test on HP Containers in foreach context."""
     script0="""def ff():
     global aa
-    print "%%lf - %%s"%%(aa,str(my_container))
+    print("%%lf - %%s"%%(aa,str(my_container)))
     return 16*[%i],0
 """
     script1="""from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref))
+print("coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref)))
 aa+=1.
 o3=0
 """
@@ -292,19 +292,19 @@ o3=0
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     pass
@@ -313,19 +313,19 @@ o3=0
     """ Test that focuses on parallel load of containers."""
     script0="""def ff():
     global aa
-    print "%%lf - %%s"%%(aa,str(my_container))
+    print("%%lf - %%s"%%(aa,str(my_container)))
     return 100*[%i],0
 """
     script1="""from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref))
+print("coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref)))
 aa+=1.
 o3=0
 """
@@ -389,19 +389,19 @@ o3=0
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     pass
@@ -412,9 +412,9 @@ o3=0
     script1="""nb=7
 ii=0
 o1=nb*[None]
-for i in xrange(nb):
+for i in range(nb):
     tmp=(i+10)*[None]
-    for j in xrange(i+10):
+    for j in range(i+10):
         tmp[j]=ii
         ii+=1
         pass
@@ -497,9 +497,9 @@ for i in xrange(nb):
     script1="""nb=7
 ii=0
 o1=nb*[None]
-for i in xrange(nb):
+for i in range(nb):
     tmp=(i+10)*[None]
-    for j in xrange(i+10):
+    for j in range(i+10):
         tmp[j]=ii
         ii+=1
         pass
@@ -620,8 +620,8 @@ for i in xrange(nb):
     self.assertEqual(n1.getState(),pilot.DONE)
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
-    self.assertEqual(a,range(6))
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L, 12L, 16L, 18L, -4L, 10L]])
+    self.assertEqual(a,list(range(6)))
+    self.assertEqual([elt.getPyObj() for elt in b],[[6, 12, 16, 18, -4, 10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -680,8 +680,8 @@ else:
     self.assertEqual(n1.getState(),pilot.FAILED)
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
-    self.assertEqual(a,range(3))
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L]])
+    self.assertEqual(a,list(range(3)))
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -745,7 +745,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[0,1,2,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -767,7 +767,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[1,2,3,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[12L,16L,18L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[12,16,18,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -833,7 +833,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[0,1,2,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -851,7 +851,7 @@ o2=7*i1
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6L,12L,16L,63L,-4L,10L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6,12,16,63,-4,10])
     pass
 
   def test10(self):
@@ -915,7 +915,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[1,3,5,7,9,11])
-    self.assertEqual([elt.getPyObj() for elt in b],[[12L,36L,60L,84L,108L,132L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[12,36,60,84,108,132]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -937,7 +937,7 @@ else:
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,12L,30L,36L,60L,60L,90L,84L,120L,108L,150L,132L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,12,30,36,60,60,90,84,120,108,150,132])
     pass
 
   pass
@@ -1006,7 +1006,7 @@ else:
     a,b,c=n1.getPassedResults(ex)
 
     self.assertEqual(a,[0,2,4,6,8,10])
-    self.assertEqual([elt.getPyObj() for elt in b],[[0L,4L,8L,12L,16L,20L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[0,4,8,12,16,20]])
     
     p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(12) ]")
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -1029,7 +1029,7 @@ else:
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,5L,4L,15L,8L,25L,12L,35L,16L,45L,20L,55L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,5,4,15,8,25,12,35,16,45,20,55])
     pass
   
   def test12(self):
@@ -1122,14 +1122,14 @@ for i in i8:
     #
     node0=self.r.createForEachLoop("ForEachLoop_int0",ti)
     p.edAddChild(node0)
-    node0.edGetSeqOfSamplesPort().edInitPy(range(4))
+    node0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
     node0.edGetNbOfBranchesPort().edInitInt(2)
     #
     node00=self.r.createBloc("Bloc0")
     node0.edAddChild(node00)
     node000_0=self.r.createForEachLoop("ForEachLoop_int1",ti)
     node00.edAddChild(node000_0)
-    node000_0.edGetSeqOfSamplesPort().edInitPy(range(4))
+    node000_0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
     node000_0.edGetNbOfBranchesPort().edInitInt(3)
     #
     node0000=self.r.createBloc("Bloc1")
@@ -1157,7 +1157,7 @@ for i in i8:
     node00.edAddChild(node000_1)
     i7=node000_1.edAddInputPort("i7",ti2)
     i5=node000_1.edAddInputPort("i5",ti2)
-    node000_1.setScript("for i in i7:\n    print i\nprint \"separation\"\nfor i in i5:\n    print i")
+    node000_1.setScript("for i in i7:\n    print(i)\nprint(\"separation\")\nfor i in i5:\n    print(i)")
     node000_1.setContainer(cont)
     node000_1.setExecutionMode("remote")
     p.edAddLink(o5,i7)
@@ -1191,7 +1191,7 @@ for i in i8:
     #
     n00.edAddLink(n000.edGetSamplePort(),i0)
     #
-    n000.edGetSeqOfSamplesPort().edInitPy(range(10))
+    n000.edGetSeqOfSamplesPort().edInitPy(list(range(10)))
     n000.edGetNbOfBranchesPort().edInitInt(2)
     #
     n01=r.createScriptNode("Salome","test23/check") ; n0bis.edAddChild(n01)
@@ -1223,7 +1223,7 @@ for i in i8:
     #
     nb=4
     outs=[]
-    for i in xrange(nb):
+    for i in range(nb):
       node=self.r.createScriptNode("Salome","node%d"%i)
       node.setExecutionMode("remote")
       node.setContainer(cont)
@@ -1237,7 +1237,7 @@ for i in i8:
     res=node.edAddOutputPort("res",ti)
     p.edAddChild(node)
     l=[]
-    for i in xrange(nb):
+    for i in range(nb):
       elt="i%d"%i
       inp=node.edAddInputPort(elt,ti) ; l.append(elt)
       p.edAddChild(node)
@@ -1245,7 +1245,7 @@ for i in i8:
     node.setScript("res="+"+".join(l))
     p.edAddCFLink(b,node)
     #
-    for i in xrange(10):
+    for i in range(10):
       p.init()
       ex = pilot.ExecutorSwig()
       self.assertEqual(p.getState(),pilot.READY)
@@ -1264,7 +1264,7 @@ for i in i8:
     
     n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
     o0=n00.edAddOutputPort("o0",tp2)
-    n00.setScript("o0=[[i+1] for i in xrange(8)]")
+    n00.setScript("o0=[[i+1] for i in range(8)]")
     n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
     i1=n01.edAddInputPort("i1",tp)
     n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
@@ -1288,7 +1288,7 @@ for i in i8:
     
     n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
     o0=n00.edAddOutputPort("o0",tp2)
-    n00.setScript("o0=[[i+1] for i in xrange(8)]")
+    n00.setScript("o0=[[i+1] for i in range(8)]")
     n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
     i1=n01.edAddInputPort("i1",tp)
     n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
@@ -1524,7 +1524,7 @@ o2=2*i1
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(a,[0,1])
-    self.assertEqual([elt.getPyObj() for elt in b],[[0L,2L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[0,2]])
     #
     p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -1543,7 +1543,7 @@ o2=5*i1
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,2L,10L,15L,20L,25L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
     pass
   pass
 
@@ -1561,11 +1561,11 @@ o2=5*i1
     q.getChildByName("n1").getChildByName("n10").setScript("""
 import time
 time.sleep(0.1)
-print "execution n10:", i1
+print("execution n10:", i1)
 o2=5*i1
 """)
     q.getChildByName("n2").setScript("""
-print "execution n2:", i3
+print("execution n2:", i3)
 o4=i3
 """)
     loader.loadState(q, xmlStateFileName)
index 5efb5ae637da01802cad5c4e1d13df48ba92f874..7b64c77d346b7477a8b7d1e00ed4fdfef6aa04f5 100644 (file)
@@ -40,7 +40,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("res.xml")
@@ -53,10 +53,10 @@ for name in names:
     i+=1
     pass
 
-print procEx.getOutPortValue(dico["poly_7"],"Pn")
-print procEx.getInPortValue(dico["poly_7"],"x")
-print procEx.getInPortValue(dico["poly_7"],"notAPort")
-print procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps")
+print(procEx.getOutPortValue(dico["poly_7"],"Pn"))
+print(procEx.getInPortValue(dico["poly_7"],"x"))
+print(procEx.getInPortValue(dico["poly_7"],"notAPort"))
+print(procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps"))
 
 # -----------------------------------------------------------------------------
 # --- schema with errors (echoSrv must be launched)
@@ -72,7 +72,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("res2.xml")
@@ -85,8 +85,8 @@ for name in names:
     i+=1
     pass
 
-print procEx.getErrorDetails(dico["c1"])
-print procEx.getErrorDetails(dico["node13"])
+print(procEx.getErrorDetails(dico["c1"]))
+print(procEx.getErrorDetails(dico["node13"]))
 
 # -----------------------------------------------------------------------------
 # --- schema with errors
@@ -102,7 +102,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 #procEx.resumeCurrentBreakPoint()
@@ -122,7 +122,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("partialExec.xml")
@@ -136,7 +136,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("finishExec.xml")
index 79b88b0f879585f92bb82ff4c5c1fb965622d273..5ce0f7ff68b1797cbe6dd146c0ba407ac5c90b2d 100644 (file)
@@ -100,9 +100,9 @@ class proc_i(YACS_ORB__POA.ProcExec):
         return self.p.getIds()
 
     def runProc(self,debug, isPyThread, fromscratch):
-      print "**************************Begin schema execution %s**************************" % self.xmlFile
+      print("**************************Begin schema execution %s**************************" % self.xmlFile)
       self.e.RunPy(self.p,debug, isPyThread, fromscratch)
-      print "**************************End schema execution %s****************************" % self.xmlFile
+      print("**************************End schema execution %s****************************" % self.xmlFile)
 
     def Run(self):
         if self.run1 is not None:
@@ -132,17 +132,17 @@ class proc_i(YACS_ORB__POA.ProcExec):
             sp = loader.stateParser()
             sl = loader.stateLoader(sp,self.p)
             sl.parse(xmlFile)
-          except IOError, ex:
-            print "IO Error: ", ex
+          except IOError as ex:
+            print("IO Error: ", ex)
             return
-          except ValueError,ex:
-            print "Caught ValueError Exception:",ex
+          except ValueError as ex:
+            print("Caught ValueError Exception:",ex)
             return
-          except pilot.Exception,ex:
-            print ex.what()
+          except pilot.Exception as ex:
+            print(ex.what())
             return
           except:
-            print "Unknown exception!"
+            print("Unknown exception!")
             return
 
         if self.run1 is None:
@@ -240,7 +240,7 @@ class YACS(YACS_ORB__POA.YACS_Gen,
     """
     def __init__ ( self, orb, poa, contID, containerName, instanceName,
                    interfaceName ):
-        print "YACS.__init__: ", containerName, ';', instanceName
+        print("YACS.__init__: ", containerName, ';', instanceName)
         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, contID,
                                                          containerName, instanceName,
                                                          interfaceName, False)
@@ -283,18 +283,18 @@ class YACS(YACS_ORB__POA.YACS_Gen,
             procExec_i = proc_i(xmlFile)
             logger=procExec_i.p.getLogger("parser")
             if not logger.isEmpty():
-              print "The imported file has errors :"
-              print logger.getStr()
+              print("The imported file has errors :")
+              print(logger.getStr())
               sys.stdout.flush()
               return None
-        except IOError, ex:
-            print >> sys.stderr ,"IO Error: ", ex
+        except IOError as ex:
+            print("IO Error: ", ex, file=sys.stderr)
             return None
-        except ValueError,ex:
-            print >> sys.stderr ,"Caught ValueError Exception:",ex
+        except ValueError as ex:
+            print("Caught ValueError Exception:",ex, file=sys.stderr)
             return None
-        except pilot.Exception,ex:
-            print >> sys.stderr ,ex.what()
+        except pilot.Exception as ex:
+            print(ex.what(), file=sys.stderr)
             return None
         except:
             traceback.print_exc()
index e83c6d94629fa3c688cac008785e434d636781d5..6410c08d967fb0b8efab9cd3746e05a59e597a63 100644 (file)
@@ -131,7 +131,7 @@ void YDFXGUIHostParametrizer::applyToEFX()
       YACSEvalParamsForCluster& ps(res->getAddParamsForCluster());
       _clusterAdvInfo->applyToParams(ps);
     }
-  emit readyForRunSignal(true);
+  Q_EMIT readyForRunSignal(true);
 }
 
 QString YDFXGUIHostParametrizer::getNameOfHost()
@@ -148,7 +148,7 @@ void YDFXGUIHostParametrizer::changeMachine(const QString& newMachineSelected)
   ok->setDisabled(!isInterac && !_clusterAdvInfo->isOK());
   if(_wasInteractive!=isInterac)
     {
-      emit interactivityChanged(isInterac);
+      Q_EMIT interactivityChanged(isInterac);
       _wasInteractive=isInterac;
     }
 }
@@ -346,7 +346,7 @@ void YDFXGUIBatchInfo::loadFromSettings(const QSettings& settings)
     }
   bool newOK(isOK());
   _wasOK=newOK;
-  emit statusOfEntryChanged(newOK);
+  Q_EMIT statusOfEntryChanged(newOK);
 }
 
 void YDFXGUIBatchInfo::learnSettings(QSettings& settings) const
@@ -379,7 +379,7 @@ QString YDFXGUIBatchInfo::getNameOfHost()
 
 void YDFXGUIBatchInfo::somethingChanged()
 {
-  emit statusOfEntryChanged(isOK());
+  Q_EMIT statusOfEntryChanged(isOK());
 }
 
 QString YDFXGUIBatchInfo::NormalizeDuration(const QString& txt)
index 80509ce29136fb829ed5a0a336a65a66cae4b498..a0a99f7e400647427cd82485f04ba567f0c9150a 100644 (file)
@@ -29,8 +29,6 @@
 #include <QThread>
 #include <QMutex>
 
-#include "Python.h"
-
 class YACSEvalSession;
 class YACSEvalYFXWrap;
 class YDFXGUIAllPorts;
index f54c4c0943b497650dde5d49177460a2da17ccbf..2ee3c77176ba2d0f3f20c6e306892558aee0a8b0 100644 (file)
@@ -305,7 +305,7 @@ void YDFXGUIInputPortValueEditor::setText(const QString& text)
     {
       if(wasKO)
         {
-          emit statusChanged();
+          Q_EMIT statusChanged();
           disconnect(this,SIGNAL(changeLook()),this,SLOT(applyModificationOfLook()));
         }
     }
@@ -414,7 +414,7 @@ bool YDFXGUIInputPortValueEditor::toggleRandom()
   bool oldOK(isOK());
   bool oldStatus(_inp->isRandomVar());
   _inp->declareRandomnessStatus(!oldStatus);
-  emit statusChanged(); // always emit because this even if newOK and oldOK are the same the upon status can changed !
+  Q_EMIT statusChanged(); // always Q_EMIT because this even if newOK and oldOK are the same the upon status can changed !
   updateGeometry();
   update();
   return _inp->isRandomVar();
@@ -563,7 +563,7 @@ void InputLabel::paintIfNotOn(QPaintEvent *event)
 
 void InputLabel::pressOccured()
 {
-  emit randomnessStatusChanged();
+  Q_EMIT randomnessStatusChanged();
 }
 
 std::vector<ColoredString> InputLabel::textForEmulatedPushButton() const
@@ -651,7 +651,7 @@ void OutputLabel::pressOccured()
 {
   bool oldStatus(_outp->isQOfInterest());
   _outp->setQOfInterestStatus(!oldStatus);
-  emit clicked();
+  Q_EMIT clicked();
 }
 
 std::vector<ColoredString> OutputLabel::textForEmulatedPushButton() const
@@ -719,7 +719,7 @@ void YDFXGUIGatherPorts::somebodyChangedStatus()
       update();
       setWasOKStatus(newStatus);
     }
-  emit theGlobalStatusChanged(newStatus);// emit signal always because of input ports and sequences definitions.
+  Q_EMIT theGlobalStatusChanged(newStatus);// Q_EMIT signal always because of input ports and sequences definitions.
 }
 
 //////////////////
@@ -820,7 +820,7 @@ void YDFXGUIInputPortsSelector::timerEvent(QTimerEvent *e)
           YDFXGUIInputPortValueEditor *childc(qobject_cast<YDFXGUIInputPortValueEditor *>(child));
           if(childc)
             {
-              emit childc->changeLook();
+              Q_EMIT childc->changeLook();
             }
         }
     }
@@ -977,10 +977,10 @@ void YDFXGUIAllPorts::somethingChangedInPorts(bool status)
   bool step1(_in->isOK() && _out->isOK());
   if(!step1)
     {
-      emit sequencesCanBeDefinedSignal(false);
-      emit canBeExecutedSignal(false);
+      Q_EMIT sequencesCanBeDefinedSignal(false);
+      Q_EMIT canBeExecutedSignal(false);
       return ;
     }
-  emit sequencesCanBeDefinedSignal(true);
-  emit canBeExecutedSignal(_in->areSeqWellDefined());
+  Q_EMIT sequencesCanBeDefinedSignal(true);
+  Q_EMIT canBeExecutedSignal(_in->areSeqWellDefined());
 }
index b76d3d6438e81b6e62a4cd32e359dfd412095f19..29b4972381a8ebd21520ab1925c1214734382d25 100644 (file)
 //
 // Author : Anthony Geay (EDF R&D)
 
+#include "YDFXGUIPyThreadSaver.hxx"
 #include "YDFXGUIPushButtons.hxx"
 
 #include "YDFXGUIWrap.hxx"
 #include "YDFXGUISeqInit.hxx"
-#include "YDFXGUIPyThreadSaver.hxx"
 #include "YDFXGUIHostParametrizer.hxx"
 
 #include "YACSEvalSession.hxx"
@@ -95,7 +95,7 @@ void YDFXGUISeqInitButton::sequenceInitRequested()
   if(dial.exec())
     {
       _state=zeWidget->saveState();
-      emit sequenceWellDefined(true);
+      Q_EMIT sequenceWellDefined(true);
     }
 }
 
@@ -111,7 +111,7 @@ void YDFXGUIRunInfo::startComputation()
   std::fill(_items.begin(),_items.end(),0);
   _computationInProgress=true;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::endComputation()
@@ -119,7 +119,7 @@ void YDFXGUIRunInfo::endComputation()
   _mut.lock();
   _computationInProgress=false;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::sampleOK(int pos)
@@ -127,7 +127,7 @@ void YDFXGUIRunInfo::sampleOK(int pos)
   _mut.lock();
   _items[pos]=1;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::sampleKO(int pos)
@@ -135,7 +135,7 @@ void YDFXGUIRunInfo::sampleKO(int pos)
   _mut.lock();
   _items[pos]=2;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 std::vector<char> YDFXGUIRunInfo::getItems() const
index d10ee7c679627cae2efeeed817381bd9bc187db3..6ac1c99300708676609944e81bd54bc00c7e62f8 100644 (file)
 #ifndef __YDFXGUIPYTHREADSAVER_HXX__
 #define __YDFXGUIPYTHREADSAVER_HXX__
 
+#include "Python.h"
+
 #include "ydfxwidgetsExport.hxx"
 
-#include "Python.h"
 
 class QThread;
 
index 500ec1ad398e67fc757935aba95955e902682e32..a04ace9e61effd92152690396b65ab1329b33618 100644 (file)
@@ -18,6 +18,7 @@
 //
 // Author : Anthony Geay (EDF R&D)
 
+#include "Python.h"
 #include "YDFXGUISeqInit.hxx"
 
 #include <QFile>
@@ -31,7 +32,6 @@
 #include <QFileDialog>
 #include <QApplication>
 
-#include "Python.h"
 
 #include "AutoGIL.hxx"
 
@@ -101,7 +101,7 @@ bool YDFXGUISeqSetterP::executeScript(int& sz)
   //
   if(_fileName.isEmpty())
     {
-      emit problemDetected(QString("For \"%1\" : no file defined !").arg(zeBossc->getName()));
+      Q_EMIT problemDetected(QString("For \"%1\" : no file defined !").arg(zeBossc->getName()));
       return false;
     }
   QFile file(_fileName);
@@ -117,7 +117,7 @@ bool YDFXGUISeqSetterP::executeScript(int& sz)
       double v(line2.toDouble(&isOK));
       if(!isOK)
         {
-          emit problemDetected(QString("For \"%1\" : At line %2 it is not a float !").arg(zeBossc->getName()).arg(i));
+          Q_EMIT problemDetected(QString("For \"%1\" : At line %2 it is not a float !").arg(zeBossc->getName()).arg(i));
           return false;
         }
       _vect.push_back(v);
@@ -203,22 +203,22 @@ bool YDFXGUISeqSetterT::executeScript(int& sz)
     AutoPyRef code(Py_CompileString(txt.c_str(),TMP_FILENAME, Py_file_input));
     if(code.get() == NULL)
       {
-        emit problemDetected(QString("For \"%1\" : python code is invalid !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : python code is invalid !").arg(zeBossc->getName()));
         return false;
       }
     AutoPyRef context(PyDict_New());
     PyDict_SetItemString( context, "__builtins__", PyEval_GetBuiltins() );
-    AutoPyRef res(PyEval_EvalCode((PyCodeObject *)code.get(), context, context));
+    AutoPyRef res(PyEval_EvalCode(code.get(), context, context));
     PyObject *item(PyDict_GetItemString(context,name.c_str()));
     //
     if(!item)
       {
-        emit problemDetected(QString("For \"%1\" : Py var %1 is not defined !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : Py var %1 is not defined !").arg(zeBossc->getName()));
         return false;
       }
     if(!PyList_Check(item))
       {
-        emit problemDetected(QString("For \"%1\" : Py var %1 must be a list !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : Py var %1 must be a list !").arg(zeBossc->getName()));
         return false;
       }
     sz=PyList_Size(item);
@@ -228,7 +228,7 @@ bool YDFXGUISeqSetterT::executeScript(int& sz)
         PyObject *val(PyList_GetItem(item,i));
         if(!PyFloat_Check(val))
           {
-            emit problemDetected(QString("For \"%1\" : At pos %2 of python list, it is not a float !").arg(zeBossc->getName()).arg(i));
+            Q_EMIT problemDetected(QString("For \"%1\" : At pos %2 of python list, it is not a float !").arg(zeBossc->getName()).arg(i));
             return false;
           }
         _vect[i]=PyFloat_AS_DOUBLE(val);
@@ -292,7 +292,7 @@ YDFXGUISeqSetter::YDFXGUISeqSetter(QWidget *parent, const QString& name):QWidget
   QVBoxLayout *verticalLayout(new QVBoxLayout(this));
   _textEdit=new YDFXGUISeqSetterT(this); verticalLayout->addWidget(_textEdit);
   _push=new YDFXGUISeqSetterP(this); verticalLayout->addWidget(_push);
-  _textEdit->setText(QString("import math\n%1=[math.sqrt(float(elt)+0.) for elt in xrange(4)]").arg(name));
+  _textEdit->setText(QString("import math\n%1=[math.sqrt(float(elt)+0.) for elt in range(4)]").arg(name));
   _textEdit->hide();
   _push->hide();
 }
@@ -409,7 +409,7 @@ YDFXGUISeqLine::YDFXGUISeqLine(QWidget *parent, YACSEvalInputPort *inp):_combo(0
   connect(_combo,SIGNAL(currentIndexChanged(int)),this,SLOT(typeOfAssignmentChanged(int)));
   horizontalLayout->addWidget(_setter);
   _combo->setCurrentIndex(0);
-  emit _combo->currentIndexChanged(0);//to be sure to sync widgets
+  Q_EMIT _combo->currentIndexChanged(0);//to be sure to sync widgets
 }
 
 void YDFXGUISeqLine::loadState(const QMap<QString,QString>& state)
@@ -551,7 +551,7 @@ void YDFXGUISeqInitEff::assignButtonClicked()
 {
   int sz;
   bool verdict(checkConsistency(sz));
-  emit configurationIsOK(verdict);
+  Q_EMIT configurationIsOK(verdict);
 }
 
 void YDFXGUISeqInitEff::applyOnEFX()
@@ -572,7 +572,7 @@ bool YDFXGUISeqInitEff::checkConsistency(int& sz)
         refSz=locSz;
       if(locSz!=refSz)
         {
-          emit line->setter()->problemDetected(QString("Var %1 does not have the same number of elts than others !").arg(line->getName()));
+          Q_EMIT line->setter()->problemDetected(QString("Var %1 does not have the same number of elts than others !").arg(line->getName()));
           return false;
         }
     }
index 6c85bf55a596db37afca8b4bc1357eb3ac2b5363..477ff7b2df82b6ee4b01742c228d2c8691e433dd 100644 (file)
@@ -74,7 +74,7 @@ void YACSEvalYFXWrap::registerObserver(YACSEvalObserver *observer)
 void YACSEvalYFXWrap::unlockAll()
 {
   _efx->unlockAll();
-  emit lockSignal(false);
+  Q_EMIT lockSignal(false);
 }
 
 void YACSEvalYFXWrap::lockPortsForEvaluation()
@@ -97,7 +97,7 @@ void YACSEvalYFXWrap::lockPortsForEvaluation()
   _efx->lockPortsForEvaluation(inps2,outps2);
   _efx->giveResources();//do not remove this line to generate resource info
   if(!lockedOrNot)
-    emit lockSignal(true);
+    Q_EMIT lockSignal(true);
 }
 
 int YACSEvalYFXWrap::getNbOfItems() const
@@ -132,7 +132,7 @@ YACSEvalYFXWrap::~YACSEvalYFXWrap()
 void YACSEvalYFXWrap::setRunningStatus(bool status)
 {
   if(_isRunning!=status)
-    emit runSignal(status);
+    Q_EMIT runSignal(status);
   _isRunning=status;
 }
 
@@ -143,7 +143,7 @@ void YACSEvalYFXWrap::updateSequencesStatus()
   if(_isSeqOfValsSet!=newStatus)
     {
       _isSeqOfValsSet=newStatus;
-      emit sequencesAreSetSignal(_isSeqOfValsSet);
+      Q_EMIT sequencesAreSetSignal(_isSeqOfValsSet);
     }
 }