Salome HOME
Porting to SALOME 9.1.0.
authormzn <mzn@opencascade.com>
Mon, 20 Aug 2018 13:05:36 +0000 (16:05 +0300)
committermzn <mzn@opencascade.com>
Mon, 20 Aug 2018 14:04:58 +0000 (17:04 +0300)
77 files changed:
CMakeCommon/FindPython.cmake
correction_auto_2.py
salome_pid.py
src/BuildAPI/CMakeLists.txt
src/CollectionAPI/CMakeLists.txt
src/CollectionAPI/CollectionAPI.i
src/Config/CMakeLists.txt
src/Config/Config_ModuleReader.cpp
src/ConnectorAPI/CMakeLists.txt
src/ConnectorAPI/Test/TestExportToGEOM.py
src/ConnectorAPI/Test/TestExportToGEOMAllGroupsAndFields.py
src/ConnectorPlugin/ConnectorPlugin.py
src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py
src/ConstructionAPI/CMakeLists.txt
src/Events/CMakeLists.txt
src/ExchangeAPI/CMakeLists.txt
src/ExchangePlugin/CMakeLists.txt
src/ExchangePlugin/Test/TestExport.py
src/ExchangePlugin/Test/TestImport.py
src/FeaturesAPI/CMakeLists.txt
src/FeaturesPlugin/Test/TestMultiBoolean.py
src/FeaturesPlugin/Test/TestSerialBoolean.py
src/GDMLAPI/CMakeLists.txt
src/GeomAPI/CMakeLists.txt
src/GeomAPI/GeomAPI_Face.cpp
src/GeomAlgoAPI/CMakeLists.txt
src/GeomDataAPI/CMakeLists.txt
src/InitializationPlugin/InitializationPlugin_PyInterp.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI.i
src/ModelAPI/Test/TestCustomName_CutGroup.py
src/ModelGeomAlgo/CMakeLists.txt
src/ModelHighAPI/CMakeLists.txt
src/ModelHighAPI/ModelHighAPI.i
src/ModelHighAPI/ModelHighAPI_Tools.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ParametersAPI/CMakeLists.txt
src/ParametersPlugin/Test/TestParameterCreation.py
src/PartSetAPI/CMakeLists.txt
src/PrimitivesAPI/CMakeLists.txt
src/PythonAPI/Test/TestFeatures.py
src/PythonAPI/doc/source/conf.py
src/PythonAPI/model/__init__.py
src/PythonAPI/model/dump/__init__.py
src/PythonAPI/model/sketcher/__init__.py
src/PythonAPI/model/sketcher/tools.py
src/PythonAPI/model/tests/__init__.py
src/PythonAPI/model/tests/tests.py
src/PythonAddons/addons_Features.py
src/SketchAPI/CMakeLists.txt
src/SketchAPI/SketchAPI.i
src/SketchAPI/SketchAPI_Constraint.h
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/Test/Test1673.py
src/SketchPlugin/Test/Test1966.py
src/SketchPlugin/Test/Test1967.py
src/SketchPlugin/Test/Test2440.py
src/SketchPlugin/Test/TestConstraintFixed.py
src/SketchPlugin/Test/TestHighload.py
src/SketchPlugin/Test/TestMirror.py
src/SketchPlugin/Test/TestSnowflake.py
src/XAO/tests/BrepGeometryTest.cxx
src/XAO/tests/GeometryTest.cxx
src/XAO/tests/ImportExportTest.cxx
src/XAO/tests/TestUtils.hxx
src/XGUI/XGUI_Selection.cpp
test.API/SHAPER/GDML/TestAPI_ConeSegment.py
test.API/SHAPER/Primitives/TestAPI_Box.py
test.API/SHAPER/Primitives/TestAPI_Cylinder.py
test.API/SHAPER/Transformations/TestAPI_MultiTranslation.py
test.API/SHAPER/Transformations/TestAPI_Rotation.py
test.API/SHAPER/Transformations/TestAPI_Scale.py
test.API/SHAPER/Transformations/TestAPI_Symmetry.py
test.API/SHAPER/Transformations/TestAPI_Translation.py
test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py
test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py
utils.py

index e48b6c206a10b729b18c512bde81b071b6368f0a..c38d221274fbf3cf67fde6bd363b028db74c84a0 100644 (file)
@@ -5,15 +5,15 @@ UNSET(PYTHON_LIBRARIES)
 
 IF(WIN32)
     IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
-      SET(PYTHON_LIBRARY_FILE "python27_d.lib")
+      SET(PYTHON_LIBRARY_FILE "python36_d.lib")
     ElSE()
-      SET(PYTHON_LIBRARY_FILE "python27.lib")
+      SET(PYTHON_LIBRARY_FILE "python36.lib")
     ENDIF()
 ElSE()
-    SET(PYTHON_LIBRARY_FILE "libpython2.7.so")
+    SET(PYTHON_LIBRARY_FILE "libpython3.6.so")
 ENDIF()
 
-IF($ENV{PYTHONHOME})
+IF(DEFINED ENV{PYTHONHOME})
   IF(WIN32)
     FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/libs/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
   ElSE()
@@ -22,12 +22,12 @@ IF($ENV{PYTHONHOME})
   SET(PYTHON_LIBRARY ${PATH_PYTHON_LIBRARY} CACHE FILEPATH "path to the python library" FORCE)
 ENDIF()
 
-IF($ENV{PYTHON_INCLUDE})
+IF(DEFINED ENV{PYTHON_INCLUDE})
   FILE(TO_CMAKE_PATH $ENV{PYTHON_INCLUDE} PATH_PYTHON_INCLUDE_DIR)
   SET(PYTHON_INCLUDE_DIR ${PATH_PYTHON_INCLUDE_DIR} CACHE PATH "path to where Python.h is found" FORCE)
 ENDIF()
 
-FIND_PACKAGE(PythonLibs REQUIRED)
 FIND_PACKAGE(PythonInterp REQUIRED)
+FIND_PACKAGE(PythonLibs REQUIRED)
 
-INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})
\ No newline at end of file
index ec3b240fc9f778a639b5286a65444740fd0e7a3d..477303a4779b06f097143c9a6b7a08ecc3959b55 100644 (file)
@@ -40,14 +40,14 @@ from utils import *
 ### whitespace/semicolon ###
 
 def extra_space_before_last_semicolon(ligne, previous_ligne = None, warning=None):
-       liste=ligne.split(u';\n')
+       liste=ligne.split(';\n')
        ligne2=liste[0]
        ligne3=ligne2.rstrip()
-       ligne=ligne3 + u';\n' 
+       ligne=ligne3 + ';\n'
        return ligne, previous_ligne, False
 
 def missing_space_after_semicolon(ligne, previous_ligne = None, warning=None):
-       ligne=ligne.replace(u';',u'; ')
+       ligne=ligne.replace(';','; ')
        return ligne, previous_ligne, False
        
 #########################
@@ -55,86 +55,86 @@ def missing_space_after_semicolon(ligne, previous_ligne = None, warning=None):
 ### whitespace/operators ###
 
 def missing_space_around_operator_egal(ligne, previous_ligne = None, warning=None):
-       i=ligne.find(u'=')
+       i=ligne.find('=')
        nextchar=ligne[i+1]
        previouschar=ligne[i-1]
        if nextchar not in OPERATORS and previouschar not in OPERATORS:
                if nextchar.isspace() == False and previouschar.isspace()==True:
-                       ligne=ligne.replace(u'=', u'= ')
+                       ligne=ligne.replace('=', '= ')
                elif nextchar.isspace() == True and previouschar.isspace()==False:
-                       ligne=ligne.replace(u'=', u' =')
+                       ligne=ligne.replace('=', ' =')
                elif nextchar.isspace() == False and previouschar.isspace()==False:
-                       ligne=ligne.replace(u'=', u' = ')
+                       ligne=ligne.replace('=', ' = ')
                else:
                        pass
        return ligne, previous_ligne, False     
 
 def extra_space_for_operator_add(ligne, previous_ligne = None, warning=None):                  
-       while ligne.find(u'++ ') > -1:
-               ligne = ligne.replace(u'++ ',u'++')
-       while ligne.find(u' ++') > -1 and ligne.find(u'; ++') == -1:
-               ligne = ligne.replace(u' ++',u'++')
+       while ligne.find('++ ') > -1:
+               ligne = ligne.replace('++ ','++')
+       while ligne.find(' ++') > -1 and ligne.find('; ++') == -1:
+               ligne = ligne.replace(' ++','++')
        return ligne, previous_ligne, False
        
 def extra_space_for_operator_diff(ligne, previous_ligne = None, warning=None):                 
-       while ligne.find(u'! ') > -1:
-               ligne = ligne.replace(u'! ',u'!')
+       while ligne.find('! ') > -1:
+               ligne = ligne.replace('! ','!')
        return ligne, previous_ligne, False
 
 def missing_space_around_operator_double_chevron(ligne, previous_ligne = None, warning=None):
-       i=ligne.find(u'<<')
+       i=ligne.find('<<')
        nextchar=ligne[i+1]
        previouschar=ligne[i-1]
        if nextchar.isspace() == False and previouschar.isspace()==True:
-               ligne=ligne.replace(u'<<', u'<< ')
+               ligne=ligne.replace('<<', '<< ')
        elif nextchar.isspace() == True and previouschar.isspace()==False:
-               ligne=ligne.replace(u'<<', u' <<')
+               ligne=ligne.replace('<<', ' <<')
        elif nextchar.isspace() == False and previouschar.isspace()==False:
-               ligne=ligne.replace(u'<<', u' << ')
+               ligne=ligne.replace('<<', ' << ')
        else:
                pass
        return ligne, previous_ligne, False
        
 def missing_space_around_operator_simple_chevron(ligne, previous_ligne = None, warning=None):
-       i=ligne.find(u'<')
+       i=ligne.find('<')
        nextchar=ligne[i+1]
        previouschar=ligne[i-1]
        if nextchar not in OPERATORS and previouschar not in OPERATORS: 
                if nextchar.isspace() == False and previouschar.isspace()==True:
-                       ligne=ligne.replace(u'<', u'< ')
+                       ligne=ligne.replace('<', '< ')
                elif nextchar.isspace() == True and previouschar.isspace()==False:
-                       ligne=ligne.replace(u'<', u' <')
+                       ligne=ligne.replace('<', ' <')
                elif nextchar.isspace() == False and previouschar.isspace()==False:
-                       ligne=ligne.replace(u'<', u' < ')
+                       ligne=ligne.replace('<', ' < ')
                else:
                        pass
        return ligne, previous_ligne, False
        
 
 def missing_space_around_operator_diff_egal(ligne, previous_ligne = None, warning=None):
-       i=ligne.find(u'!=')
+       i=ligne.find('!=')
        nextchar=ligne[i+1]
        previouschar=ligne[i-1]
        if nextchar.isspace() == False and previouschar.isspace()==True:
-               ligne=ligne.replace(u'!=', u'!= ')
+               ligne=ligne.replace('!=', '!= ')
        elif nextchar.isspace() == True and previouschar.isspace()==False:
-               ligne=ligne.replace(u'!=', u' !=')
+               ligne=ligne.replace('!=', ' !=')
        elif nextchar.isspace() == False and previouschar.isspace()==False:
-               ligne=ligne.replace(u'!=', u' != ')
+               ligne=ligne.replace('!=', ' != ')
        else:
                pass
        return ligne, previous_ligne, False
        
 def missing_space_around_operator_double_egal(ligne, previous_ligne = None, warning=None):
-       i=ligne.find(u'==')
+       i=ligne.find('==')
        nextchar=ligne[i+1]
        previouschar=ligne[i-1]
        if nextchar.isspace() == False and previouschar.isspace()==True:
-               ligne=ligne.replace(u'==', u'== ')
+               ligne=ligne.replace('==', '== ')
        elif nextchar.isspace() == True and previouschar.isspace()==False:
-               ligne=ligne.replace(u'==', u' ==')
+               ligne=ligne.replace('==', ' ==')
        elif nextchar.isspace() == False and previouschar.isspace()==False:
-               ligne=ligne.replace(u'==', u' == ')
+               ligne=ligne.replace('==', ' == ')
        else:
                pass
        return ligne, previous_ligne, False
@@ -145,16 +145,16 @@ def missing_space_around_operator_double_egal(ligne, previous_ligne = None, warn
 ### whitespace/comments ###
 
 def space_between_comments_and_code(ligne, previous_ligne = None, warning=None):
-       if ligne.find(u'//')>=0 :                       
-               ligne=ligne.replace(u'//', u'  //')
-       elif ligne.find(u' //')>=0 :                    
-               ligne=ligne.replace(u' //', u'  //')
+       if ligne.find('//')>=0 :
+               ligne=ligne.replace('//', '  //')
+       elif ligne.find(' //')>=0 :
+               ligne=ligne.replace(' //', '  //')
        else:
            pass        
        return ligne, previous_ligne, False
 
 def space_between_comments_and_double_slash(ligne, previous_ligne = None, warning=None):                       
-       return ligne.replace(u'//', u'// '), previous_ligne, False
+       return ligne.replace('//', '// '), previous_ligne, False
        
 #########################
 
@@ -175,11 +175,11 @@ def ifndef_header(ficpath, ficline, warning):
 #      replace_fic_ifndef(ficpath, ficline, warning, "no_guard_found")
                
 def endif_line(ligne, previous_ligne = None, warning=None):
-       liste1=warning.split(u'// ')
+       liste1=warning.split('// ')
        ligne1=liste1[1]
-       liste2=ligne1.split(u'"')
+       liste2=ligne1.split('"')
        header_guard=liste2[0]
-       ligne= u'#endif  // ' + header_guard +u'\n'             
+       ligne= '#endif  // ' + header_guard +'\n'
        return ligne, previous_ligne, False
 
 #########################
@@ -196,7 +196,7 @@ def whitespace_end_of_line(ligne, previous_ligne = None, warning=None):
 ### whitespace/comma ###
 
 def missing_space_after_comma(ligne, previous_ligne = None, warning=None):
-       ligne=ligne.replace(u',',u', ')
+       ligne=ligne.replace(',',', ')
        return ligne, previous_ligne, False
 
 #########################
@@ -204,18 +204,18 @@ def missing_space_after_comma(ligne, previous_ligne = None, warning=None):
 ### readability/namespace ###
 
 def namespace_should_be_terminated(ligne, previous_ligne = None, warning=None):
-       ligne2=ligne.rstrip(u'\n')
-       liste = warning.split(u'"')
+       ligne2=ligne.rstrip('\n')
+       liste = warning.split('"')
        namespace=liste[1]
-       if ligne.find(u'\r')>=0:
-               ligne=ligne2+u'  '+namespace+u'\r\n'
+       if ligne.find('\r')>=0:
+               ligne=ligne2+'  '+namespace+'\r\n'
        else:
-               ligne=ligne2+u'  '+namespace+u'\n'
+               ligne=ligne2+'  '+namespace+'\n'
        return ligne, previous_ligne, False
 
 def anonymous_namespace_should_be_terminated(ligne, previous_ligne = None, warning=None):
-       ligne2=ligne.rstrip(u'\n')
-       ligne=ligne2+u'  // namespace\n'
+       ligne2=ligne.rstrip('\n')
+       ligne=ligne2+'  // namespace\n'
        return ligne, previous_ligne, False
        
 #########################
@@ -223,37 +223,37 @@ def anonymous_namespace_should_be_terminated(ligne, previous_ligne = None, warni
 ### whitespace/parens ###
 
 def extra_space_after_opening_paranthesis(ligne, previous_ligne = None, warning=None):
-       while ligne.find(u'( ') > -1:
-               ligne = ligne.replace(u'( ',u'(')
+       while ligne.find('( ') > -1:
+               ligne = ligne.replace('( ','(')
        return ligne, previous_ligne, False
 
 def extra_space_before_closing_paranthesis(ligne, previous_ligne = None, warning=None):
-       while ligne.find(u' )') > -1:
-               ligne = ligne.replace(u' )',u')')
+       while ligne.find(' )') > -1:
+               ligne = ligne.replace(' )',')')
        return ligne, previous_ligne, False
        
 def extra_space_before_opening_paranthesis_in_function_call(ligne, previous_ligne = None, warning=None):
-       while ligne.find(u' (') > -1 and ligne.find(u', (')==-1:
-               ligne = ligne.replace(u' (',u'(')
+       while ligne.find(' (') > -1 and ligne.find(', (')==-1:
+               ligne = ligne.replace(' (','(')
        return ligne, previous_ligne, False
 
 def missing_space_before_opening_parenthesis_in_for(ligne, previous_ligne = None, warning=None):
-       return ligne.replace(u'for(',u'for ('), previous_ligne, False
+       return ligne.replace('for(','for ('), previous_ligne, False
 
 def missing_space_before_opening_parenthesis_in_if(ligne, previous_ligne = None, warning=None):
-       return ligne.replace(u'if(',u'if ('), previous_ligne, False
+       return ligne.replace('if(','if ('), previous_ligne, False
 
 def missing_space_before_opening_parenthesis_in_switch(ligne, previous_ligne = None, warning=None):
-       return ligne.replace(u'switch(',u'switch ('), previous_ligne, False
+       return ligne.replace('switch(','switch ('), previous_ligne, False
 
 def missing_space_before_opening_parenthesis_in_while(ligne, previous_ligne = None, warning=None):
-       return ligne.replace(u'while(',u'while ('), previous_ligne, False
+       return ligne.replace('while(','while ('), previous_ligne, False
 
 def mismatching_spaces_inside_paranthesis(ligne, previous_ligne = None, warning=None):
-       while ligne.find(u'( ') > -1:
-               ligne = ligne.replace(u'( ',u'(')
-       while ligne.find(u' )') > -1:
-               ligne = ligne.replace(u' )',u')')
+       while ligne.find('( ') > -1:
+               ligne = ligne.replace('( ','(')
+       while ligne.find(' )') > -1:
+               ligne = ligne.replace(' )',')')
        return ligne, previous_ligne, False
        
 #########################
@@ -322,7 +322,7 @@ def use_spaces_instead_of_tab(ligne, previous_ligne = None, warning=None):
 ### readability/braces ###
 
 def no_semicolon_after_brace(ligne, previous_ligne = None, warning=None):
-       return ligne.replace(u'};',u'}'), previous_ligne, False
+       return ligne.replace('};','}'), previous_ligne, False
 
 def position_of_else(ligne, previous_ligne=None, warning=None):
        '''Remonte une ligne du type } else {'''
@@ -347,21 +347,21 @@ def position_of_opening_brace(ligne, previous_ligne=None, warning=None):
        m = re.match("(\s*){(.*)", ligne)
        
        # On ne fait rien si on trouve un commentaire sur la ligne précédente (ce sera une correction manuelle)
-       if previous_ligne.find(u'//') == -1:
+       if previous_ligne.find('//') == -1:
                previous_ligne = previous_ligne.rstrip("\n") + ' {' + m.group(2) + '\n'
                ligne = ''
        else:
-               print "The previous line contains a comment, fixing has to be manual."
+               print("The previous line contains a comment, fixing has to be manual.")
 
        return ligne, previous_ligne, False
 
 def missing_space_before_opening_brace(ligne, previous_ligne = None, warning=None):
        m = re.match("(.+)(\S){(.*)", ligne)
        if(m):
-               print 'group_0', m.group(0)
-               print 'group_1', m.group(1)
-               print 'group_2', m.group(2)
-               print 'group_3', m.group(3)
+               print('group_0', m.group(0))
+               print('group_1', m.group(1))
+               print('group_2', m.group(2))
+               print('group_3', m.group(3))
                ligne = m.group(1) + m.group(2) + ' {' + m.group(3) + '\n'
 
        return ligne, previous_ligne, False
@@ -373,10 +373,10 @@ def missing_space_before_opening_brace(ligne, previous_ligne = None, warning=Non
 def missing_space_before_else(ligne, previous_ligne = None, warning=None):
        m = re.match("(.+)(\S)else(.*)", ligne)
        if(m):
-               print 'group_0', m.group(0)
-               print 'group_1', m.group(1)
-               print 'group_2', m.group(2)
-               print 'group_3', m.group(3)
+               print('group_0', m.group(0))
+               print('group_1', m.group(1))
+               print('group_2', m.group(2))
+               print('group_3', m.group(3))
                ligne = m.group(1) + m.group(2) + ' else' + m.group(3) + '\n'
 
        return ligne, previous_ligne, False
@@ -385,15 +385,15 @@ def missing_space_before_else(ligne, previous_ligne = None, warning=None):
 
 def make_const_reference(ficpath, ligne, previous_ligne = None, warning=None):
        """ Adding keyword 'const' """
-       print "ficpath = ", ficpath
-       print "ligne = ", ligne
-       print "warning = ", warning
+       print("ficpath = ", ficpath)
+       print("ligne = ", ligne)
+       print("warning = ", warning)
        m = re.match("(.+)Is this a non-const reference\? If so, make const or use a pointer: (.+)  (.+)", warning)
        if(m):
-               print 'group_0', m.group(0)
-               print 'group_1', m.group(1)
-               print 'group_2', m.group(2)
-               print 'group_3', m.group(3)
+               print('group_0', m.group(0))
+               print('group_1', m.group(1))
+               print('group_2', m.group(2))
+               print('group_3', m.group(3))
                arg_to_modify = m.group(2)
                ligne = ligne.replace(arg_to_modify, "const "+arg_to_modify)
                
@@ -404,13 +404,13 @@ def make_const_reference(ficpath, ligne, previous_ligne = None, warning=None):
                        global H_FILE_MAKE_CONST_REFERENCE_MODIFIED
                        H_FILE_MAKE_CONST_REFERENCE_MODIFIED = True
        else:
-               print "ERROR : The following pattern was not found : 'Is this a non-const reference? If so, make const or use a pointer:'"
+               print("ERROR : The following pattern was not found : 'Is this a non-const reference? If so, make const or use a pointer:'")
 
        return ligne, previous_ligne, False
 
 def make_const_reference_cpp_file(ficpath, arg_to_modify):
        if not os.path.isfile(ficpath):
-               print "WARNING : The file ", ficpath, " doesn't exist, manual fixing is required in methods of the file ", ficpath.replace('.cpp', '.h'), " in which arguments have been declared 'const'"
+               print("WARNING : The file ", ficpath, " doesn't exist, manual fixing is required in methods of the file ", ficpath.replace('.cpp', '.h'), " in which arguments have been declared 'const'")
                return
 
        fic = open(get_src_path(ficpath),'r')
@@ -436,12 +436,12 @@ def make_const_reference_cpp_file(ficpath, arg_to_modify):
 ### runtime/int ###
 
 def replace_short_by_int16(ligne, previous_ligne = None, warning=None):
-       ligne = ligne.replace(u'short', u'int16_t')
+       ligne = ligne.replace('short', 'int16_t')
 
        return ligne, None, False
 
 def replace_long_by_int64(ligne, previous_ligne = None, warning=None):
-       ligne = ligne.replace(u'long', u'int64_t')
+       ligne = ligne.replace('long', 'int64_t')
 
        return ligne, None, False
 
@@ -452,10 +452,10 @@ def replace_long_by_int64(ligne, previous_ligne = None, warning=None):
 def make_constructor_explicit(ligne, previous_ligne = None, warning=None):
        m = re.match("(\s*)(.+)", ligne)
        if(m):
-               print 'group_0', m.group(0)
-               print 'group_1', m.group(1)
-               print 'group_2', m.group(2)
-               ligne = ligne.replace(m.group(2), u'explicit '+m.group(2))
+               print('group_0', m.group(0))
+               print('group_1', m.group(1))
+               print('group_2', m.group(2))
+               ligne = ligne.replace(m.group(2), 'explicit '+m.group(2))
 
        return ligne, None, False
 
@@ -470,9 +470,9 @@ def cpp_file_should_include_h_file(ficpath, ficline, warning):
 
        m = re.match("(.+) should include its header file (.+)  (.+)", warning)
        if(m):
-               print 'group_0', m.group(0)
-               print 'group_1', m.group(1)
-               print 'group_2', m.group(2)
+               print('group_0', m.group(0))
+               print('group_1', m.group(1))
+               print('group_2', m.group(2))
                # Nouveau chemin du fichier .h
                new_h_file_path = m.group(2)
 
@@ -483,13 +483,13 @@ def cpp_file_should_include_h_file(ficpath, ficline, warning):
                for ligne in liste:
                        m2 = re.match("#include.*"+h_file_name+".*", ligne)
                        if(m2):
-                               print "FOUND : ", ligne
+                               print("FOUND : ", ligne)
                                new_liste.append("#include \""+new_h_file_path+"\"\n")
                        else:
-                               print "NOT FOUND : ", ligne
+                               print("NOT FOUND : ", ligne)
                                new_liste.append(ligne)
        else:
-               print "ERROR : Pattern not found : \"should include its header file\""
+               print("ERROR : Pattern not found : \"should include its header file\"")
 
        newliste=fic_writelines(new_liste)
        fichier = open(get_src_path(ficpath), "w")
@@ -515,7 +515,7 @@ def do_not_leave_blank_line_after_public_protected_private(ficpath, ficline, war
                        flag = True
                if flag and ligne.isspace():
                        # Supprimer les lignes vides après public:, protected: et :private
-                       print "Deleting empty line"
+                       print("Deleting empty line")
                        new_liste.append("")
                        continue
                if not ligne.isspace() and not re.match(".*public.*:|.*protected.*:|.*private.*:", ligne):
@@ -538,7 +538,7 @@ def do_not_leave_blank_line_at_the_start_of_code_block(ficpath, ficline, warning
                        flag = True
                if flag and ligne.isspace():
                        # Supprimer les lignes vides après un début de bloc
-                       print "Deleting empty line"
+                       print("Deleting empty line")
                        new_liste.append("")
                        continue
                if not ligne.isspace() and not re.match(".*{", ligne):
@@ -599,8 +599,8 @@ def add_include_what_you_use(ficpath, ficline, warning):
        
        m = re.match("\s*Add (.+) for (.+)", warning)
        if(m):
-               print 'group_0', m.group(0)
-               print 'group_1', m.group(1)
+               print('group_0', m.group(0))
+               print('group_1', m.group(1))
                include = m.group(1)
 
                # Recherche la ligne dans laquelle ajouter le #include
@@ -617,7 +617,7 @@ def add_include_what_you_use(ficpath, ficline, warning):
                
                num_ligne_include = max(num_ligne_include_system, num_ligne_include_local)
                if num_ligne_include == 0:
-                       print "WARNING : #include not found in file ", ficpath
+                       print("WARNING : #include not found in file ", ficpath)
                        return
 
                new_liste = []
@@ -634,75 +634,75 @@ def add_include_what_you_use(ficpath, ficline, warning):
                fichier = open(get_src_path(ficpath), "w")
                fichier.writelines(newliste)
        else:
-               print "ERROR : Pattern of include_what_you_use not found"
+               print("ERROR : Pattern of include_what_you_use not found")
                return
 
 ##################################
 
 
 HOOKS_DICT = {
-        extra_space_before_last_semicolon:{'pattern':u'whitespace/semicolon', 'pattern_AND':u'Extra space before last semicolon'},
-        missing_space_after_semicolon:{'pattern':u'whitespace/semicolon', 'pattern_AND':u'Missing space after'},
-        missing_space_around_operator_egal:{'pattern':u'whitespace/operators', 'pattern_AND':u'Missing spaces around = '},
-        extra_space_for_operator_add:{'pattern':u'whitespace/operators', 'pattern_AND':u'Extra space for operator  ++'},
-        extra_space_for_operator_diff:{'pattern':u'whitespace/operators', 'pattern_AND':u'Extra space for operator !'},
-        missing_space_around_operator_double_chevron:{'pattern':u'whitespace/operators', 'pattern_AND':u'Missing spaces around << '},
-        missing_space_around_operator_simple_chevron:{'pattern':u'whitespace/operators', 'pattern_AND':u'Missing spaces around < '},
-        missing_space_around_operator_diff_egal:{'pattern':u'whitespace/operators', 'pattern_AND':u'Missing spaces around !='},
-        missing_space_around_operator_double_egal:{'pattern':u'whitespace/operators', 'pattern_AND':u'Missing spaces around =='},
-        space_between_comments_and_code:{'pattern':u'whitespace/comments', 'pattern_AND':u'At least two spaces is best between code and comments'},
-        space_between_comments_and_double_slash:{'pattern':u'whitespace/comments', 'pattern_AND':u'Should have a space between // and comment '},
-        legal_copyright:{'pattern':u'legal/copyright'}, # Script à n'executer qu'une fois
-        ifndef_header:{'pattern':u'build/header_guard', 'pattern_AND':u'#ifndef header guard has wrong style, please use'}, 
+        extra_space_before_last_semicolon:{'pattern':'whitespace/semicolon', 'pattern_AND':'Extra space before last semicolon'},
+        missing_space_after_semicolon:{'pattern':'whitespace/semicolon', 'pattern_AND':'Missing space after'},
+        missing_space_around_operator_egal:{'pattern':'whitespace/operators', 'pattern_AND':'Missing spaces around = '},
+        extra_space_for_operator_add:{'pattern':'whitespace/operators', 'pattern_AND':'Extra space for operator  ++'},
+        extra_space_for_operator_diff:{'pattern':'whitespace/operators', 'pattern_AND':'Extra space for operator !'},
+        missing_space_around_operator_double_chevron:{'pattern':'whitespace/operators', 'pattern_AND':'Missing spaces around << '},
+        missing_space_around_operator_simple_chevron:{'pattern':'whitespace/operators', 'pattern_AND':'Missing spaces around < '},
+        missing_space_around_operator_diff_egal:{'pattern':'whitespace/operators', 'pattern_AND':'Missing spaces around !='},
+        missing_space_around_operator_double_egal:{'pattern':'whitespace/operators', 'pattern_AND':'Missing spaces around =='},
+        space_between_comments_and_code:{'pattern':'whitespace/comments', 'pattern_AND':'At least two spaces is best between code and comments'},
+        space_between_comments_and_double_slash:{'pattern':'whitespace/comments', 'pattern_AND':'Should have a space between // and comment '},
+        legal_copyright:{'pattern':'legal/copyright'}, # Script à n'executer qu'une fois
+        ifndef_header:{'pattern':'build/header_guard', 'pattern_AND':'#ifndef header guard has wrong style, please use'},
 #        no_ifndef_header:{'pattern':u'build/header_guard', 'pattern_AND':u'No #ifndef header guard found'}, 
-        endif_line:{'pattern':u'build/header_guard', 'pattern_AND':u'#endif line should be'},
-        whitespace_end_of_line:{'pattern':u'whitespace/end_of_line', 'pattern_AND':u'Line ends in whitespace'},
-        missing_space_after_comma:{'pattern':u'whitespace/comma'},
-        namespace_should_be_terminated:{'pattern':u'readability/namespace', 'pattern_AND':u'Namespace should be terminated with'},
-        anonymous_namespace_should_be_terminated:{'pattern':u'readability/namespace', 'pattern_AND':u'Anonymous namespace should be terminated with'},
-               extra_space_after_opening_paranthesis:{'pattern':u'whitespace/parens', 'pattern_AND':u'Extra space after ('},
-               extra_space_before_closing_paranthesis:{'pattern':u'whitespace/parens', 'pattern_AND':u'Extra space before )'},
-               extra_space_before_opening_paranthesis_in_function_call:{'pattern':u'whitespace/parens', 'pattern':u'Extra space before ( in function call'},
-               missing_space_before_opening_parenthesis_in_for:{'pattern':u'whitespace/parens', 'pattern_AND':u'Missing space before ( in for('},
-               missing_space_before_opening_parenthesis_in_if:{'pattern':u'whitespace/parens', 'pattern_AND':u'Missing space before ( in if('},
-               missing_space_before_opening_parenthesis_in_switch:{'pattern':u'whitespace/parens', 'pattern_AND':u'Missing space before ( in switch('},
-               missing_space_before_opening_parenthesis_in_while:{'pattern':u'whitespace/parens', 'pattern_AND':u'Missing space before ( in while('},
-               mismatching_spaces_inside_paranthesis:{'pattern':u'whitespace/parens', 'pattern_AND':u'Mismatching spaces inside ()'},
-               missing_space_before_public_protected_private:{'pattern':u'whitespace/indent', 'pattern_AND':u' should be indented +1 space inside class'},
+        endif_line:{'pattern':'build/header_guard', 'pattern_AND':'#endif line should be'},
+        whitespace_end_of_line:{'pattern':'whitespace/end_of_line', 'pattern_AND':'Line ends in whitespace'},
+        missing_space_after_comma:{'pattern':'whitespace/comma'},
+        namespace_should_be_terminated:{'pattern':'readability/namespace', 'pattern_AND':'Namespace should be terminated with'},
+        anonymous_namespace_should_be_terminated:{'pattern':'readability/namespace', 'pattern_AND':'Anonymous namespace should be terminated with'},
+               extra_space_after_opening_paranthesis:{'pattern':'whitespace/parens', 'pattern_AND':'Extra space after ('},
+               extra_space_before_closing_paranthesis:{'pattern':'whitespace/parens', 'pattern_AND':'Extra space before )'},
+               extra_space_before_opening_paranthesis_in_function_call:{'pattern':'whitespace/parens', 'pattern':'Extra space before ( in function call'},
+               missing_space_before_opening_parenthesis_in_for:{'pattern':'whitespace/parens', 'pattern_AND':'Missing space before ( in for('},
+               missing_space_before_opening_parenthesis_in_if:{'pattern':'whitespace/parens', 'pattern_AND':'Missing space before ( in if('},
+               missing_space_before_opening_parenthesis_in_switch:{'pattern':'whitespace/parens', 'pattern_AND':'Missing space before ( in switch('},
+               missing_space_before_opening_parenthesis_in_while:{'pattern':'whitespace/parens', 'pattern_AND':'Missing space before ( in while('},
+               mismatching_spaces_inside_paranthesis:{'pattern':'whitespace/parens', 'pattern_AND':'Mismatching spaces inside ()'},
+               missing_space_before_public_protected_private:{'pattern':'whitespace/indent', 'pattern_AND':' should be indented +1 space inside class'},
                
-               wrong_number_of_spaces_while_indenting:{'pattern':u'whitespace/indent', 'pattern_AND':u'Weird number of spaces at line-start'},
+               wrong_number_of_spaces_while_indenting:{'pattern':'whitespace/indent', 'pattern_AND':'Weird number of spaces at line-start'},
 
-               no_newline_at_the_end_of_file:{'pattern':u'whitespace/ending_newline'},
+               no_newline_at_the_end_of_file:{'pattern':'whitespace/ending_newline'},
 
-               order_of_storage_class_specifier:{'pattern':u'build/storage_class'},
+               order_of_storage_class_specifier:{'pattern':'build/storage_class'},
 
-               use_spaces_instead_of_tab:{'pattern':u'whitespace/tab'},
+               use_spaces_instead_of_tab:{'pattern':'whitespace/tab'},
 
-               no_semicolon_after_brace:{'pattern':u'readability/braces', 'pattern_AND':u'You don\'t need a ; after a }'},
+               no_semicolon_after_brace:{'pattern':'readability/braces', 'pattern_AND':'You don\'t need a ; after a }'},
 #              position_of_else:{'pattern':u'readability/braces', 'pattern_AND':u'If an else has a brace on one side'},
 #              else_should_be_previous_line:{'pattern':u'whitespace/newline', 'pattern_AND':u'An else should appear on the same line as the preceding'},
-               position_of_opening_brace:{'pattern':u'whitespace/braces', 'pattern_AND':u'{ should almost always be at the end of the previous line'},
-               missing_space_before_opening_brace:{'pattern':u'whitespace/braces', 'pattern_AND':u'Missing space before {'},
-               missing_space_before_else:{'pattern':u'whitespace/braces', 'pattern_AND':u'Missing space before else'},
+               position_of_opening_brace:{'pattern':'whitespace/braces', 'pattern_AND':'{ should almost always be at the end of the previous line'},
+               missing_space_before_opening_brace:{'pattern':'whitespace/braces', 'pattern_AND':'Missing space before {'},
+               missing_space_before_else:{'pattern':'whitespace/braces', 'pattern_AND':'Missing space before else'},
                
-               make_const_reference:{'pattern':u'runtime/references', 'pattern_AND':u'Is this a non-const reference? If so, make const or use a pointer'},
+               make_const_reference:{'pattern':'runtime/references', 'pattern_AND':'Is this a non-const reference? If so, make const or use a pointer'},
 
-               make_constructor_explicit:{'pattern':u'runtime/explicit'},
+               make_constructor_explicit:{'pattern':'runtime/explicit'},
 
-               cpp_file_should_include_h_file:{'pattern':u'build/include', 'pattern_AND':u'should include its header file'},
-               _h_file_already_included:{'pattern':u'build/include', 'pattern_AND':u'already included at'},
+               cpp_file_should_include_h_file:{'pattern':'build/include', 'pattern_AND':'should include its header file'},
+               _h_file_already_included:{'pattern':'build/include', 'pattern_AND':'already included at'},
 
-               replace_short_by_int16:{'pattern':u'runtime/int', 'pattern_AND':u'Use int16/int64/etc, rather than the C type short'},
-               replace_long_by_int64:{'pattern':u'runtime/int', 'pattern_AND':u'Use int16/int64/etc, rather than the C type long'},
+               replace_short_by_int16:{'pattern':'runtime/int', 'pattern_AND':'Use int16/int64/etc, rather than the C type short'},
+               replace_long_by_int64:{'pattern':'runtime/int', 'pattern_AND':'Use int16/int64/etc, rather than the C type long'},
 
-               do_not_leave_blank_line_after_public_protected_private:{'pattern':u'whitespace/blank_line', 'pattern_AND':u'Do not leave a blank line after'},
-               do_not_leave_blank_line_at_the_start_of_code_block:{'pattern':u'whitespace/blank_line', 'pattern_AND':u'Redundant blank line at the start of a code block should be deleted'},
-               do_not_leave_blank_line_at_the_end_of_code_block:{'pattern':u'whitespace/blank_line', 'pattern_AND':u'Redundant blank line at the end of a code block should be deleted'},
-               add_blank_line_before_public:{'pattern':u'whitespace/blank_line', 'pattern_AND':u'"public:" should be preceded by a blank line'},
-               add_blank_line_before_protected:{'pattern':u'whitespace/blank_line', 'pattern_AND':u'"protected:" should be preceded by a blank line'},
-               add_blank_line_before_private:{'pattern':u'whitespace/blank_line', 'pattern_AND':u'"private:" should be preceded by a blank line'},
+               do_not_leave_blank_line_after_public_protected_private:{'pattern':'whitespace/blank_line', 'pattern_AND':'Do not leave a blank line after'},
+               do_not_leave_blank_line_at_the_start_of_code_block:{'pattern':'whitespace/blank_line', 'pattern_AND':'Redundant blank line at the start of a code block should be deleted'},
+               do_not_leave_blank_line_at_the_end_of_code_block:{'pattern':'whitespace/blank_line', 'pattern_AND':'Redundant blank line at the end of a code block should be deleted'},
+               add_blank_line_before_public:{'pattern':'whitespace/blank_line', 'pattern_AND':'"public:" should be preceded by a blank line'},
+               add_blank_line_before_protected:{'pattern':'whitespace/blank_line', 'pattern_AND':'"protected:" should be preceded by a blank line'},
+               add_blank_line_before_private:{'pattern':'whitespace/blank_line', 'pattern_AND':'"private:" should be preceded by a blank line'},
 
-               add_include_what_you_use:{'pattern':u'build/include_what_you_use'},
+               add_include_what_you_use:{'pattern':'build/include_what_you_use'},
 
 }
 
@@ -716,14 +716,14 @@ def replace_line_no(path, nol, oldline, newline):
        Remplace, la ligne No nol du fichier path (relatif à SRCROOTDIR) par la chaîne newline (un unicode)
        oldline sert uniquement pour vérifier que tout est ok
        """
-       print "replace_line_no : ", oldline, " by ", newline
+       print("replace_line_no : ", oldline, " by ", newline)
        # récupérer le contenu du fichier
        fic = open(get_src_path(path), "r")
        liste = fic.readlines()
        fic.close()
        # test de corruption
        if liste[nol-1].decode(ENCODING) != oldline :
-               raise Exception(u"Le fichier source %s semble être corrompu" %path)
+               raise Exception("Le fichier source %s semble être corrompu" %path)
        # remplacement de la ligne
        liste[nol-1] = newline.encode(ENCODING)
        # recréation du fichier corrigé
@@ -740,8 +740,8 @@ def replace_fic_copyright(ficpath, warning=None):
        liste=fic_readlines(fic)
        fic.close()
        new_liste = []
-       if liste[0].find(u'/ Copyright (C) 2014-20xx CEA/DEN, EDF R&D\n\n')== -1:                       
-               newliste=[u'// Copyright (C) 2014-20xx CEA/DEN, EDF R&D\n\n']+liste     
+       if liste[0].find('/ Copyright (C) 2014-20xx CEA/DEN, EDF R&D\n\n')== -1:
+               newliste=['// Copyright (C) 2014-20xx CEA/DEN, EDF R&D\n\n']+liste
                newliste=fic_writelines(newliste)
                fic = open(get_src_path(ficpath), "w")
                fic.writelines(newliste)
@@ -762,9 +762,9 @@ def replace_fic_ifndef(ficpath, ficline, warning, mode):
                m = re.match("(.*)ifndef header guard has wrong style, please use: (.+)  (.+)", warning)
 
         if(m):
-                print 'group_0', m.group(0)
-                print 'group_1', m.group(1)
-                print 'group_2', m.group(2)
+                print('group_0', m.group(0))
+                print('group_1', m.group(1))
+                print('group_2', m.group(2))
 
                 # Header à changer
                header_guard=m.group(2)
@@ -775,24 +775,24 @@ def replace_fic_ifndef(ficpath, ficline, warning, mode):
                 for ligne in liste:
                        i += 1
                        if i == ficline:
-                               if ligne.find(u'#ifndef') >= 0:
+                               if ligne.find('#ifndef') >= 0:
                                        new_liste.append("#ifndef "+header_guard+"\n")
                                        trouve = True
                                else:
-                                       print "ERROR : Pattern #ifndef not found in line ", ficline
+                                       print("ERROR : Pattern #ifndef not found in line ", ficline)
                                        return
                        else:
                                if trouve == True:
-                                       if ligne.find(u'#define') >= 0:
+                                       if ligne.find('#define') >= 0:
                                                new_liste.append("#define "+header_guard+"\n")
                                                trouve = False
                                        else:
-                                               print "WARNING : Pattern #define not found in the line following the pattern #ifndef, we abandon."
+                                               print("WARNING : Pattern #define not found in the line following the pattern #ifndef, we abandon.")
                                                return
                                else:
                                        new_liste.append(ligne)
         else:
-                print "ERROR : Pattern not found : \"#ifndef header guard has wrong style, please use\""
+                print("ERROR : Pattern not found : \"#ifndef header guard has wrong style, please use\"")
 
         newliste=fic_writelines(new_liste)
         fichier = open(get_src_path(ficpath), "w")
@@ -848,33 +848,33 @@ def main_routine(cpplint_output_file):
                        previous_oldline = get_line_no(ficpath, ficline-1)
                else:
                        previous_oldline = None
-               print "===\nNew warning:"
-               print "\tFile = "+ficpath
-               print "\tlast_ficpath_with_modified_nb_lines = "+last_ficpath_with_modified_nb_lines
-               print "\tNo ligne =" , ficline
+               print("===\nNew warning:")
+               print("\tFile = "+ficpath)
+               print("\tlast_ficpath_with_modified_nb_lines = "+last_ficpath_with_modified_nb_lines)
+               print("\tNo ligne =" , ficline)
                if VERBOSE_FLAG == "True":
-                       print "\tWarning ='"+warning+"'"
-                       print "\tOld text of current line = '"+oldline+"'"
+                       print("\tWarning ='"+warning+"'")
+                       print("\tOld text of current line = '"+oldline+"'")
                        if previous_oldline:
-                               print "\tOld text of previous line = '"+previous_oldline+"'"
+                               print("\tOld text of previous line = '"+previous_oldline+"'")
                        if ficpath == last_ficpath_with_modified_nb_lines:
-                               print "File ", ficpath, "already modified. Waiting next cpplint run to process it."
+                               print("File ", ficpath, "already modified. Waiting next cpplint run to process it.")
                                continue
                hook = get_hook(warning, ficpath)
-               print "hook = ", hook
+               print("hook = ", hook)
                if hook is None:
-                       print u"No hook found"
+                       print("No hook found")
                        continue
 
                if VERBOSE_FLAG == "True":
-                       print "\t=> Processing with hook", hook
+                       print("\t=> Processing with hook", hook)
 
                if hook in HOOKS_DELETING_OR_ADDING_LINES:
                        last_ficpath_with_modified_nb_lines = ficpath
                        
                if hook in HOOKS_PARSING_THE_WHOLE_FILE:
                        hook(ficpath, ficline, warning)
-                       print "Done"
+                       print("Done")
                        continue
                                
                # Cas particulier pour le hook make_const_reference : il faut faire un traitement sur le fichier .cpp associé au fichier .h concerné par le hook
@@ -890,31 +890,31 @@ def main_routine(cpplint_output_file):
                        newline, previous_newline, huchk = hook(oldline, previous_oldline, warning)
 
                if VERBOSE_FLAG == "True":
-                       print "\tNew text = '"+newline+"'"
+                       print("\tNew text = '"+newline+"'")
                if huchk:
                        if previous_newline:
-                               print "Replace line : \n'%s'\n with line \n'%s'\n O/N ? :"%(previous_oldline, previous_newline)
-                               reponse = raw_input()
+                               print("Replace line : \n'%s'\n with line \n'%s'\n O/N ? :"%(previous_oldline, previous_newline))
+                               reponse = input()
                                if reponse in ['O', 'o']:
                                        replace_line_no(ficpath, ficline-1, previous_oldline, previous_newline) 
-                                       print "Replacement done."               
+                                       print("Replacement done.")
                                else :
-                                       print "Replacement aborted."
+                                       print("Replacement aborted.")
 
-                               print "Replace line : \n'%s'\n with line \n'%s'\n O/N ? :"%(oldline, newline)
-                               reponse = raw_input()
+                               print("Replace line : \n'%s'\n with line \n'%s'\n O/N ? :"%(oldline, newline))
+                               reponse = input()
                                if reponse in ['O', 'o']:
                                        replace_line_no(ficpath, ficline, oldline, newline)     
-                               print "Replacement done."               
+                               print("Replacement done.")
                        else :
-                               print "Replacement aborted."
+                               print("Replacement aborted.")
 
 
                else :
                        if previous_newline:
                                replace_line_no(ficpath, ficline-1, previous_oldline, previous_newline)
                        replace_line_no(ficpath, ficline, oldline, newline)
-               print "Done"
+               print("Done")
        logfile.close()
                
 if __name__ == '__main__':
index 07ebf9f06cdc99b11be4e87513c5e6e2c4050669..ca879e5a8c44bf4462220637dc1b839fa484b45f 100755 (executable)
@@ -35,4 +35,4 @@ for list_item in process_ids:
     if process in name_list:
       pid = _pid
 
-print pid
+print(pid)
index 0cc22fed3b4d1941596576c20e8d785cc1882f92..4f1c32c708ea3247398e2dc594a0a1354532432d 100644 (file)
@@ -96,7 +96,11 @@ SET(SWIG_MODULE_BuildAPI_EXTRA_DEPS ${SWIG_MODULE_BuildAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(BuildAPI python BuildAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(BuildAPI LANGUAGE python SOURCES BuildAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(BuildAPI python BuildAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(BuildAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 935c38bfbbfaba45198f0dbf7a1d7bb0ce3a2d8a..62543034bc44965ca640f9bd44978aad7b136b83 100644 (file)
@@ -74,7 +74,11 @@ SET(SWIG_MODULE_CollectionAPI_EXTRA_DEPS ${SWIG_MODULE_CollectionAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(CollectionAPI python CollectionAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(CollectionAPI LANGUAGE python SOURCES CollectionAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(CollectionAPI python CollectionAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(CollectionAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 821bcd33cf94393e6372d3fe70609ac1d7dab21f..26d54394e2322dbb11935bb6144019b6ee05f086 100644 (file)
@@ -39,7 +39,7 @@
   #include "ModelHighAPI_swig.h"
 
   // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
+  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
 %}
 
 %include "doxyhelp.i"
index e120e21b8a9fb69a62d309835331b1408dc0f4aa..05bafb324a93a8baff93cdcc2706b9aa02ba3209 100644 (file)
@@ -76,7 +76,11 @@ SET(SWIG_LINK_LIBRARIES
   Config
   ${PYTHON_LIBRARIES}
 )
-SWIG_ADD_MODULE(ConfigAPI python ConfigAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ConfigAPI LANGUAGE python SOURCES ConfigAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ConfigAPI python ConfigAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ConfigAPI ${SWIG_LINK_LIBRARIES})
 IF(WIN32)
   SET_TARGET_PROPERTIES(_ConfigAPI PROPERTIES DEBUG_OUTPUT_NAME _ConfigAPI_d)
index 452fc4ca3a9291602ec9c71f7b4488de442c1332..4471234b4b64df39b9238ab4483996a73a76f449 100644 (file)
@@ -211,7 +211,7 @@ void Config_ModuleReader::loadScript(const std::string& theFileName, bool theSen
       PyErr_Fetch(&ptype, &pvalue, &ptraceback);
       PyErr_NormalizeException(&ptype, &pvalue, &ptraceback);
       pstr = PyObject_Str(pvalue);
-      std::string aPyError = std::string(PyString_AsString(pstr));
+      std::string aPyError = std::string(PyUnicode_AsUTF8(pstr));
       if (!aPyError.empty()) {
         anErrorMsg += ":\n" + aPyError;
       }
index 99f15351a6a1cf4bd93b4e31f59562950f0a4c4e..19d6e2bcaeda36e25247151721ba2e60247fc5b6 100644 (file)
@@ -75,7 +75,11 @@ SET(SWIG_MODULE_ConnectorAPI_EXTRA_DEPS ${SWIG_MODULE_ConnectorAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(ConnectorAPI python ConnectorAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ConnectorAPI LANGUAGE python SOURCES ConnectorAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ConnectorAPI python ConnectorAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ConnectorAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 0403f1e9ee713944d7b1cd3dd9ee0eb01253a263..fd363f3c781112cf885252284ad68f4d43bd42c0 100644 (file)
@@ -26,8 +26,8 @@ from salome.geom import geomBuilder
 import os
 import tempfile
 
-salome.salome_init(0,1)
-geompy = geomBuilder.New(salome.myStudy)
+salome.salome_init(1)
+geompy = geomBuilder.New()
 
 ## Get the last object published in the GEOM section of the object browser
 def getLastGEOMShape():
@@ -124,10 +124,10 @@ def testSeveralExportsToGEOM():
   dumpShaper(dumpFileShaper)
 
   # Load SHAPER dump
-  execfile(dumpFileShaper)
+  exec(compile(open(dumpFileShaper).read(), dumpFileShaper, 'exec'))
 
   # Load GEOM dump
-  execfile(dumpFileGeom)
+  exec(compile(open(dumpFileGeom).read(), dumpFileGeom, 'exec'))
 
   # Clean files
   files = [dumpFileGeom, dumpFileShaper]
@@ -139,4 +139,4 @@ def testSeveralExportsToGEOM():
 
 
 if __name__ == '__main__':
-  testSeveralExportsToGEOM()
\ No newline at end of file
+  testSeveralExportsToGEOM()
index 49b09bc6f615163911f287a742bbb2c7028dd551..130fb7090607f76017f51be8013a10f4ff95a810 100644 (file)
@@ -31,7 +31,7 @@ theStudy = salome.myStudy
 from salome.shaper import model
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 ## Get the last object published in the GEOM section of the object browser
 def getLastGEOMShape():
@@ -185,10 +185,10 @@ def checkDump():
   dumpShaper(dumpFileShaper)
 
   # Load SHAPER dump
-  execfile(dumpFileShaper)
+  exec(compile(open(dumpFileShaper).read(), dumpFileShaper, 'exec'))
 
   # Load GEOM dump
-  execfile(dumpFileGeom)
+  exec(compile(open(dumpFileGeom).read(), dumpFileGeom, 'exec'))
 
   # Clean files
   files = [dumpFileGeom, dumpFileShaper]
index e91ca315291531e01b4a6e5592ca9b8937da73ee..78c1c65eb9cfb4e59430d02bbf592fb038d23f6a 100644 (file)
@@ -39,7 +39,7 @@ class ConnectorPlugin(ModelAPI.ModelAPI_Plugin):
         if theFeatureID == ExportFeature.ID():
             return ExportFeature().__disown__()
         else:
-            print "ConnectorPlugin: No such feature %s" % theFeatureID
+            print("ConnectorPlugin: No such feature %s" % theFeatureID)
 
 ## The plugin created on module importing (from c++)
 plugin = ConnectorPlugin()
index b529eac7331c06227617369d2988bc853a0183c0..1fccfcef6009f6f86177797a7d96017fba0905c7 100644 (file)
@@ -104,8 +104,8 @@ class ExportFeature(ModelAPI.ModelAPI_Feature):
         ## List of objects created in the old geom for later use
         self.geomObjects = []
         ## geomBuilder tool
-        salome.salome_init(0,1)
-        self.geompy = geomBuilder.New(salome.myStudy)
+        salome.salome_init(1)
+        self.geompy = geomBuilder.New()
 
         self.exportViaXAO()
 
index 18830093d33a15b06644f82f5d45b7edf9ccda6a..88fd35809bdb1296dd4834cd6a9f0d81177b2ca0 100644 (file)
@@ -79,7 +79,11 @@ SET(SWIG_MODULE_ConstructionAPI_EXTRA_DEPS ${SWIG_MODULE_ConstructionAPI_EXTRA_D
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(ConstructionAPI python ConstructionAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ConstructionAPI LANGUAGE python SOURCES ConstructionAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ConstructionAPI python ConstructionAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ConstructionAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 574e12f99143baf78b349b9fd145f403911c4cc5..1dc931fd1ba7e0ded16518c68a4aa25b22cc43ba 100644 (file)
@@ -64,7 +64,11 @@ SET(SWIG_LINK_LIBRARIES
   ${PYTHON_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(EventsAPI python Events.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(EventsAPI LANGUAGE python SOURCES Events.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(EventsAPI python Events.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(EventsAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 40e5d303adadd996b61b9396a9461afeff5ca62e..e4ec3f0659e76678367ae8cc4d62316104d270dc 100644 (file)
@@ -76,7 +76,11 @@ SET(SWIG_MODULE_ExchangeAPI_EXTRA_DEPS ${SWIG_MODULE_ExchangeAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(ExchangeAPI python ExchangeAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ExchangeAPI LANGUAGE python SOURCES ExchangeAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ExchangeAPI python ExchangeAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ExchangeAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 5d05d3f8d3cd706d65fc472d40975431b20f2bcb..91dcb66901c699a0ce4c68d95a2a14e5b06efd64 100644 (file)
@@ -84,23 +84,3 @@ ADD_UNIT_TESTS(TestImport.py
                Test2290.py
                Test2459.py
                TestExportToXAOWithGroupNotUpdated.py)
-
-SET(DATA_FILES
-  solid.brep
-  solid.brp
-  screw.step
-  screw.stp
-  bearing.iges
-  bearing.igs
-  Box_1.brep
-  test.xao
-  export_ref.xao
-)
-
-FOREACH(file ${DATA_FILES})
-  CONFIGURE_FILE(
-    ${CMAKE_CURRENT_SOURCE_DIR}/Test/Data/${file}
-    ${CMAKE_CURRENT_BINARY_DIR}/Data/${file}
-    COPYONLY)
-ENDFOREACH(file ${DATA_FIELS})
-
index 696a2b0c270eafc0885326dca553db00e133ea42..8a6f1e320eceb40448228fe50d0d0c27ec3085b4 100644 (file)
@@ -27,6 +27,7 @@
 #=========================================================================
 import os
 import math
+from tempfile import TemporaryDirectory
 
 from ModelAPI import *
 
@@ -58,7 +59,8 @@ def testExport(theType, theFormat, theFile, theVolume, theDelta):
 
     aSession.startOperation("Import screw")
     anImportFeature = aPart.addFeature("Import")
-    anImportFeature.string("file_path").setValue("Data/screw.step")
+    aShapePath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Step", "screw.step")
+    anImportFeature.string("file_path").setValue(aShapePath)
     aSession.finishOperation()
 
     removeFile(theFile)
@@ -66,7 +68,7 @@ def testExport(theType, theFormat, theFile, theVolume, theDelta):
     aSession.startOperation("Export part")
     anExportFeature = aPart.addFeature("Export")
     anExportFeature.string("file_format").setValue(theFormat)
-    print "theFile=",theFile
+    print("theFile=",theFile)
     anExportFeature.string("file_path").setValue(theFile)
     anExportFeature.string("ExportType").setValue("Regular")
     aSelectionListAttr = anExportFeature.selectionList("selection_list")
@@ -79,7 +81,7 @@ def testExport(theType, theFormat, theFile, theVolume, theDelta):
     # Test exported file by importing
     testImport(theType, theFile, theVolume, theDelta)
 
-def testExportXAO():
+def testExportXAO(theFile):
     # Import a reference part
     aSession.startOperation("Add part")
     aPartFeature = aSession.moduleDocument().addFeature("Part")
@@ -88,7 +90,8 @@ def testExportXAO():
 
     aSession.startOperation("Import Box_1")
     anImportFeature = aPart.addFeature("Import")
-    anImportFeature.string("file_path").setValue("Data/Box_1.brep")
+    aShapePath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Brep", "box1.brep")
+    anImportFeature.string("file_path").setValue(aShapePath)
     aSession.finishOperation()
 
     # Create groups
@@ -105,16 +108,16 @@ def testExportXAO():
     aGroupFeature.data().setName("")
     aSelectionListAttr = aGroupFeature.selectionList("group_list")
     aSelectionListAttr.setSelectionType("face")
-    aSelectionListAttr.append("Box_1_1/Shape1")
-    aSelectionListAttr.append("Box_1_1/Shape2")
+    aSelectionListAttr.append("box1_1/Shape1")
+    aSelectionListAttr.append("box1_1/Shape2")
     aSession.finishOperation()
 
     aSession.startOperation("Create a field")
     aField = aSession.activeDocument().addFeature("Field")
     aSelectionListAttr = aField.selectionList("selected")
     aSelectionListAttr.setSelectionType("face")
-    aSelectionListAttr.append("Box_1_1/Shape1")
-    aSelectionListAttr.append("Box_1_1/Shape2")
+    aSelectionListAttr.append("box1_1/Shape1")
+    aSelectionListAttr.append("box1_1/Shape2")
     aComponentNames = aField.stringArray("components_names")
     aComponentNames.setSize(2) # two components
     aComponentNames.setValue(0, "temperatue")
@@ -136,7 +139,7 @@ def testExportXAO():
     # Export
     aSession.startOperation("Export to XAO")
     anExportFeature = aPart.addFeature("Export")
-    anExportFeature.string("xao_file_path").setValue("Data/export.xao")
+    anExportFeature.string("xao_file_path").setValue(theFile)
     anExportFeature.string("file_format").setValue("XAO")
     anExportFeature.string("ExportType").setValue("XAO")
     anExportFeature.string("xao_author").setValue("me")
@@ -144,34 +147,36 @@ def testExportXAO():
     aSession.finishOperation()
 
     # Check exported file
+    aRefPath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Xao", "box2.xao")
     import filecmp
-    assert filecmp.cmp("Data/export.xao", "Data/export_ref.xao")
+    assert filecmp.cmp(theFile, aRefPath)
 
 if __name__ == '__main__':
-#=========================================================================
-# Export a shape into BREP
-#=========================================================================
-    aRealVolume = 3.78827401738e-06
-    testExport("BREP", "BREP", os.path.join(os.getcwd(), "Data", "screw_export.brep"), aRealVolume, 10 ** -17)
-    testExport("BRP", "BREP", os.path.join(os.getcwd(), "Data", "screw_export.brp"), aRealVolume, 10 ** -17)
-#=========================================================================
-# Export a shape into STEP
-#=========================================================================
-    testExport("STEP", "STEP", os.path.join(os.getcwd(), "Data", "screw_export.step"), 3.78825807533e-06, 10 ** -17)
-    testExport("STP", "STEP", os.path.join(os.getcwd(), "Data", "screw_export.stp"), 3.78825807533e-06, 10 ** -17)
-#=========================================================================
-# Export a shape into IGES
-#=========================================================================
-    testExport("IGES-5.1", "IGES-5.1", os.path.join(os.getcwd(), "Data", "screw_export-5.1.iges"), 3.78829613776e-06, 10 ** -17)
-    testExport("IGS-5.1", "IGES-5.1", os.path.join(os.getcwd(), "Data", "screw_export-5.1.igs"), 3.78829613776e-06, 10 ** -17)
-    testExport("IGES-5.3", "IGES-5.3", os.path.join(os.getcwd(), "Data", "screw_export-5.3.iges"), 3.78827401651e-06, 10 ** -17)
-    testExport("IGS-5.3", "IGES-5.3", os.path.join(os.getcwd(), "Data", "screw_export-5.3.igs"), 3.78827401651e-06, 10 ** -17)
-#=========================================================================
-# Export a shape into XAO
-#=========================================================================
-    testExportXAO()
-#=========================================================================
-# End of test
-#=========================================================================
-
-assert(model.checkPythonDump())
+    with TemporaryDirectory() as tmp_dir:
+        #=========================================================================
+        # Export a shape into BREP
+        #=========================================================================
+        aRealVolume = 3.78827401738e-06
+        testExport("BREP", "BREP", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 10 ** -17)
+        testExport("BRP", "BREP", os.path.join(tmp_dir, "screw_export.brp"), aRealVolume, 10 ** -17)
+        #=========================================================================
+        # Export a shape into STEP
+        #=========================================================================
+        testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.step"), 3.78825807533e-06, 10 ** -17)
+        testExport("STP", "STEP", os.path.join(tmp_dir, "screw_export.stp"), 3.78825807533e-06, 10 ** -17)
+        #=========================================================================
+        # Export a shape into IGES
+        #=========================================================================
+        testExport("IGES-5.1", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.iges"), 3.78829613776e-06, 10 ** -17)
+        testExport("IGS-5.1", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.igs"), 3.78829613776e-06, 10 ** -17)
+        testExport("IGES-5.3", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.iges"), 3.78827401651e-06, 10 ** -17)
+        testExport("IGS-5.3", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.igs"), 3.78827401651e-06, 10 ** -17)
+        #=========================================================================
+        # Export a shape into XAO
+        #=========================================================================
+        testExportXAO(os.path.join(tmp_dir, "export.xao"))
+        #=========================================================================
+        # End of test
+        #=========================================================================
+
+        assert(model.checkPythonDump())
index 8f95e8a23fb6614000ad608a6ad6fdb5dbdb3fd9..0d42f92072977e94f3994665b252aa4c08efe7fa 100644 (file)
 #=========================================================================
 from ModelAPI import *
 from GeomAlgoAPI import *
+
+import os
 import math
+import shutil
+from tempfile import TemporaryDirectory
 
 __updated__ = "2015-05-22"
 
 aSession = ModelAPI_Session.get()
+
 #=========================================================================
 # Common test function
 #=========================================================================
+def getShapePath(path):
+    shapes_dir = os.path.join(os.getenv("DATA_DIR"), "Shapes")
+    return os.path.join(shapes_dir, path)
+
 def testImport(theType, theFile, theVolume, theDelta):
     # Create a part for import
     aSession.startOperation("Create part for import")
@@ -74,7 +83,7 @@ def testImportXAO():
 
     aSession.startOperation("Import XAO")
     anImportFeature = aPart.addFeature("Import")
-    anImportFeature.string("file_path").setValue("Data/test.xao")
+    anImportFeature.string("file_path").setValue(getShapePath("Xao/box1.xao"))
     aSession.finishOperation()
 
     # Check results
@@ -104,7 +113,7 @@ def testImportXAO():
     assert aSelectionList.selectionType() == "face"
     assert aSelectionList.size() == 2
     assert aSelectionList.value(0).namingName("") == "mygeom_1/Shape1"
-    print aSelectionList.value(1).namingName("")
+    print(aSelectionList.value(1).namingName(""))
     assert aSelectionList.value(1).namingName("") == "mygeom_1/Shape2"
 
     aFeature3 = aCompositeFeature.subFeature(2, False)
@@ -118,28 +127,37 @@ def testImportXAO():
     assert aFeature3.selectionList("selected").size() == 1
 
 if __name__ == '__main__':
-#=========================================================================
-# Create a shape imported from BREP
-#=========================================================================
-    testImport("BREP", "Data/solid.brep", 259982.297176, 10 ** -5)
-    testImport("BRP", "Data/solid.brp", 259982.297176, 10 ** -5)
-#=========================================================================
-# Create a shape imported from STEP
-#=========================================================================
-    testImport("STP", "Data/screw.stp", 3.78827401738e-06, 10 ** -17)
-    testImport("STEP", "Data/screw.step", 3.78827401738e-06, 10 ** -17)
-#=========================================================================
-# Create a shape imported from IGES
-#=========================================================================
-    testImport("IGES", "Data/bearing.iges", 6.86970803067e-14, 10 ** -25)
-    testImport("IGS", "Data/bearing.igs", 6.86970803067e-14, 10 ** -25)
-#=========================================================================
-# Create a shape imported from XAO
-#=========================================================================
-    testImportXAO()
-#=========================================================================
-# End of test
-#=========================================================================
-
-from salome.shaper import model
-assert(model.checkPythonDump())
+    with TemporaryDirectory() as tmp_dir:
+        #=========================================================================
+        # Create a shape imported from BREP
+        #=========================================================================
+        shape_path = getShapePath("Brep/solid.brep")
+        testImport("BREP", shape_path, 259982.297176, 10 ** -5)
+        shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "solid.brp"))
+        testImport("BRP", shape_path, 259982.297176, 10 ** -5)
+        #=========================================================================
+        # Create a shape imported from STEP
+        #=========================================================================
+        shape_path = getShapePath("Step/screw.step")
+        testImport("STP", shape_path, 3.78827401738e-06, 10 ** -17)
+        shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "screw.stp"))
+        testImport("STEP", shape_path, 3.78827401738e-06, 10 ** -17)
+        #=========================================================================
+        # Create a shape imported from IGES
+        #=========================================================================
+        shape_path = getShapePath("Iges/bearing.igs")
+        testImport("IGES", shape_path, 6.86970803067e-14, 10 ** -25)
+        shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "bearing.iges"))
+        testImport("IGS", shape_path, 6.86970803067e-14, 10 ** -25)
+
+        #=========================================================================
+        # Create a shape imported from XAO
+        #=========================================================================
+        testImportXAO()
+
+        #=========================================================================
+        # End of test
+        #=========================================================================
+
+        from salome.shaper import model
+        assert(model.checkPythonDump())
index b511fc640dbfc008d3933856aa46ac03d8f16dfe..b4ac9a4bbd1bbba63e8300020b4b0fc1115d5bff 100644 (file)
@@ -118,7 +118,11 @@ SET(SWIG_MODULE_FeaturesAPI_EXTRA_DEPS ${SWIG_MODULE_FeaturesAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(FeaturesAPI python FeaturesAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(FeaturesAPI LANGUAGE python SOURCES FeaturesAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(FeaturesAPI python FeaturesAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(FeaturesAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index d332d786fc90cb259aa8e40e66976b007a36984e..c65d2c4bc550af394621c01be1fc587b0b4bfb47 100644 (file)
@@ -67,8 +67,8 @@ radius = 95. / N / 2.
 
 aSession.startOperation()
 aSketchFeatures = []
-for i in xrange(0, N):
-    for j in xrange(0, N):
+for i in range(0, N):
+    for j in range(0, N):
         # Create circle
         aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
         origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
@@ -95,7 +95,7 @@ aSession.finishOperation()
 aSession.startOperation()
 
 anExtrusions = []
-for i in xrange(0, N * N):
+for i in range(0, N * N):
     aSketchResult = aSketchFeatures[i].firstResult()
     aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
     origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
@@ -196,7 +196,7 @@ aSession.startOperation()
 
 aBooleanFt = aPart.addFeature("Cut")
 aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
-for i in xrange(0, N * N):
+for i in range(0, N * N):
     anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
     aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
 aBooleanFt.execute()
index 08f4887d07488c6f1f049f4ceadef476e6623d10..ddbde47932709ce72866ee278c80d81c4653e610 100644 (file)
@@ -67,8 +67,8 @@ radius = 95. / N / 2.
 
 aSession.startOperation()
 aSketchFeatures = []
-for i in xrange(0, N):
-    for j in xrange(0, N):
+for i in range(0, N):
+    for j in range(0, N):
         # Create circle
         aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
         origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
@@ -95,7 +95,7 @@ aSession.finishOperation()
 aSession.startOperation()
 
 anExtrusions = []
-for i in xrange(0, N * N):
+for i in range(0, N * N):
     aSketchResult = aSketchFeatures[i].firstResult()
     aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
     origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
@@ -195,7 +195,7 @@ aSession.finishOperation()
 aCurrentResult = modelAPI_ResultBody(aBox.firstResult())
 aSession.startOperation()
 aFactory = ModelAPI_Session.get().validators()
-for i in xrange(0, N * N):
+for i in range(0, N * N):
     anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
     aBooleanFt = aPart.addFeature("Cut")
     aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
index 6654525fa428de3ea445f9bb6f510c47111336d9..701d3570d8d5378699d737161cf01cbcb5290e27 100644 (file)
@@ -74,7 +74,11 @@ SET(SWIG_MODULE_GDMLAPI_EXTRA_DEPS ${SWIG_MODULE_GDMLAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(GDMLAPI python GDMLAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(GDMLAPI LANGUAGE python SOURCES GDMLAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(GDMLAPI python GDMLAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(GDMLAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index d441758f83bcda965ccb96a8a63cdf1d373fa1c8..889e8344cb69818fae0d783ddd1f9c30da414928 100644 (file)
@@ -146,7 +146,11 @@ SET(SWIG_LINK_LIBRARIES
   ${PYTHON_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(GeomAPI python GeomAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(GeomAPI LANGUAGE python SOURCES GeomAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(GeomAPI python GeomAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(GeomAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 89e39adfe2cdc3bce1b9740af4983182ac5c5bb6..270118fcdcfce18498c30e12406839cbab8aaf47 100644 (file)
@@ -97,9 +97,9 @@ bool GeomAPI_Face::isEqual(std::shared_ptr<GeomAPI_Shape> theFace) const
     return false;
 
   Handle(IntTools_Context) aContext = new IntTools_Context();
-  // Double check needed bacause BOPTools_AlgoTools::CheckSameGeom not very smart.
-  Standard_Boolean aRes = BOPTools_AlgoTools::CheckSameGeom(aMyFace, aInFace, aContext)
-    && BOPTools_AlgoTools::CheckSameGeom(aInFace, aMyFace, aContext);
+  // Double check needed because BOPTools_AlgoTools::AreFacesSameDomain not very smart.
+  Standard_Boolean aRes = BOPTools_AlgoTools::AreFacesSameDomain(aMyFace, aInFace, aContext)
+    && BOPTools_AlgoTools::AreFacesSameDomain(aInFace, aMyFace, aContext);
 
   return aRes == Standard_True;
 }
index f24b06d6964359864346f5aa3a0ae79d6984452b..956eb9cd2b3f3c80005a352b4c9ac6352f9af3aa 100644 (file)
@@ -189,7 +189,11 @@ SET(SWIG_LINK_LIBRARIES
   ${PYTHON_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(GeomAlgoAPI python GeomAlgoAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(GeomAlgoAPI LANGUAGE python SOURCES GeomAlgoAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(GeomAlgoAPI python GeomAlgoAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(GeomAlgoAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 90e0654b5f40b3bb7cac8f4d64788f64e48ae2c1..f22839d32ed01989d9b8863627ab528b3afe6c19 100644 (file)
@@ -64,7 +64,11 @@ SET(SWIG_LINK_LIBRARIES
   ${PYTHON_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(GeomDataAPI python GeomDataAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(GeomDataAPI LANGUAGE python SOURCES GeomDataAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(GeomDataAPI python GeomDataAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(GeomDataAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index de159cffca884e606a7d54a34789b737efb8d4d6..b7d591b29c184ac7dae0caed20b00afbcd46436d 100644 (file)
@@ -68,8 +68,8 @@ InitializationPlugin_PyInterp::positions(const std::string& theExpression,
 
   std::string anExpression = adjustExpression(theExpression);
   // extend aContext with variables
-  PyDict_SetItemString(aContext, "expression", PyString_FromString(anExpression.c_str()));
-  PyDict_SetItemString(aContext, "name", PyString_FromString(theName.c_str()));
+  PyDict_SetItemString(aContext, "expression", PyUnicode_FromString(anExpression.c_str()));
+  PyDict_SetItemString(aContext, "name", PyUnicode_FromString(theName.c_str()));
   PyDict_SetItemString(aContext, "positions", Py_BuildValue("[]"));
 
   // run the search code
@@ -84,8 +84,8 @@ InitializationPlugin_PyInterp::positions(const std::string& theExpression,
     PyObject* aColOffset = PyTuple_GetItem(aPosition, 1);
 
     aResult.push_back(
-        std::pair<int, int>((int)PyInt_AsLong(aLineNo),
-                            (int)PyInt_AsLong(aColOffset)));
+        std::pair<int, int>((int)PyLong_AsLong(aLineNo),
+                            (int)PyLong_AsLong(aColOffset)));
   }
 
   // TODO(spo): after this refCount of the variable is not 0. Is there memory leak?
@@ -117,17 +117,18 @@ std::list<std::string> InitializationPlugin_PyInterp::compile(const std::string&
   }
 
   PyCodeObject* aCodeObj = (PyCodeObject*) aCodePyObj;
-  std::string aCodeName(PyString_AsString(aCodeObj->co_code));
+  std::string aCodeName(PyBytes_AsString(aCodeObj->co_code));
   // co_names should be tuple, but can be changed in modern versions of python (>2.7.3)
-  if(!PyTuple_Check(aCodeObj->co_names))
+  if(!PyTuple_Check(aCodeObj->co_names)) {
     return aResult;
+  }
 
   size_t params_size = PyTuple_Size(aCodeObj->co_names);
   if (params_size > 0) {
     for (size_t i = 0; i < params_size; i++) {
       PyObject* aParamObj = PyTuple_GetItem(aCodeObj->co_names, i);
       PyObject* aParamObjStr = PyObject_Str(aParamObj);
-      std::string aParamName(PyString_AsString(aParamObjStr));
+      std::string aParamName(PyUnicode_AsUTF8(aParamObjStr));
       aResult.push_back(aParamName);
       Py_XDECREF(aParamObjStr);
     }
@@ -171,7 +172,7 @@ double InitializationPlugin_PyInterp::evaluate(const std::string& theExpression,
     return 0.;
   }
 
-  PyObject* anEvalResult = PyEval_EvalCode(anExprCode, _global_context, _local_context);
+  PyObject* anEvalResult = PyEval_EvalCode((PyObject *)anExprCode, _global_context, _local_context);
   if(!anEvalResult) {
     theError = errorMessage();
     Py_XDECREF(anExprCode);
@@ -180,7 +181,7 @@ double InitializationPlugin_PyInterp::evaluate(const std::string& theExpression,
   }
 
   PyObject* anEvalStrObj = PyObject_Str(anEvalResult);
-  std::string anEvalStr(PyString_AsString(anEvalStrObj));
+  std::string anEvalStr(PyUnicode_AsUTF8(anEvalStrObj));
   Py_XDECREF(anExprCode);
   Py_XDECREF(anEvalResult);
   Py_XDECREF(anEvalStrObj);
@@ -207,7 +208,7 @@ std::string InitializationPlugin_PyInterp::errorMessage()
     PyErr_Fetch(&ptype, &pvalue, &ptraceback);
     PyErr_NormalizeException(&ptype, &pvalue, &ptraceback);
     pstr = PyObject_Str(pvalue);
-    aPyError = std::string(PyString_AsString(pstr));
+    aPyError = std::string(PyUnicode_AsUTF8(pstr));
     Py_XDECREF(pstr);
     Py_XDECREF(ptype);
     Py_XDECREF(pvalue);
index 16fb0c5182a7167e346ae67987027acd19fab269..2c828ff9656955c292ef6510c814cfbc95374a11 100644 (file)
@@ -144,7 +144,11 @@ SET(SWIG_LINK_LIBRARIES
   ${PYTHON_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(ModelAPI python ModelAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ModelAPI LANGUAGE python SOURCES ModelAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ModelAPI python ModelAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ModelAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 6199cb72ad2089ce9df65ba35b596c7ed031c740..3285881c9015a1f19606b9ae520320da95097130 100644 (file)
 %shared_ptr(ModelAPI_ResultCompSolid)
 
 %typecheck(SWIG_TYPECHECK_POINTER) const ModelAPI_AttributeTables::Value {
-  $1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input) || PyBool_Check($input)) ? 1 : 0;
+  $1 = (PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input) || PyBool_Check($input)) ? 1 : 0;
 }
 
 // Tables Value reading as int, double, boolean or string
 %typemap(in) const ModelAPI_AttributeTables::Value {
-  if (PyInt_Check($input)) {
-    $1.myInt = int(PyInt_AsLong($input));
-    $1.myDouble = double(PyInt_AsLong($input));
-    $1.myBool = PyInt_AsLong($input) != 0;
+  if (PyLong_Check($input)) {
+    $1.myInt = int(PyLong_AsLong($input));
+    $1.myDouble = double(PyLong_AsLong($input));
+    $1.myBool = PyLong_AsLong($input) != 0;
   } else if (PyFloat_Check($input)) {
     $1.myInt = int(PyFloat_AsDouble($input));
     $1.myDouble = PyFloat_AsDouble($input);
   } else if (PyBool_Check($input)) {
     $1.myBool = $input == Py_True;
-  } else if (PyString_Check($input)) {
-    $1.myStr = PyString_AsString($input);
+  } else if (PyUnicode_Check($input)) {
+    $1.myStr = PyUnicode_AsUTF8($input);
   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
   } else {
     PyErr_SetString(PyExc_ValueError, "Tables value must be int, double, string or bool.");
index 211275e52be47ee2348d664d9f4a279dc38701ef..ca2ac6c92655074b93f2af128991e49c5253191c 100644 (file)
@@ -94,7 +94,7 @@ model.do()
 
 Extrusions = [Extrusion_1, Extrusion_2, Extrusion_3]
 BooleanResults = Boolean_1.results()
-for i in xrange(len(BooleanResults)):
+for i in range(len(BooleanResults)):
   assert(BooleanResults[i].name() == Extrusions[i].result().name()), "Name of result {} of Boolean CUT '{}' != '{}'".format(i, BooleanResults[i].name(), Extrusions[i].result().name())
   BooleanName = Boolean_1.name() + "_" + str(i + 1)
   for sub in range(0, BooleanResults[i].numberOfSubs()):
index b6cdf135b8b73a87539117f69d5f0a742b93caa8..58e55ff583cf1bfafb856622599c66d41ec7aab0 100755 (executable)
@@ -74,7 +74,11 @@ SET(SWIG_LINK_LIBRARIES
   ${PYTHON_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(ModelGeomAlgo python ModelGeomAlgo.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ModelGeomAlgo LANGUAGE python SOURCES ModelGeomAlgo.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ModelGeomAlgo python ModelGeomAlgo.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ModelGeomAlgo ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 9c0ce38a1b51096d12a57f5a43e7d56bc48da4a6..db374645ce88bf3cd3882e6246e6b1ef72d32f92 100644 (file)
@@ -93,7 +93,11 @@ set(SWIG_MODULE_ModelHighAPI_EXTRA_DEPS
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(ModelHighAPI python ModelHighAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ModelHighAPI LANGUAGE python SOURCES ModelHighAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ModelHighAPI python ModelHighAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ModelHighAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 0b49cf05c46f9696caef19d8b3a333fd61b969ad..2d4b6a8c86f76a7606de2653f564ce24f995436d 100644 (file)
@@ -32,7 +32,7 @@
   #include "ModelHighAPI_swig.h"
 
   // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
+  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
 %}
 
 %include "doxyhelp.i"
 // typemaps
 
 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
-  if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
+  if (PyFloat_Check($input) || PyLong_Check($input)) {
     temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
     $1 = &temp;
-  } else if (PyString_Check($input)) {
-    temp = ModelHighAPI_Double(PyString_AsString($input));
+  } else if (PyUnicode_Check($input)) {
+    temp = ModelHighAPI_Double(PyUnicode_AsUTF8($input));
     $1 = &temp;
   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
   } else {
   }
 }
 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
-  $1 = ((PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
+  $1 = ((PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
 }
 
 %typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
-  if (PyInt_Check($input)) {
-    temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
+  if (PyLong_Check($input)) {
+    temp = ModelHighAPI_Integer(static_cast<int>(PyLong_AsLong($input)));
     $1 = &temp;
-  } else if (PyString_Check($input)) {
-    temp = ModelHighAPI_Integer(PyString_AsString($input));
+  } else if (PyUnicode_Check($input)) {
+    temp = ModelHighAPI_Integer(PyUnicode_AsUTF8($input));
     $1 = &temp;
   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
   } else {
@@ -92,7 +92,7 @@
   }
 }
 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
-  $1 = ((PyInt_Check($input) || PyString_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
+  $1 = ((PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
 }
 
 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
index b7b5f1dabdf9b13b5dd191606a3c6aef4d9adbc0..70995d6a76f9616d0b1e0ae02629434a5aa57aff 100644 (file)
@@ -435,7 +435,7 @@ bool checkPythonDump()
     return false; // something is wrong during dump
   }
 
-   // map from document name to feature name to feature data
+  // map from document name to feature name to feature data
   std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > aStore;
   std::string anError = storeFeatures(
     aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false);
@@ -444,14 +444,16 @@ bool checkPythonDump()
     anErrorMsg.send();
     return false;
   }
+
   // close all before importation of the script
   aSession->closeAll();
+
   // execute the dumped
   PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */
   static char aDumpName[] = "./check_dump.py";
   static char aReadMode[] = "r";
-  PyObject* PyFileObject = PyFile_FromString(aDumpName, aReadMode);
-  PyRun_SimpleFileEx(PyFile_AsFile(PyFileObject), aDumpName, 1);
+  FILE* aFile = _Py_fopen(aDumpName, aReadMode);
+  PyRun_SimpleFileEx(aFile, aDumpName, 1);
   PyGILState_Release(gstate); /* release python thread */
 
   // compare with the stored data
index cf141d592387a9542c9933b9c284671cb628d841..035d6c52a12a9fa73dbc7d49dcac375b42ad6168 100755 (executable)
@@ -371,9 +371,12 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a
   AIS_Shape::ComputeSelection(aSelection, theMode);
 
   if (myAdditionalSelectionPriority > 0) {
-    for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
-      Handle(SelectBasics_EntityOwner) aBasicsOwner =
-        aSelection->Sensitive()->BaseSensitive()->OwnerId();
+    NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> anEntities = aSelection->Entities();
+    for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIt(anEntities);
+        anIt.More();
+        anIt.Next()) {
+      Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
+      Handle(SelectBasics_EntityOwner) aBasicsOwner = anEntity->BaseSensitive()->OwnerId();
       if (!aBasicsOwner.IsNull())
         aBasicsOwner->Set(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
     }
@@ -397,12 +400,18 @@ bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selectio
     StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection,
                                                   aDeflection, myDrawer->HLRAngle(), 9, 500);
 
-    for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
+
+    NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> anEntities = aSelection->Entities();
+    for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIt(anEntities);
+        anIt.More();
+        anIt.Next()) {
+      Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
       Handle(SelectMgr_EntityOwner) anOwner =
         Handle(SelectMgr_EntityOwner)
-        ::DownCast(aSelection->Sensitive()->BaseSensitive()->OwnerId());
+        ::DownCast(anEntity->BaseSensitive()->OwnerId());
       anOwner->Set(this);
     }
+
     return true;
   }
   return false;
index bad153b70c36496ead630708bbfb47a66c51da8f..08e513cc5dc98a7349f0e7fad7a6a67ed1c5364d 100644 (file)
@@ -75,7 +75,11 @@ SET(SWIG_MODULE_ParametersAPI_EXTRA_DEPS ${SWIG_MODULE_ParametersAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(ParametersAPI python ParametersAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(ParametersAPI LANGUAGE python SOURCES ParametersAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(ParametersAPI python ParametersAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(ParametersAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 0c98f7a801e5d3294d4b9e03889b7080e5d2b166..3e5b38c1f4b35ccf7c12db7ee4f4d70f96ccc1ca 100644 (file)
@@ -89,7 +89,7 @@ for name, expr in zip(ltNames, ltExpressions):
     assert(aResultAttr.data())
     assert(aResultAttr.data().real("Value"))
     aResultValue = aResultAttr.data().real("Value").value()
-    print aResultValue, " == ", float(expr)
+    print(aResultValue, " == ", float(expr))
     assert(aResultValue == float(expr))
 
 # Check referencing between parameters
index 265571df56b9c96bdcc3b9331745534956e7a263..4b2e45c7cd91f522dc00a9d3f903062c8a60826c 100644 (file)
@@ -76,7 +76,11 @@ SET(SWIG_MODULE_PartSetAPI_EXTRA_DEPS ${SWIG_MODULE_PartSetAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(PartSetAPI python PartSetAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(PartSetAPI LANGUAGE python SOURCES PartSetAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(PartSetAPI python PartSetAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(PartSetAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 82f6558b0d7f939ef845ca4600c50ced6703c52d..8cd9c647e2071c00206f8b5d8366371b5bd9d185 100644 (file)
@@ -80,7 +80,11 @@ SET(SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS ${SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(PrimitivesAPI python PrimitivesAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(PrimitivesAPI LANGUAGE python SOURCES PrimitivesAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(PrimitivesAPI python PrimitivesAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(PrimitivesAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index 7358f11efbb0c018e3bbc413a1ebd616d0d5b5aa..f70dc035584a1f8b3ce97076d01090a1f1bd8aab 100644 (file)
@@ -84,7 +84,11 @@ class FeaturesTestCase(FeaturesFixture):
         ExchangeAPI.ExchangeAPI_Import(self.part.addFeature("Import"))
 
         import FeaturesAPI
-        FeaturesAPI.FeaturesAPI_Boolean(self.part.addFeature("Boolean"))
+        FeaturesAPI.FeaturesAPI_BooleanCut(self.part.addFeature("BooleanCut"))
+        FeaturesAPI.FeaturesAPI_BooleanFuse(self.part.addFeature("BooleanFuse"))
+        FeaturesAPI.FeaturesAPI_BooleanCommon(self.part.addFeature("BooleanCommon"))
+        FeaturesAPI.FeaturesAPI_BooleanFill(self.part.addFeature("BooleanFill"))
+        FeaturesAPI.FeaturesAPI_BooleanSmash(self.part.addFeature("BooleanSmash"))
         FeaturesAPI.FeaturesAPI_Extrusion(self.part.addFeature("Extrusion"))
         FeaturesAPI.FeaturesAPI_ExtrusionCut(self.part.addFeature("ExtrusionCut"))
         FeaturesAPI.FeaturesAPI_ExtrusionFuse(self.part.addFeature("ExtrusionFuse"))
index 2acabd660f604a45db0535c9c36bacdf6c27cfbf..3f3490f55e5aae3765ebf9be6a4e54af3e2fd7fd 100644 (file)
@@ -74,8 +74,8 @@ source_suffix = '.rst'
 master_doc = 'index'
 
 # General information about the project.
-project = u'Shaper python API'
-copyright = u'2014-20xx CEA/DEN, EDF R&D'
+project = 'Shaper python API'
+copyright = '2014-20xx CEA/DEN, EDF R&D'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -227,8 +227,8 @@ latex_elements = {
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-  ('index', 'ShaperpythonAPI.tex', u'Shaper python API Documentation',
-   u'Renaud Nédélec', 'manual'),
+  ('index', 'ShaperpythonAPI.tex', 'Shaper python API Documentation',
+   'Renaud Nédélec', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
@@ -257,8 +257,8 @@ latex_documents = [
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'shaperpythonapi', u'Shaper python API Documentation',
-     [u'Renaud Nédélec'], 1)
+    ('index', 'shaperpythonapi', 'Shaper python API Documentation',
+     ['Renaud Nédélec'], 1)
 ]
 
 # If true, show URL addresses after external links.
@@ -271,8 +271,8 @@ man_pages = [
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-  ('index', 'ShaperpythonAPI', u'Shaper python API Documentation',
-   u'Renaud Nédélec', 'ShaperpythonAPI', 'One line description of project.',
+  ('index', 'ShaperpythonAPI', 'Shaper python API Documentation',
+   'Renaud Nédélec', 'ShaperpythonAPI', 'One line description of project.',
    'Miscellaneous'),
 ]
 
index 29364c692b38edf4074740ddaec6a2129bd1ce8b..d4d142f13dc1cb9bd028a59a2c6294c09da47034 100644 (file)
@@ -8,20 +8,20 @@ All features are available via model.add*() functions. Exceptions are:
 
 # General purpose functions and abstract root classes
 
-from services  import *
-from roots     import *
+from .services  import *
+from .roots     import *
 
 # Built-in features
 
-from build import *
-from sketcher import *
-from connection import *
-from construction import *
-from exchange import *
-from features import *
-from collection import *
-from parameter import *
-from partset import *
-from primitives import *
-from gdml import *
-from tests import *
+from .build import *
+from .sketcher import *
+from .connection import *
+from .construction import *
+from .exchange import *
+from .features import *
+from .collection import *
+from .parameter import *
+from .partset import *
+from .primitives import *
+from .gdml import *
+from .tests import *
index 78a1de4e5f5f2cf749e1e5ce42fe322ff6dcf89f..2bb02cfdc7ca8f3d668de6fe6b28aed922efd860 100644 (file)
@@ -1,4 +1,4 @@
 """Package for dumping purposes.
 """
 
-from DumpAssistant import *
+from .DumpAssistant import *
index 8c0319a1ecab2b26d8bd563a03aface7855dc7c8..2d5622aee495d850add82153e5666845afdb0494 100644 (file)
@@ -2,5 +2,5 @@
 """
 
 from SketchAPI import addSketch
-from tools import *
-from tests import *
+from .tools import *
+from .tests import *
index f3dcdb37a819049f03f325aa1c3e9e48d3783369..0a2c4f6d4e6209d6df709fce038f65c30cfce5f0 100644 (file)
@@ -68,7 +68,7 @@ def dof(sketch):
     aSketch = sketch
     if issubclass(type(aSketch), ModelHighAPI.ModelHighAPI_Interface):
         aSketch = sketch.feature()
-    return int(filter(str.isdigit, aSketch.string("SolverDOF").value()))
+    return int(''.join(filter(str.isdigit, aSketch.string("SolverDOF").value())))
 
 def distancePointPoint(thePoint1, thePoint2):
     aPnt1 = toList(thePoint1)
index f853b103ffe6bfa4d1bd78b353e4be64172815b0..b8f079e0452708323135d1591b1da789aa877202 100644 (file)
@@ -1 +1 @@
-from tests import *
\ No newline at end of file
+from .tests import *
\ No newline at end of file
index e2ba9dfe41141aebb33d4bac25315eeb37ad3d89..45c8ffbf35599dd27fe5f24cc743479d7c90e6d3 100644 (file)
@@ -42,14 +42,14 @@ def generateTests(theFeature, theFeatureName, theTestsList = []):
   """
   if "testNbResults" in theTestsList or len(theTestsList) == 0:
     aNbResults = len(theFeature.results())
-    print "model.testNbResults({}, {})".format(theFeatureName, aNbResults)
+    print("model.testNbResults({}, {})".format(theFeatureName, aNbResults))
 
   if "testNbSubResults" in theTestsList or len(theTestsList) == 0:
     aNbResults = len(theFeature.results())
     aNbSubResults = []
     for anIndex in range(0, aNbResults):
       aNbSubResults.append(theFeature.results()[anIndex].numberOfSubs())
-    print "model.testNbSubResults({}, {})".format(theFeatureName, aNbSubResults)
+    print("model.testNbSubResults({}, {})".format(theFeatureName, aNbSubResults))
 
   if "testNbSubShapes" in theTestsList or len(theTestsList) == 0:
     aNbResults = len(theFeature.results())
@@ -61,16 +61,16 @@ def generateTests(theFeature, theFeatureName, theTestsList = []):
         aShapeExplorer = GeomAPI_ShapeExplorer(aShape, aShapeType)
         while aShapeExplorer.more():
           aNbResultSubShapes += 1
-          aShapeExplorer.next();
+          aShapeExplorer.next()
         aNbSubShapes.append(aNbResultSubShapes)
-      print "model.testNbSubShapes({}, {}, {})".format(theFeatureName, aShapeTypes[aShapeType], aNbSubShapes)
+      print("model.testNbSubShapes({}, {}, {})".format(theFeatureName, aShapeTypes[aShapeType], aNbSubShapes))
 
   if "testResultsVolumes" in theTestsList or len(theTestsList) == 0:
     aNbResults = len(theFeature.results())
     aResultsVolumes = []
     for anIndex in range(0, aNbResults):
       aResultsVolumes.append(GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()))
-    print "model.testResultsVolumes({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes))
+    print("model.testResultsVolumes({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes)))
 
 
 def testNbResults(theFeature, theExpectedNbResults):
@@ -112,7 +112,7 @@ def testNbSubShapes(theFeature, theShapeType, theExpectedNbSubShapes):
     aShapeExplorer = GeomAPI_ShapeExplorer(aShape, theShapeType)
     while aShapeExplorer.more():
       aNbResultSubShapes += 1
-      aShapeExplorer.next();
+      aShapeExplorer.next()
     assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes)
 
 
index b5ebf59fa6f3585a3d593f49aea374f1c49a7fb0..3fcb67d129c2e4dcc0a26dae7ac6666c25397e99 100644 (file)
@@ -50,7 +50,7 @@ class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
             aFeature = SketchPlugin_Rectangle().__disown__()
 
         else:
-            raise StandardError("No such feature %s" % theFeatureID)
+            raise Exception("No such feature %s" % theFeatureID)
 
         return aFeature
 
index c647ef0e6d70f0c740eefdf6d2bf459d72c7cc98..c61a089ee8345e85402ef652961a801dba787c23 100644 (file)
@@ -105,7 +105,11 @@ SET(SWIG_MODULE_SketchAPI_EXTRA_DEPS ${SWIG_MODULE_SketchAPI_EXTRA_DEPS}
   ${PROJECT_HEADERS}
 )
 
-SWIG_ADD_MODULE(SketchAPI python SketchAPI.i ${PROJECT_HEADERS})
+IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
+  SWIG_ADD_LIBRARY(SketchAPI LANGUAGE python SOURCES SketchAPI.i ${PROJECT_HEADERS})
+ELSE()
+  SWIG_ADD_MODULE(SketchAPI python SketchAPI.i ${PROJECT_HEADERS})
+ENDIF()
 SWIG_LINK_LIBRARIES(SketchAPI ${SWIG_LINK_LIBRARIES})
 
 IF(WIN32)
index e443e5f23109513393cccf5df9afe8ce03987698..0f76546eba007d67f21ebaf3117007e94fa32180 100644 (file)
@@ -27,7 +27,7 @@
   #include "ModelHighAPI_swig.h"
 
   // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
+  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
 %}
 
 %include "doxyhelp.i"
index 8f79cca41f8f79a91bda4b985d57ca91ba52b72c..2ad1650650635f2ec363d3bc1b2dc98c2be918a7 100644 (file)
@@ -46,8 +46,8 @@ public:
 
   static std::string ID()
   {
-    static const std::string DUMMY;
-    return DUMMY;
+    static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraint";
+    return MY_SKETCH_CONSTRAINT_ID;
   }
   virtual std::string getID() { return ID(); }
 
index 412c196051d6d0787b5aa69e3e60a0a51246656a..12493c5f1b3c3a2458b817f8aa3bd01a3ed3dd92 100644 (file)
@@ -258,13 +258,3 @@ if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
                TestMovementComplex.py
   )
 endif()
-
-# Copy data-files to corresponding directory
-file(GLOB DATA_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Test/Data/*")
-foreach(data_file ${DATA_FILES})
-  get_filename_component(data_file_name "${data_file}" NAME)
-  configure_file(
-    ${data_file}
-    ${CMAKE_CURRENT_BINARY_DIR}/Data/${data_file_name}
-    COPYONLY)
-endforeach()
index 6eea668e511d6ac943fb621b1380040e76e9829f..af9cc1f118ae3f4eb709b411f14a592af30cbd6f 100644 (file)
@@ -248,7 +248,7 @@ SketchConstraintVertical_11.setName("SketchConstraintVertical_12")
 model.do()
 
 sketchTime = timer() - sketchTime
-print "Sketch creation time: {0}".format(sketchTime)
+print("Sketch creation time: {0}".format(sketchTime))
 expectedTime = MOVE_BUILD_RATIO * sketchTime
 averageTime = 0
 nbMoves = 0
@@ -289,7 +289,7 @@ for ang in range(0, 50):
     nbMoves += 1
     aDeltaX = aEndPoint.x() - aCenter.x()
     aDeltaY = aEndPoint.y() - aCenter.y()
-print "Movement average time: {0}".format(averageTime / nbMoves)
+print("Movement average time: {0}".format(averageTime / nbMoves))
 
 model.end()
 
index a42983b7e146345224d183c3a61e720ce922b57f..8da4ac2dc943008b0fc1c39cb11ee1aa0f8cb447 100644 (file)
@@ -288,7 +288,7 @@ SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_37.result(), 0.088)
 model.do()
 
 sketchTime = timer() - sketchTime
-print "Sketch creation time: {0}".format(sketchTime)
+print("Sketch creation time: {0}".format(sketchTime))
 expectedTime = MOVE_BUILD_RATIO * sketchTime
 averageTime = 0
 nbMoves = 0
@@ -310,7 +310,7 @@ for deltaX, deltaY in deltas:
     assert math.fabs(aPoint.x() - X) < TOLERANCE and math.fabs(aPoint.y() - Y) < TOLERANCE, "({0}, {1}) != ({2}, {3})".format(aPoint.x(), aPoint.y(), X, Y)
     averageTime += movementTime
     nbMoves += 1
-print "Movement average time: {0}".format(averageTime / nbMoves)
+print("Movement average time: {0}".format(averageTime / nbMoves))
 
 #=========================================================================
 # Change value of SketchConstraintAngle_6 and check execution time.
@@ -329,7 +329,7 @@ for ang in range(12, 30):
     assert math.fabs(curAngle - ang) < TOLERANCE, "angle {0} != {1} expected".format(curAngle, ang)
     averageTime += movementTime
     nbMoves += 1
-print "Changing angle average time: {0}".format(averageTime / nbMoves)
+print("Changing angle average time: {0}".format(averageTime / nbMoves))
 
 model.end()
 
index ae9bfaf69446c7497d446c4779b26809893ff585..05c5a1b0b1e8633f48f47113c9cfdf35df1442d2 100644 (file)
@@ -267,7 +267,7 @@ SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), S
 model.do()
 
 sketchTime = timer() - sketchTime
-print "Sketch creation time: {0}".format(sketchTime)
+print("Sketch creation time: {0}".format(sketchTime))
 expectedTime = MOVE_BUILD_RATIO * sketchTime
 averageTime = 0
 nbMoves = 0
@@ -290,7 +290,7 @@ for deltaX, deltaY in deltas:
     averageTime += movementTime
     nbMoves += 1
 
-print "Movement average time: {0}".format(averageTime / nbMoves)
+print("Movement average time: {0}".format(averageTime / nbMoves))
 
 model.end()
 
index 0a0ba1bb146915de51b18b238aa95294f141ef65..eb4077a58aa7982d88ac726a95b843d8b0699a01 100644 (file)
@@ -30,11 +30,14 @@ from salome.shaper import model
 
 from math import fabs
 
+import os
+
 model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
-Import_1 = model.addImport(Part_1_doc, "Data/profile_top.brep")
+shape_path = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Brep", "profile_top.brep")
+Import_1 = model.addImport(Part_1_doc, shape_path)
 model.do()
 Import_1.setName("profile_top")
 Import_1.result().setName("profile_top_1")
index db20680aa714465bfbadd81d379bedb5e9432668..ad3921f041a79e3588a3dae397e9c12c9e54fa73 100644 (file)
@@ -92,8 +92,8 @@ kLineCEnd = (aLineCEndPoint.x(),   aLineCEndPoint.y())
 #=========================================================================
 # Link triange lines with concidence
 #=========================================================================
-concidenceLinks = zip([aLineBStartPoint, aLineCStartPoint, aLineAStartPoint],
-                      [aLineAEndPoint, aLineBEndPoint, aLineCEndPoint])
+concidenceLinks = list(zip([aLineBStartPoint, aLineCStartPoint, aLineAStartPoint],
+                      [aLineAEndPoint, aLineBEndPoint, aLineCEndPoint]))
 aSession.startOperation()
 for eachLink in concidenceLinks:
     aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence")
index befac2e273e9a4fe2ef3d48b8c52a4b706e89dc6..dc9c84bf7843a211bfcee010c3ee52faf1d7f089 100644 (file)
@@ -44,7 +44,7 @@ def createNAngle(theSketch, theN, theRadius, theEdgeLength=0):
     # Create an N-Angle at (0,0)
     rad = 2. * math.pi / theN
     points = []
-    for a in xrange(theN):
+    for a in range(theN):
         x = round(math.cos(rad * a), 10) * theRadius
         y = round(math.sin(rad * a), 10) * theRadius
         points.append((x, y))
@@ -126,8 +126,8 @@ aDOF = 0
 deltaX = deltaY = 50.
 n = 5
 aSession.startOperation()
-for i in xrange(4):
-    for j in xrange(4):
+for i in range(4):
+    for j in range(4):
         allNangleLines = createNAngle(aSketchFeature, n, 50)
         fixLineLength(aSketchFeature, allNangleLines)
         moveTo(allNangleLines, deltaX, deltaY)
index c51f35a83482361285fe462898724342265e2739..73d51f1e0fdc73c0b05b39527f4d43b763962ad7 100644 (file)
@@ -245,7 +245,7 @@ refAttrA.setAttr(anArcStartPoint)
 refAttrB.setAttr(aMirroredArcStartPoint)
 aConstraint.real("ConstraintValue").setValue(200.)
 aSession.finishOperation()
-print "Sketch error : {}".format(aSketchErrorAttr.value())
+print("Sketch error : {}".format(aSketchErrorAttr.value()))
 assert len(aSketchErrorAttr.value()) != 0, "ERROR: Sketch has not been failed as expected"
 aSession.startOperation()
 aDocument.removeFeature(aConstraint)
index c98b5a4dab8d5ac9a6cd339ab5fc33486f88fc3f..ebdcd2b11c67fcc0344da6ac7f053669aa4f8152 100644 (file)
@@ -81,7 +81,7 @@ def initContour(theNumLines):
     prevPoint = (35, 0)
     result = []
     deltaY = random.uniform(20, 25)
-    for i in xrange(1, theNumLines):
+    for i in range(1, theNumLines):
         rangeXMax = (prevPoint[1] + deltaY) * (30. / i if i % 2 != 0 else 2)
         newX = random.uniform(prevPoint[1] + deltaY,
                               max(rangeXMax, prevPoint[1] + deltaY + 25.))
@@ -102,9 +102,9 @@ def makeLinesCoincident(theSketch, allLines):
         anEndPointValue = (anEndPoint.x(), anEndPoint.y())
         allPoints[aStartPointValue].append(aStartPoint)
         allPoints[anEndPointValue].append(anEndPoint)
-    for keyPoint, valuePoints in allPoints.iteritems():
+    for keyPoint, valuePoints in allPoints.items():
         if len(valuePoints) != 2:
-            print "Strange point: ", keyPoint, "has in coincidence: ", len(valuePoints)
+            print("Strange point: ", keyPoint, "has in coincidence: ", len(valuePoints))
             continue
         aConstraint = theSketch.addFeature("SketchConstraintCoincidence")
         aConstraint.refattr("ConstraintEntityA").setAttr(valuePoints[0])
index 2139f14398e13b95a1124fb731447c1416b1795a..0c39997a7058674b373db10aba22cd44d9450d42 100644 (file)
@@ -41,14 +41,15 @@ void BrepGeometryTest::cleanUp()
 
 void readBrep(Geometry* geom, const std::string& fileName)
 {
-    char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath(fileName));
+    std::string filePath = "Shapes/Brep/" + fileName;
+    char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath(filePath));
     geom->setShapeString(txt);
 }
 
 void BrepGeometryTest::testGetIDs()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_1.brep");
+    readBrep(geom, "box1.brep");
 
     CPPUNIT_ASSERT_EQUAL(8, geom->countElements(XAO::VERTEX));
     CPPUNIT_ASSERT_EQUAL(8, geom->countVertices());
@@ -78,7 +79,7 @@ void BrepGeometryTest::testGetIDs()
 void BrepGeometryTest::testGetReferences()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_1.brep");
+    readBrep(geom, "box1.brep");
 
     // vertex of index 1 has id = 7
     CPPUNIT_ASSERT_EQUAL(std::string("7"), geom->getElementReference(XAO::VERTEX, 1));
@@ -114,7 +115,7 @@ void BrepGeometryTest::testGetReferences()
 void BrepGeometryTest::testGetNames()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_1.brep");
+    readBrep(geom, "box1.brep");
 
     int id;
 
@@ -156,7 +157,7 @@ void BrepGeometryTest::testGetNames()
 void BrepGeometryTest::testGetEdgeVertices()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
 
     // edge of index 23, id = #63
     // vertex are 47 (#12), 59 (#15)
@@ -179,7 +180,7 @@ void printVector(std::vector<int>& v)
 void BrepGeometryTest::testGetFaceEdges()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
 
     CPPUNIT_ASSERT_EQUAL(2, geom->countFaceWires(1)); // face 13
     CPPUNIT_ASSERT_EQUAL(1, geom->countFaceWires(2)); // face 29
@@ -204,7 +205,7 @@ void BrepGeometryTest::testGetFaceEdges()
 void BrepGeometryTest::testSolidFaces()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Cut_2.brep");
+    readBrep(geom, "cut.brep");
 
     CPPUNIT_ASSERT_EQUAL(5, geom->countSolidShells(0));
 
@@ -226,7 +227,7 @@ void BrepGeometryTest::testSolidFaces()
 void BrepGeometryTest::testGetVertex()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
 
     double x, y, z;
     geom->getVertexXYZ(15, x, y, z);
@@ -240,7 +241,7 @@ void BrepGeometryTest::testGetVertex()
 void BrepGeometryTest::testGetEdgeLength()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
 
     // edges 0 (#5), 7 (#21)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(200., geom->getEdgeLength(0), 0);
@@ -252,7 +253,7 @@ void BrepGeometryTest::testGetEdgeLength()
 void BrepGeometryTest::testGetFaceArea()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
 
     // faces 0 (#3), 1 (#13)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(40000., geom->getFaceArea(0), 1e-9);
@@ -264,7 +265,7 @@ void BrepGeometryTest::testGetFaceArea()
 void BrepGeometryTest::testGetSolidVolume()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
 
     CPPUNIT_ASSERT_DOUBLES_EQUAL(7488000., geom->getSolidVolume(0), 1e-9);
 
@@ -274,7 +275,7 @@ void BrepGeometryTest::testGetSolidVolume()
 void BrepGeometryTest::testParse()
 {
     BrepGeometry* geom = new BrepGeometry("box");
-    readBrep(geom, "Box_2.brep");
+    readBrep(geom, "box2.brep");
     std::cout << std::endl;
 
     for (int solidIndex = 0; solidIndex < geom->countSolids(); ++solidIndex)
index f9bcd7bc7f21e9a78d2e00ba22a376e1d48bba5b..87a37cf4623a1608ba57f4b399759e3c36b2f6be 100644 (file)
@@ -135,7 +135,7 @@ void GeometryTest::testSetElement()
 
     CPPUNIT_ASSERT_THROW(geom->setVertexName(0, "aa"), XAO_Exception);
 
-    char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Box_1.brep"));
+    char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Shapes/Brep/box1.brep"));
     geom->setShapeString(txt);
 
     CPPUNIT_ASSERT_EQUAL(false, geom->hasVertexName(0));
index 2c060200edd4669ce9509d9438690aaa8c8040f2..75f17d74c1f2ca02bfff7f732d25cf3885dda8a3 100644 (file)
@@ -122,13 +122,13 @@ void ImportExportTest::testGeometryError()
 void ImportExportTest::testImportXao()
 {
     Xao xao;
-    xao.importXAO(TestUtils::getTestFilePath("test.xao"));
+    xao.importXAO(TestUtils::getTestFilePath("Shapes/Xao/box1.xao"));
     checkImport(xao);
 }
 
 void ImportExportTest::testImportXaoFromText()
 {
-    char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("test.xao"));
+    char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Shapes/Xao/box1.xao"));
 
     Xao xao;
     xao.setXML(txt);
index 593916c2279b34fa3ad76e4b8618a034765ee5ba..aa1f5d104ba3eb33044f77234de257af525926a5 100644 (file)
@@ -28,11 +28,10 @@ namespace XAO
     class TestUtils
     {
     public:
-        static std::string getTestFilePath(const std::string& fileName)
+        static std::string getTestFilePath(const std::string& filePath)
         {
-            std::string dataDir = getenv("GEOM_SRC_DIR");
-            dataDir += "/src/XAO/tests/data/";
-            dataDir += fileName;
+            std::string dataDir = getenv("DATA_DIR");
+            dataDir += filePath;
             return dataDir;
         }
 
index 3073bf450d83146ead97e6151fff677a75850fc2..da67a6bbb2aaa4fa7e886977f0db35d9d19e3d79 100644 (file)
@@ -373,11 +373,14 @@ void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject
       continue;
 
     Handle(SelectMgr_Selection) aSelection = theObject->Selection(aMode);
-    for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
-      Handle(SelectMgr_SensitiveEntity) anEntity = aSelection->Sensitive();
+    NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> anEntities = aSelection->Entities();
+    for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIt(anEntities);
+        anIt.More();
+        anIt.Next()) {
+      Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
       if (anEntity.IsNull())
         continue;
-      Handle(SelectMgr_EntityOwner) anOwner =
+       Handle(SelectMgr_EntityOwner) anOwner =
         Handle(SelectMgr_EntityOwner)::DownCast(anEntity->BaseSensitive()->OwnerId());
       if (!anOwner.IsNull())
         theOwners.Add(anOwner);
index fde6fef284291a73332b94f4fea20d7c509ba248..6b6205fabdd01e4dabf03fb86a57c4c14085b6fd 100644 (file)
@@ -32,40 +32,40 @@ CS7 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,0.,360.)
 
 try :
     CS8 = shaperpy.makeConeSegment(-5.,11.,5.,8.,12.,0.,270.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: rmin1 is negative.")
 
 try :
     CS9 = shaperpy.makeConeSegment(11.,7.,5.,8.,12.,0.,270.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: rmin1 is larger than rmax1.")
 
 try :
     CS10 = shaperpy.makeConeSegment(7.,11.,8.,5.,12.,0.,270.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: rmin2 is larger than rmax2.")
 
 try :
     CS11 = shaperpy.makeConeSegment(7.,11.,-3.,5.,12.,0.,270.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: rmin2 is negative.")
 
 try :
     CS12 = shaperpy.makeConeSegment(7.,11.,5.,8.,0.,0.,270.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: z is negative or null.")
 
 try :
     CS13 = shaperpy.makeConeSegment(7.,11.,5.,8.,-10.,0.,270.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: z is negative or null.")
 
 try :
     CS14 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,-45.,-45.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: deltaphi is negative or null.")
 
 try :
     CS15 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,45.,450.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Cone Segment builder :: deltaphi is larger than 360 degree.")
\ No newline at end of file
index 8b24b80494b19cbff63c8b7ccf78e17e55d01a26..8ea9d29dc2ac578474ef6a5b76d1f3b048398bc8 100644 (file)
@@ -27,32 +27,32 @@ Box_1 = shaperpy.makeBox(10.,10.,10.)
 
 try :
   Box_2 = shaperpy.makeBox(0.,10.,10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
 
 try :
   Box_3 = shaperpy.makeBox(10.,0.,10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
 
 try :
   Box_4 = shaperpy.makeBox(10.,10.,0.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
 
 try :
   Box_5 = shaperpy.makeBox(-10.,10.,10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
 
 try :
   Box_6 = shaperpy.makeBox(10.,-10.,10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
 
 try :
   Box_7 = shaperpy.makeBox(10.,10.,-10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
 
 # Create a box with two points defining the diagonal
@@ -62,33 +62,33 @@ Box_8 = shaperpy.makeBox(pnt1,pnt2)
 
 try :
   Box_9 = shaperpy.makeBox(pnt1,pnt1)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with points :: the distance between the two points is null.")
 
 try :
   pnt3 = pnt(0.,50.,50.)
   Box_10 = shaperpy.makeBox(pnt1,pnt3)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
 
 try :
   pnt4 = pnt(50.,0.,50.)
   Box_11 = shaperpy.makeBox(pnt1,pnt4)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
 
 try :
   pnt5 = pnt(50.,50.,0.)
   Box_12 = shaperpy.makeBox(pnt1,pnt5)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
 
 try :
   Box_13 = shaperpy.makeBox(None, pnt2)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with points :: the first point is not valid.")
 
 try :
   Box_14 = shaperpy.makeBox(pnt2, None)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Box builder with points :: the second point is not valid.")
\ No newline at end of file
index f6862ab88afd2c3c536fd2a1adfff58ad94b684c..95cb08f9520cb2aaaf5edc087f987f15d0d5e0d1 100644 (file)
@@ -46,32 +46,32 @@ Cylinder_3 = shaperpy.makeCylinder(pnt2, edg1, 7., 12.)
 
 try:
   Cylinder_4 = shaperpy.makeCylinder(0., 10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: radius is negative or null.")
 
 try:
   Cylinder_5 = shaperpy.makeCylinder(-5., 10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: radius is negative or null.")
 
 try:
   Cylinder_6 = shaperpy.makeCylinder(5., 0.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: height is negative or null.")
 
 try:
   Cylinder_7 = shaperpy.makeCylinder(5., -10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: height is negative or null.")
 
 try:
   Cylinder_8 = shaperpy.makeCylinder(None, edgz, 5., 10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: the base point is not valid.")
 
 try:
   Cylinder_9 = shaperpy.makeCylinder(pnt1, None, 5., 10.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: the axis is not valid.")
 
 Cylinder_14 = shaperpy.makeCylinder(5., 10., 45.)
@@ -81,45 +81,45 @@ Cylinder_17 = shaperpy.makeCylinder(pnt2, edgy, 5., 10., 360.)
 
 try:
   Cylinder_18 = shaperpy.makeCylinder(0., 10., 45.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: radius is negative or null.")
 
 try:
   Cylinder_19 = shaperpy.makeCylinder(-5., 10., 45.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: radius is negative or null.")
 
 try:
   Cylinder_20 = shaperpy.makeCylinder(5., 0., 45.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: height is negative or null.")
 
 try:
   Cylinder_21 = shaperpy.makeCylinder(5., -10., 45.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: height is negative or null.")
 
 try:
   Cylinder_22 = shaperpy.makeCylinder(5., 10., 0.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: angle is negative or null.")
 
 try:
   Cylinder_23 = shaperpy.makeCylinder(5., 10., -45.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: angle is negative or null.")
 
 try:
   Cylinder_24 = shaperpy.makeCylinder(5., 10., 450.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: angle greater than 360 degrees.")
 
 try:
   Cylinder_25 = shaperpy.makeCylinder(None, edgz, 5., 10., 90.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: the base point is not valid.")
 
 try:
   Cylinder_26 = shaperpy.makeCylinder(pnt1, None, 5., 10., 90.)
-except myExcept,ec:
+except myExcept as ec:
   assert(ec.what() == "Cylinder builder :: the axis is not valid.")
\ No newline at end of file
index 2195df285810ec7493429e06b4129ba4eb1da6ff..0a3ac761925f4a846088b0b865c4af39edd167ee 100644 (file)
@@ -51,7 +51,7 @@ MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_2, ax1, -15., 5)
 
 try:
     MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_3, ax1, 15., -2)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.")
 
 MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_5, ax1, 10., 5, ax2, 10., 5)
@@ -66,7 +66,7 @@ MultiTranslation_6 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 5, ax2, -10.
 # Pas d'exception levee alors qu'une devrait y en avoir une
 try:
     MultiTranslation_7 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 5, ax2, 10., -2)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Multitranslation builder :: the number of copies for the second direction is null or negative.")
 
 #try:
index 5b080048488b171e6eb6d12c0145042542c256bc..1e9323572fd0799746e25dc9cfef4d4e45913cd1 100644 (file)
@@ -58,22 +58,22 @@ Rotation_4 = shaperpy.makeRotation(Box_4, ax1, -360)
 
 try:
     Rotation_5 = shaperpy.makeRotation(Box_5, ax1, 450)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: angle greater than 360 degrees.")
 
 try:
     Rotation_6 = shaperpy.makeRotation(Box_6, ax1, -450)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: angle smaller than -360 degrees.")
 
 try:
     Rotation_7 = shaperpy.makeRotation(Box_7, None, 180)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: axis is not valid.")
 
 try:
     Rotation_8 = shaperpy.makeRotation(None, ax1, 180)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: source shape is not valid.")
 
 Rotation_9 = shaperpy.makeRotation(Box_8, pntOrigin, pnt1, pnt2)
@@ -81,35 +81,35 @@ Rotation_10 = shaperpy.makeRotation(Box_9, pnt3, pnt1, pnt2)
 
 try:
     Rotation_11 = shaperpy.makeRotation(Box_10, pnt3, pnt1, pnt1)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: start point and end point coincide.")
 
 try:
     Rotation_12 = shaperpy.makeRotation(Box_11, pnt3, pnt3, pnt1)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: center point and start point coincide.")
 
 try:
     Rotation_13 = shaperpy.makeRotation(Box_12, pnt3, pnt1, pnt3)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: center point and end point coincide.")
 
 try:
     Rotation_14 = shaperpy.makeRotation(Box_13, pntOrigin, pnt1, None)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: end point is not valid.")
 
 try:
     Rotation_15 = shaperpy.makeRotation(Box_14, None, pnt3, pnt2)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: center point is not valid.")
 
 try:
     Rotation_16 = shaperpy.makeRotation(Box_15, pntOrigin, None, pnt1)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: start point is not valid.")
 
 try:
     Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Rotation builder :: source shape is not valid.")
index 2904d5bd48d8330a4dd4906d03b572449a637c99..8fc2c52449a0f10ecb08347570a6b6a16dd6e095 100644 (file)
@@ -46,14 +46,14 @@ Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.)
 Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.)
 try :
     Scale_6 = shaperpy.makeScale(Box_3, pntOrigin, 0)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Scale builder :: the scale factor is null.")
 
 Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.)
 
 try :
     Scale_8 = shaperpy.makeScale(Box_5, None, 2.)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Scale builder :: center point is not valid.")
 
 Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2., 3., 1.)
@@ -61,20 +61,20 @@ Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2., 3., 1.)
 
 try :
     Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0., 3., 1.)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Scale builder :: the scale factor in X is null.")
 try :
     Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2., 0., 1.)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Scale builder :: the scale factor in Y is null.")
 try :
     Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2., 3., 0.)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Scale builder :: the scale factor in Z is null.")
 
 Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5)
 
 try :
     Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Scale builder :: center point is not valid.")
\ No newline at end of file
index 0e0110fa38641a6285472cc0db77c519668fcdeb..6356d227ff47461a8aea6fbcc464029a9b1c04d7 100644 (file)
@@ -64,7 +64,7 @@ Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1)
 
 try :
     Symmetry_6 = shaperpy.makeSymmetry(Box_2, None)
-except myExcept,ec :
+except myExcept as ec :
     assert(ec.what() == "Symmetry builder :: point is not valid.")
 
 Symmetry_7 = shaperpy.makeSymmetry(Box_7, axZ)
index 376f12497500a794689f06eaa9c4f76774b9330d..1d6a18c1f987085a7dcd2ada52a7b7191c78dbd8 100644 (file)
@@ -69,7 +69,7 @@ Translation_3 = shaperpy.makeTranslation(Box_3, ax1, -15.)
 
 try:
     Translation_4 = shaperpy.makeTranslation(Box_4, None, 15.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Translation builder :: axis is not valid.")
 
 Translation_9 = shaperpy.makeTranslation(Box_5, ax4, 15.)
@@ -86,7 +86,7 @@ Translation_12 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.)
 MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_9, ax1, 15., 3, ax2, 15., 3)
 try:
     Translation_13 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Translation builder :: axis is not valid.")
 
 MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_10, ax1, 15., 3, ax2, 15., 3)
@@ -106,15 +106,15 @@ Translation_99 = shaperpy.makeTranslation(Box_11, pnt1, pnt2)
 
 try:
     Translation_100 = shaperpy.makeTranslation(Box_11, pnt1, pnt1)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Translation builder :: start point and end point coincide.")
 
 try:
     Translation_101 = shaperpy.makeTranslation(Box_11, None, pnt1)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Translation builder :: start point is not valid.")
 
 try:
     Translation_102 = shaperpy.makeTranslation(Box_11, pnt1, None)
-except myExcept,ec:
+except myExcept as ec:
     assert(ec.what() == "Translation builder :: end point is not valid.")
\ No newline at end of file
index c67df289036f0dc2c96c92cfb325cf5d0d7e0ec7..93d49269c0570d8593077807664f16bc9be9697c 100644 (file)
@@ -36,7 +36,7 @@
 # See the section 'Performing Actions During Test Execution Via Hooks' in the Squish
 # manual for a complete reference of the available API.
 
-import __builtin__
+import builtins
 
 # Detach (i.e. potentially terminate) all AUTs at the end of a scenario
 @OnScenarioEnd
index 81e103f7fcf5e798918b6fc7e10b598f8284b6da..77b413af51da8fe868c67311c19cadf2a653ba3f 100644 (file)
@@ -48,7 +48,7 @@
 # specified. In that case, make sure to set the (optional) 'regexp' argument
 # to True.
 
-import __builtin__
+import builtins
 
 @Given("Launch application in salome mode")
 def step(context):
index 847f242d81ecdce849209e89b79d84495fa556f3..5e811fd40c9e91bfc9b5cc858ec088e0c20f6ad3 100644 (file)
--- a/utils.py
+++ b/utils.py
@@ -26,8 +26,8 @@ import os, os.path
 SHAPER_SRC = os.environ['PWD']
 # VERBOSE_FLAG = os.environ['VERBOSE_FLAG']
 VERBOSE_FLAG = ""
-ENCODING = u"utf-8"
-OPERATORS=[u">", u"<", u"+", u"=", u"-", u"*", u"/"]
+ENCODING = "utf-8"
+OPERATORS=[">", "<", "+", "=", "-", "*", "/"]
 
 def create_warning_generator(fichier):
        """
@@ -40,14 +40,14 @@ def create_warning_generator(fichier):
        while ligne.strip("\n") :
                ligne = ligne.decode(ENCODING)
                liste = ligne.split(":")
-               print "Size of liste = ", len(liste)
-               print "ligne = ", ligne
-               print "n° ligne = ", i
-               print "XXX : ", ligne.find(u'Done processing ')
+               print("Size of liste = ", len(liste))
+               print("ligne = ", ligne)
+               print("n° ligne = ", i)
+               print("XXX : ", ligne.find('Done processing '))
 
                if len(liste) < 3:
-                       if ligne.find(u'Done processing ') == -1 and ligne.find(u'Category ') == -1 and ligne.find(u'Total errors found: ') == -1:
-                               raise Exception(u"Fichier de log mal formé")
+                       if ligne.find('Done processing ') == -1 and ligne.find('Category ') == -1 and ligne.find('Total errors found: ') == -1:
+                               raise Exception("Fichier de log mal formé")
                        else:
                                ligne = fichier.readline()
                                i += 1
@@ -55,12 +55,12 @@ def create_warning_generator(fichier):
                elif len(liste) != 3:
                        item1=liste[0]
                        item2=liste[1]
-                       merge = u""
-                       sep = u""
+                       merge = ""
+                       sep = ""
                        for item in liste[2:]:
                                merge += sep
                                merge += item
-                               sep = u":"
+                               sep = ":"
                        liste = [item1, item2, merge]
                ligne = fichier.readline()
                i += 1
@@ -73,7 +73,7 @@ def get_line_no(path, nol):
        """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode"""
        ligne = ""
        fic = open(get_src_path(path), "r")
-       for i in xrange(nol):
+       for i in range(nol):
                ligne = fic .readline()
        fic.close()
        ligne_u = ligne.decode(ENCODING)