Skip to content

Commit 54ba134

Browse files
Change formatting in review-patch.py: replace tabs with spaces
1 parent 6500b02 commit 54ba134

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

review-patch.py

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,74 +21,74 @@
2121
import sys
2222

2323
def review_patches(patches):
24-
ret = 0
25-
for patch in patches:
26-
out = ""
27-
f = open(patch)
24+
ret = 0
25+
for patch in patches:
26+
out = ""
27+
f = open(patch)
2828

29-
added_files = []
30-
files_without_source = []
29+
added_files = []
30+
files_without_source = []
3131

32-
for line in f.readlines():
33-
filename = ""
34-
if line.startswith("+++"):
35-
filename = line[4:-1]
36-
elif line.startswith("diff --git"):
37-
filename = line[line.rfind(" ") + 1:-1]
32+
for line in f.readlines():
33+
filename = ""
34+
if line.startswith("+++"):
35+
filename = line[4:-1]
36+
elif line.startswith("diff --git"):
37+
filename = line[line.rfind(" ") + 1:-1]
3838

39-
if filename != "" and not filename in added_files:
40-
added_files.append(filename)
41-
if not filename.endswith(".source.txt"):
42-
files_without_source.append(filename)
43-
f.close()
39+
if filename != "" and not filename in added_files:
40+
added_files.append(filename)
41+
if not filename.endswith(".source.txt"):
42+
files_without_source.append(filename)
43+
f.close()
4444

4545

46-
local_error = False
46+
local_error = False
4747

48-
added_files.sort()
49-
for f in added_files:
50-
dir_id = f.rfind("/") + 1
51-
ext_id = dir_id + f[dir_id:].find(".")
52-
if ext_id != -1:
53-
ext = f[ext_id + 1:]
54-
if ext.endswith("source.txt"):
55-
real_db_file = f[:-len(".source.txt")]
56-
try:
57-
files_without_source.remove(real_db_file)
58-
except:
59-
out += "\t" + f + ": .source.txt found for non-existing file, expecting " + real_db_file + " in patch\n"
60-
ret = 1
61-
local_error = True
62-
else:
63-
db_dir = os.path.basename(os.path.dirname(f))
64-
if db_dir != ext:
65-
out += "\t" + f + ": File is not in proper directory according to extension\n"
66-
ret = 1
67-
local_error = True
48+
added_files.sort()
49+
for f in added_files:
50+
dir_id = f.rfind("/") + 1
51+
ext_id = dir_id + f[dir_id:].find(".")
52+
if ext_id != -1:
53+
ext = f[ext_id + 1:]
54+
if ext.endswith("source.txt"):
55+
real_db_file = f[:-len(".source.txt")]
56+
try:
57+
files_without_source.remove(real_db_file)
58+
except:
59+
out += "\t" + f + ": .source.txt found for non-existing file, expecting " + real_db_file + " in patch\n"
60+
ret = 1
61+
local_error = True
62+
else:
63+
db_dir = os.path.basename(os.path.dirname(f))
64+
if db_dir != ext:
65+
out += "\t" + f + ": File is not in proper directory according to extension\n"
66+
ret = 1
67+
local_error = True
6868

69-
for f in files_without_source:
70-
out += "\t" + f + ": Does not have matching .source.txt file with license\n"
71-
ret = 1
72-
local_error = True
69+
for f in files_without_source:
70+
out += "\t" + f + ": Does not have matching .source.txt file with license\n"
71+
ret = 1
72+
local_error = True
7373

74-
if local_error:
75-
print "Patch", patch + ":"
76-
print out
74+
if local_error:
75+
print "Patch", patch + ":"
76+
print out
7777

78-
return ret
78+
return ret
7979

8080
if __name__ == '__main__':
81-
if len(sys.argv) == 1:
82-
print "Reviews patches for file-tests database."
83-
print """There are following rules currently:
81+
if len(sys.argv) == 1:
82+
print "Reviews patches for file-tests database."
83+
print """There are following rules currently:
8484
- Every file 'F' in file-tests database has to have matching 'F.source.txt'
8585
file with the license information. Note that case sensitivity is important
8686
and must be respected.
8787
- Every file with extension '.X' has to be in directory 'db/X' according to
8888
its extension. Note that case sensitivity is important and must be
8989
respected.
9090
"""
91-
print "Usage: " + sys.argv[0] + " [[patch1], [patch2], ...]"
92-
print "Usage: " + sys.argv[0] + " *.patch"
93-
sys.exit(0)
94-
sys.exit(review_patches(sys.argv[1:]))
91+
print "Usage: " + sys.argv[0] + " [[patch1], [patch2], ...]"
92+
print "Usage: " + sys.argv[0] + " *.patch"
93+
sys.exit(0)
94+
sys.exit(review_patches(sys.argv[1:]))

0 commit comments

Comments
 (0)