update oe-stylize to be Python3 comaptible

Signed-off-by: Cliff Brake <cbrake@bec-systems.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Cliff Brake 2012-12-14 18:38:34 +00:00 committed by Martin Jansa
parent ee97efeec2
commit 20ce632750

View File

@ -306,10 +306,10 @@ def follow_rule(i, line):
# if the line still does not respect the rule # if the line still does not respect the rule
if not rules[i][0](line): if not rules[i][0](line):
# this is a rule disgression # this is a rule disgression
print "## Disgression: ", rules[i][2], " in:", oldline print ("## Disgression: ", rules[i][2], " in:", oldline)
else: else:
# just remind user about his/her errors # just remind user about his/her errors
print "## Reminder: ", rules[i][2], " in :", oldline print ("## Reminder: ", rules[i][2], " in :", oldline)
return line return line
@ -363,7 +363,7 @@ if __name__ == "__main__":
commentBloc.append(line) commentBloc.append(line)
continue continue
if seen_vars.has_key(var): if var in seen_vars:
for c in commentBloc: seen_vars[var].append(c) for c in commentBloc: seen_vars[var].append(c)
commentBloc = [] commentBloc = []
seen_vars[var].append(line) seen_vars[var].append(line)
@ -381,7 +381,7 @@ if __name__ == "__main__":
line = follow_rule(5, line) line = follow_rule(5, line)
if var == "": if var == "":
if not in_routine: if not in_routine:
print "## Warning: unknown variable/routine \"%s\"" % originalLine.rstrip('\n') print ("## Warning: unknown variable/routine \"%s\"" % originalLine.rstrip('\n'))
var = 'others' var = 'others'
for c in commentBloc: seen_vars[var].append(c) for c in commentBloc: seen_vars[var].append(c)
commentBloc = [] commentBloc = []
@ -402,5 +402,5 @@ if __name__ == "__main__":
for l in seen_vars[k]: for l in seen_vars[k]:
olines.append(l) olines.append(l)
previourVarPrefix = k.split('_')[0]=='' and "unknown" or k.split('_')[0] previourVarPrefix = k.split('_')[0]=='' and "unknown" or k.split('_')[0]
for line in olines: print line for line in olines: print(line)