X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=doc%2Fsalome%2Fgui%2FSMESH%2Fmerge_mesh_class.py;h=9c8aa4b3dbc558c598c3bfd7f7d014887fe314ba;hp=dd9806b52d344ce344d9cedf98dc32b15694167d;hb=0fc0831670e27a5611b941c52dc152fd63964515;hpb=f0f67c0b47e58361bc50c7169734da604fbfca01 diff --git a/doc/salome/gui/SMESH/merge_mesh_class.py b/doc/salome/gui/SMESH/merge_mesh_class.py old mode 100644 new mode 100755 index dd9806b52..9c8aa4b3d --- a/doc/salome/gui/SMESH/merge_mesh_class.py +++ b/doc/salome/gui/SMESH/merge_mesh_class.py @@ -1,3 +1,22 @@ +#!/usr/bin/env python3 +# Copyright (C) 2017-2020 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# import inspect import sys from types import FunctionType @@ -12,14 +31,14 @@ def main(module_name, output_file = "smeshBuilder.py"): dynamic_module_name = module_name + DYNAMIC_MODULE_SUFFIX try: exec( "import %s" % oringin_module_name ) - exec( "origin_module = %s" % oringin_module_name ) + origin_module = locals()[ oringin_module_name ] origin_module_lines = inspect.getsourcelines( origin_module )[0] origin_meshClass_lines = inspect.getsourcelines(origin_module.Mesh)[0] origin_module_text = "".join( origin_module_lines ) origin_meshClass_text = "".join( origin_meshClass_lines ) exec( "import %s" % dynamic_module_name ) - exec( "dynanmic_module = %s" % dynamic_module_name ) + dynanmic_module = locals()[ dynamic_module_name ] dynanmic_meshClass = dynanmic_module.Mesh new_meshClass_lines = copy.copy(origin_meshClass_lines) @@ -30,7 +49,7 @@ def main(module_name, output_file = "smeshBuilder.py"): dynanmic_meshClass_methods = [x for x, y in dynanmic_meshClass.__dict__.items() if type(y) == FunctionType] for method in dynanmic_meshClass_methods: exec( "method_lines = inspect.getsourcelines(dynanmic_module.Mesh.%s)[0]" % method) - new_meshClass_lines+=method_lines + new_meshClass_lines+=locals()['method_lines'] pass new_meshClass_text = "".join( new_meshClass_lines ) @@ -38,8 +57,8 @@ def main(module_name, output_file = "smeshBuilder.py"): f.write( origin_module_text.replace( origin_meshClass_text, new_meshClass_text) ) f.close() - except Exception, e: - print e + except Exception as e: + print(e) pass pass