3 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
5 ## This library is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU Lesser General Public
7 ## License as published by the Free Software Foundation; either
8 ## version 2.1 of the License, or (at your option) any later version.
10 ## This library is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## Lesser General Public License for more details.
15 ## You should have received a copy of the GNU Lesser General Public
16 ## License along with this library; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ## See http:##www.salome-platform.org/ or
20 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
25 #SHAPER_SRC = os.environ['SHAPER_SRC']
26 SHAPER_SRC = os.environ['PWD']
27 # VERBOSE_FLAG = os.environ['VERBOSE_FLAG']
30 OPERATORS=[">", "<", "+", "=", "-", "*", "/"]
32 def create_warning_generator(fichier):
34 fichier est le fichier de log cpplint ouvert à la position courante.
35 Un trou dans le fichier résulte en l'arrêt de la génération
38 ligne = fichier.readline()
40 while ligne.strip("\n") :
41 ligne = ligne.decode(ENCODING)
42 liste = ligne.split(":")
43 print("Size of liste = ", len(liste))
44 print("ligne = ", ligne)
45 print("n° ligne = ", i)
46 print("XXX : ", ligne.find('Done processing '))
49 if ligne.find('Done processing ') == -1 and ligne.find('Category ') == -1 and ligne.find('Total errors found: ') == -1:
50 raise Exception("Fichier de log mal formé")
52 ligne = fichier.readline()
60 for item in liste[2:]:
64 liste = [item1, item2, merge]
65 ligne = fichier.readline()
67 yield liste[0], int(liste[1]), liste[2]
69 def get_src_path(path):
70 return os.path.normpath(os.path.join(SHAPER_SRC, path))
72 def get_line_no(path, nol):
73 """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode"""
75 fic = open(get_src_path(path), "r")
77 ligne = fic .readline()
79 ligne_u = ligne.decode(ENCODING)
82 def fic_readlines(fic):
86 liste.append(ligne.decode(ENCODING))
89 def fic_writelines(liste):
92 liste2.append(ligne.encode(ENCODING))