X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Ftui%2Fpythfilter.py;h=0543c99514d4f0849bfe5ffa805d317e928ead9a;hb=cca842065fd2bb93bae7ed6c32a7de16b06f94d9;hp=4a7f180c2c143626c37ed4f80850e4b7ae5e5c35;hpb=7d2fe213bdf5bf962ce11e253020c9d3e0bc1cce;p=modules%2Fkernel.git diff --git a/doc/salome/tui/pythfilter.py b/doc/salome/tui/pythfilter.py old mode 100644 new mode 100755 index 4a7f180c2..0543c9951 --- a/doc/salome/tui/pythfilter.py +++ b/doc/salome/tui/pythfilter.py @@ -1,26 +1,27 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +#!/usr/bin/env python3 +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE # -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# 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. +# 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. +# 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 +# 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 -# -#!/usr/bin/env python +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + import getopt import glob import os.path @@ -336,7 +337,7 @@ def tok_eater(type, tok, spos, epos, line): s = 'static ' if params[0] == 'cls': param = string.join(params[1:], ",") - s = s+name+"("+param+");\n" + s = s+name+"("+param+");\n" if len(name) > 1 \ and name[0:2] == '__' \ and name[len(name)-2:len(name)] != '__' \ @@ -344,7 +345,7 @@ def tok_eater(type, tok, spos, epos, line): private_member = True output(" private:\n",(def_spos[0]+2,def_spos[1])) else: - s = name+"("+param+");\n" + s = name+"("+param+");\n" if (doc_string!=""): comment_block.append(doc_string) print_comment(def_spos) output(s,def_spos) @@ -426,12 +427,12 @@ def filterFile(filename, out=sys.stdout): root,ext = os.path.splitext(filename) if ext==".py": - filter(filename) + list(filter(filename)) else: dump(filename) sys.stderr.write("OK\n") - except IOError,e: + except IOError as e: sys.stderr.write(e[1]+"\n") @@ -477,7 +478,7 @@ def convert(srcpath, destpath): namespace=namespace+"::"+os.path.split(srcpath)[1] else: namespace=os.path.split(srcpath)[1] - print "It's a package:",namespace + print("It's a package:",namespace) sp = os.path.join(srcpath,"*") sfiles = glob.glob(sp) dp = os.path.join(destpath,"*") @@ -506,7 +507,7 @@ def convert(srcpath, destpath): destfile = os.path.join(destpath,basename) if destfile==srcfile: - print "WARNING: Input and output names are identical!" + print("WARNING: Input and output names are identical!") sys.exit(1) count+=1 @@ -526,12 +527,12 @@ def convert(srcpath, destpath): try: shutil.rmtree(dname) except: - print "Can't remove obsolete directory '%s'"%dname + print("Can't remove obsolete directory '%s'"%dname) else: try: os.remove(dname) except: - print "Can't remove obsolete file '%s'"%dname + print("Can't remove obsolete file '%s'"%dname) return count @@ -544,8 +545,8 @@ filter_file = False try: opts, args = getopt.getopt(sys.argv[1:], "hf", ["help"]) -except getopt.GetoptError,e: - print e +except getopt.GetoptError as e: + print(e) sys.exit(1) for o,a in opts: @@ -563,6 +564,6 @@ else: sys.exit(1) # Filter an entire Python source tree - print '"%s" -> "%s"\n'%(args[0],args[1]) + print('"%s" -> "%s"\n'%(args[0],args[1])) c=convert(args[0],args[1]) - print "%d files"%(c) + print("%d files"%(c))