PEP8 radio/util/include-guard.py

Split imports, fix whitespace
This commit is contained in:
Sean Vig
2015-12-13 18:55:02 -06:00
parent 39ee317190
commit 2968b25cfa
+5 -5
View File
@@ -2,7 +2,8 @@
from __future__ import print_function
import sys, os
import sys
import os
for filename in sys.argv[1:]:
f = file(filename, "r")
@@ -15,10 +16,10 @@ for filename in sys.argv[1:]:
line = line.strip()
if line.startswith("#ifndef "):
guard = line[8:]
if lines[i+1].strip() == "#define %s" % guard:
if lines[i + 1].strip() == "#define %s" % guard:
print(filename, ":", guard, "=>", newguard)
lines[i] = "#ifndef %s\n" % newguard
lines[i+1] = "#define %s\n" % newguard
lines[i + 1] = "#define %s\n" % newguard
end = -1
while not lines[end].strip().startswith("#endif"):
end -= 1
@@ -26,5 +27,4 @@ for filename in sys.argv[1:]:
f = file(filename, "w")
f.write("".join(lines))
f.close()
break
break