4 #SHAPER_SRC = os.environ['SHAPER_SRC']
5 SHAPER_SRC = os.environ['PWD']
6 # VERBOSE_FLAG = os.environ['VERBOSE_FLAG']
9 OPERATORS=[u">", u"<", u"+", u"=", u"-", u"*", u"/"]
11 def create_warning_generator(fichier):
13 fichier est le fichier de log cpplint ouvert à la position courante.
14 Un trou dans le fichier résulte en l'arrêt de la génération
17 ligne = fichier.readline()
19 while ligne.strip("\n") :
20 ligne = ligne.decode(ENCODING)
21 liste = ligne.split(":")
22 print "Size of liste = ", len(liste)
23 print "ligne = ", ligne
24 print "n° ligne = ", i
25 print "XXX : ", ligne.find(u'Done processing ')
28 if ligne.find(u'Done processing ') == -1 and ligne.find(u'Category ') == -1 and ligne.find(u'Total errors found: ') == -1:
29 raise Exception(u"Fichier de log mal formé")
31 ligne = fichier.readline()
39 for item in liste[2:]:
43 liste = [item1, item2, merge]
44 ligne = fichier.readline()
46 yield liste[0], int(liste[1]), liste[2]
48 def get_src_path(path):
49 return os.path.normpath(os.path.join(SHAPER_SRC, path))
51 def get_line_no(path, nol):
52 """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode"""
54 fic = open(get_src_path(path), "r")
56 ligne = fic .readline()
58 ligne_u = ligne.decode(ENCODING)
61 def fic_readlines(fic):
65 liste.append(ligne.decode(ENCODING))
68 def fic_writelines(liste):
71 liste2.append(ligne.encode(ENCODING))