]> SALOME platform Git repositories - tools/medcoupling.git/blob - v8_work/ModifyNamespace.py
Salome HOME
Merge branch 'V9_11_BR'
[tools/medcoupling.git] / v8_work / ModifyNamespace.py
1 # Copyright (C) 2016-2023  CEA, EDF
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 import os
21 rep=("namespace ParaMEDMEM","namespace MEDCoupling")
22 rep=("ParaMEDMEM::","MEDCoupling::")
23 #rep=("ParaMEDMEMImpl::","MEDCouplingImpl::")
24
25 #rep=("_ParaMEDMEM__","_MEDCoupling__")
26 #rep=("ParaMEDMEM_","MEDCoupling_")
27 #rep=("ParaMEDMEMData","MEDCouplingData")
28
29 #rep=("ParaMEDMEM_1","MEDCoupling_1")
30
31 def rep0(fi,rep):
32     f=file(fi) ; lines=f.readlines() ; del f
33     lines2=[line.replace(*rep) for line in lines]
34     if lines2!=lines:
35         f=file(fi,"w") ; f.writelines(lines2) ; f.flush()
36         return 1
37     else:
38         return 0
39
40 def rep1(dirname,rep):
41     i=0
42     for fi in os.listdir(dirname):
43         fi2=os.path.join(dirname,fi)
44         if not os.path.isfile(fi2):
45             continue
46         i+=rep0(fi2,rep)
47     return i
48
49 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"]
50 dirname=dirs[-1]
51 i=0
52 print(rep1(dirname,rep))
53 """for r,dirs,fis in os.walk(dirname):
54     for fi in fis:
55         if os.path.splitext(fi)[1] not in [".dox",".doxy"]:
56             continue
57         i+=rep0(os.path.join(r,fi),rep)
58
59 print i"""