3 # Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
24 #SHAPER_SRC = os.environ['SHAPER_SRC']
25 SHAPER_SRC = os.environ['PWD']
26 # VERBOSE_FLAG = os.environ['VERBOSE_FLAG']
29 OPERATORS=[">", "<", "+", "=", "-", "*", "/"]
31 def create_warning_generator(fichier):
33 fichier est le fichier de log cpplint ouvert à la position courante.
34 Un trou dans le fichier résulte en l'arrêt de la génération
37 ligne = fichier.readline()
39 while ligne.strip("\n") :
40 ligne = ligne.decode(ENCODING)
41 liste = ligne.split(":")
42 print("Size of liste = ", len(liste))
43 print("ligne = ", ligne)
44 print("n° ligne = ", i)
45 print("XXX : ", ligne.find('Done processing '))
48 if ligne.find('Done processing ') == -1 and ligne.find('Category ') == -1 and ligne.find('Total errors found: ') == -1:
49 raise Exception("Fichier de log mal formé")
51 ligne = fichier.readline()
59 for item in liste[2:]:
63 liste = [item1, item2, merge]
64 ligne = fichier.readline()
66 yield liste[0], int(liste[1]), liste[2]
68 def get_src_path(path):
69 return os.path.normpath(os.path.join(SHAPER_SRC, path))
71 def get_line_no(path, nol):
72 """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode"""
74 fic = open(get_src_path(path), "r")
76 ligne = fic .readline()
78 ligne_u = ligne.decode(ENCODING)
81 def fic_readlines(fic):
85 liste.append(ligne.decode(ENCODING))
88 def fic_writelines(liste):
91 liste2.append(ligne.encode(ENCODING))