X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=v8_work%2FModifyNamespace.py;h=a3c41fee827d272b79aebbd4b2637d26aa262288;hb=8d65b3fe9fcfb3f41dadfe696f3853bfcc2d1cdf;hp=439a4acc44b99cae9b7f91ee14e91e96bf685438;hpb=c8d33262ed6d2041da8512b02f8c8b4ffadf733d;p=tools%2Fmedcoupling.git diff --git a/v8_work/ModifyNamespace.py b/v8_work/ModifyNamespace.py index 439a4acc4..a3c41fee8 100644 --- a/v8_work/ModifyNamespace.py +++ b/v8_work/ModifyNamespace.py @@ -1,23 +1,59 @@ +# Copyright (C) 2016-2019 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# 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 os -#rep=("namespace ParaMEDMEM","namespace MEDCoupling") -#rep=("ParaMEDMEM::","MEDCoupling::") +rep=("namespace ParaMEDMEM","namespace MEDCoupling") +rep=("ParaMEDMEM::","MEDCoupling::") #rep=("ParaMEDMEMImpl::","MEDCouplingImpl::") #rep=("_ParaMEDMEM__","_MEDCoupling__") #rep=("ParaMEDMEM_","MEDCoupling_") #rep=("ParaMEDMEMData","MEDCouplingData") -dirs=["MEDCoupling","MEDCoupling/Test","MEDLoader","MEDLoader/Swig","MEDLoader/Test","MEDPartitioner","MEDPartitioner/Test","MEDPartitioner_Swig","RENUMBER","RENUMBER_Swig","INTERP_KERNELTest","ParaMEDMEM","ParaMEDLoader","ParaMEDMEMTest","ParaMEDMEM_Swig"] -dirname=dirs[-1] -i=0 -for fi in os.listdir(dirname): - fi2=os.path.join(dirname,fi) - if not os.path.isfile(fi2): - continue - f=file(fi2) ; lines=f.readlines() ; del f + +#rep=("ParaMEDMEM_1","MEDCoupling_1") + +def rep0(fi,rep): + f=file(fi) ; lines=f.readlines() ; del f lines2=[line.replace(*rep) for line in lines] if lines2!=lines: - i+=1 - f=file(fi2,"w") ; f.writelines(lines2) ; f.flush() - pass + f=file(fi,"w") ; f.writelines(lines2) ; f.flush() + return 1 + else: + return 0 + +def rep1(dirname,rep): + i=0 + for fi in os.listdir(dirname): + fi2=os.path.join(dirname,fi) + if not os.path.isfile(fi2): + continue + i+=rep0(fi2,rep) + return i + +dirs=["MEDCoupling","MEDCoupling/Test","MEDLoader","MEDLoader/Swig","MEDLoader/Test","MEDPartitioner","MEDPartitioner/Test","MEDPartitioner_Swig","RENUMBER","RENUMBER_Swig","INTERP_KERNELTest","ParaMEDMEM","ParaMEDLoader","ParaMEDMEMTest","ParaMEDMEM_Swig","doc/user/doxygen/fakesources","doc/user/doxygen/doxy2swig","doc/user/doxygen/doxfiles","/home/H87074/salome/DEV/modules/src/MED/src/MEDCouplingCorba","/home/H87074/salome/DEV/modules/src/MED/src/MEDCouplingCorba/Client","/home/H87074/salome/DEV/modules/src/MED/src/MEDCouplingCorba/Test","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalc/cmp","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalculator","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalculator/Swig","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalculator/Test","/home/H87074/salome/DEV/modules/src/PARAVIS/src/Plugins/MEDReader/IO"] +dirname=dirs[-1] +i=0 +print(rep1(dirname,rep)) +"""for r,dirs,fis in os.walk(dirname): + for fi in fis: + if os.path.splitext(fi)[1] not in [".dox",".doxy"]: + continue + i+=rep0(os.path.join(r,fi),rep) -print i +print i"""