|
21 | 21 | import sys, os, re
|
22 | 22 |
|
23 | 23 | if len(sys.argv) < 2:
|
24 |
| - print "usage: featurkck.py <src-dir>" |
| 24 | + print("usage: featureck.py <src-dir>") |
25 | 25 | sys.exit(1)
|
26 | 26 |
|
27 | 27 | src_dir = sys.argv[1]
|
|
47 | 47 | line = line.replace("(", "").replace("),", "").replace(")", "")
|
48 | 48 | parts = line.split(",")
|
49 | 49 | if len(parts) != 3:
|
50 |
| - print "error: unexpected number of components in line: " + original_line |
| 50 | + print("error: unexpected number of components in line: " + original_line) |
51 | 51 | sys.exit(1)
|
52 | 52 | feature_name = parts[0].strip().replace('"', "")
|
53 | 53 | since = parts[1].strip().replace('"', "")
|
|
107 | 107 | if not mm is None:
|
108 | 108 | since = mm.group(1)
|
109 | 109 | else:
|
110 |
| - print "error: misformed stability attribute" |
111 |
| - print "line " + str(line_num) + " of " + path + ":" |
112 |
| - print line |
| 110 | + print("error: misformed stability attribute") |
| 111 | + print("line %d of %:" % (line_num, path)) |
| 112 | + print(line) |
113 | 113 | errors = True
|
114 | 114 |
|
115 | 115 | lib_features[feature_name] = feature_name
|
|
123 | 123 | (expected_since, source_path, source_line_num, source_line) = \
|
124 | 124 | lib_features_and_level.get((feature_name, level))
|
125 | 125 | if since != expected_since:
|
126 |
| - print "error: mismatch in " + level + " feature '" + feature_name + "'" |
127 |
| - print "line " + str(source_line_num) + " of " + source_path + ":" |
128 |
| - print source_line |
129 |
| - print "line " + str(line_num) + " of " + path + ":" |
130 |
| - print line |
| 126 | + print("error: mismatch in %s feature '%s'" % (level, feature_name)) |
| 127 | + print("line %d of %s:" % (source_line_num, source_path)) |
| 128 | + print(source_line) |
| 129 | + print("line %d of %s:" % (line_num, path)) |
| 130 | + print(line) |
131 | 131 | errors = True
|
132 | 132 |
|
133 | 133 | # Verify that this lib feature doesn't duplicate a lang feature
|
134 | 134 | if feature_name in language_feature_names:
|
135 |
| - print "error: lib feature '" + feature_name + "' duplicates a lang feature" |
136 |
| - print "line " + str(line_num) + " of " + path + ":" |
137 |
| - print line |
| 135 | + print("error: lib feature '%s' duplicates a lang feature" % (feature_name)) |
| 136 | + print("line %d of %s:" % (line_num, path)) |
| 137 | + print(line) |
138 | 138 | errors = True
|
139 | 139 |
|
140 | 140 | else:
|
141 |
| - print "error: misformed stability attribute" |
142 |
| - print "line " + str(line_num) + " of " + path + ":" |
143 |
| - print line |
| 141 | + print("error: misformed stability attribute") |
| 142 | + print("line %d of %s:" % (line_num, path)) |
| 143 | + print(line) |
144 | 144 | errors = True
|
145 | 145 |
|
146 | 146 | # Merge data about both lists
|
|
175 | 175 | is_unstable = lib_features_and_level.get((name, "unstable")) is not None
|
176 | 176 |
|
177 | 177 | if is_stable and is_unstable:
|
178 |
| - print "error: feature '" + name + "' is both stable and unstable" |
| 178 | + print("error: feature '%s' is both stable and unstable" % (name)) |
179 | 179 | errors = True
|
180 | 180 |
|
181 | 181 | if is_stable:
|
|
192 | 192 | for name in lib_feature_stats:
|
193 | 193 | if language_feature_stats.get(name) is not None:
|
194 | 194 | if not name in joint_features:
|
195 |
| - print "error: feature '" + name + "' is both a lang and lib feature but not whitelisted" |
| 195 | + print("error: feature '%s' is both a lang and lib feature but not whitelisted" % (name)) |
196 | 196 | errors = True
|
197 | 197 | lang_status = language_feature_stats[name][3]
|
198 | 198 | lib_status = lib_feature_stats[name][3]
|
199 | 199 | lang_stable_since = language_feature_stats[name][4]
|
200 | 200 | lib_stable_since = lib_feature_stats[name][4]
|
201 | 201 |
|
202 | 202 | if lang_status != lib_status and lib_status != "deprecated":
|
203 |
| - print "error: feature '" + name + "' has lang status " + lang_status + \ |
204 |
| - " but lib status " + lib_status |
| 203 | + print("error: feature '%s' has lang status %s " + |
| 204 | + "but lib status %s" % (name, lang_status, lib_status)) |
205 | 205 | errors = True
|
206 | 206 |
|
207 | 207 | if lang_stable_since != lib_stable_since:
|
208 |
| - print "error: feature '" + name + "' has lang stable since " + lang_stable_since + \ |
209 |
| - " but lib stable since " + lib_stable_since |
| 208 | + print("error: feature '%s' has lang stable since %s " + |
| 209 | + "but lib stable since %s" % (name, lang_stable_since, lib_stable_since)) |
210 | 210 | errors = True
|
211 | 211 |
|
212 | 212 | merged_stats[name] = (name, True, True, lang_status, lang_stable_since)
|
|
240 | 240 |
|
241 | 241 | print
|
242 | 242 | for line in lines:
|
243 |
| - print "* " + line |
| 243 | + print("* " + line) |
244 | 244 | print
|
0 commit comments