X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Ftui%2Fpythfilter.py;h=0543c99514d4f0849bfe5ffa805d317e928ead9a;hb=cca842065fd2bb93bae7ed6c32a7de16b06f94d9;hp=98e420e0e90a1881cdb480f1a95d1b3ca233085d;hpb=e6bfea36374791cd31c274a2f97df90dc60ddaf3;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 98e420e0e..0543c9951 --- a/doc/salome/tui/pythfilter.py +++ b/doc/salome/tui/pythfilter.py @@ -1,22 +1,26 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT +#!/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 +# # 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 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 +# 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 +# +# 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 +# import getopt import glob @@ -333,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)] != '__' \ @@ -341,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) @@ -423,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") @@ -474,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,"*") @@ -503,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 @@ -523,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 @@ -541,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: @@ -560,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))