@@ -56,7 +56,7 @@ def find_target_by_path(target_path):
56
56
57
57
with open (target_path ) as pin_names_file :
58
58
pin_names_file_content = pin_names_file .read ()
59
-
59
+
60
60
target_list_match = re .search (
61
61
"\/* MBED TARGET LIST: ([0-9A-Z_,* \n ]+)*\/" ,
62
62
pin_names_file_content
@@ -71,7 +71,7 @@ def find_target_by_path(target_path):
71
71
re .MULTILINE ,
72
72
)
73
73
)
74
-
74
+
75
75
if not target_list :
76
76
print ("WARNING: MBED TARGET LIST marker invalid or not found in file " + target_path )
77
77
print ("Target could not be determined. Only the generic test suite will run. You can manually specify additional suites." )
@@ -98,18 +98,18 @@ def find_target_by_path(target_path):
98
98
def find_target_by_name (target_name = "" ):
99
99
"""Find a target by name."""
100
100
mbed_os_root = pathlib .Path (__file__ ).absolute ().parents [3 ]
101
-
101
+
102
102
targets = dict ()
103
103
104
104
for f in mbed_os_root .joinpath ('targets' ).rglob ("PinNames.h" ):
105
105
with open (f ) as pin_names_file :
106
106
pin_names_file_content = pin_names_file .read ()
107
-
107
+
108
108
target_list_match = re .search (
109
109
"\/* MBED TARGET LIST: ([0-9A-Z_,* \n ]+)*\/" ,
110
110
pin_names_file_content
111
111
)
112
-
112
+
113
113
target_list = []
114
114
if target_list_match :
115
115
target_list = list (
@@ -127,7 +127,7 @@ def find_target_by_name(target_name=""):
127
127
else :
128
128
for target in target_list :
129
129
targets [target ] = f
130
-
130
+
131
131
return targets
132
132
133
133
@@ -150,12 +150,12 @@ def check_markers(test_mode=False):
150
150
for f in search_dir .rglob ("PinNames.h" ):
151
151
with open (f ) as pin_names_file :
152
152
pin_names_file_content = pin_names_file .read ()
153
-
153
+
154
154
target_list_match = re .search (
155
155
"\/* MBED TARGET LIST: ([0-9A-Z_,* \n ]+)*\/" ,
156
156
pin_names_file_content
157
157
)
158
-
158
+
159
159
marker_target_list = []
160
160
if target_list_match :
161
161
marker_target_list = list (
@@ -165,7 +165,7 @@ def check_markers(test_mode=False):
165
165
re .MULTILINE ,
166
166
)
167
167
)
168
-
168
+
169
169
if not marker_target_list :
170
170
print ("WARNING: MBED TARGET LIST marker invalid or not found in file " + str (f ))
171
171
errors .append ({ "file" : str (f ), "error" : "marker invalid or not found" })
@@ -181,7 +181,7 @@ def check_markers(test_mode=False):
181
181
if not target_is_valid :
182
182
print ("WARNING: MBED TARGET LIST in file " + str (f ) + " includes target '" + target + "' which doesn't exist in targets.json or is not public" )
183
183
errors .append ({ "file" : str (f ), "error" : "target not found" })
184
-
184
+
185
185
return errors
186
186
187
187
@@ -190,7 +190,7 @@ def check_duplicate_pinnames_files(test_mode=False):
190
190
mbed_os_root = pathlib .Path (__file__ ).absolute ().parents [3 ]
191
191
192
192
errors = []
193
-
193
+
194
194
file_hash_dict = dict ()
195
195
196
196
if test_mode :
@@ -202,20 +202,20 @@ def check_duplicate_pinnames_files(test_mode=False):
202
202
with open (f ) as pin_names_file :
203
203
pin_names_file_content = pin_names_file .read ()
204
204
file_hash_dict [str (f )] = hashlib .md5 (pin_names_file_content .encode ('utf-8' )).hexdigest ()
205
-
206
- rev_dict = {}
207
- for key , value in file_hash_dict .items ():
208
- rev_dict .setdefault (value , set ()).add (key )
209
- duplicates = [key for key , values in rev_dict .items ()
210
- if len (values ) > 1 ]
211
-
205
+
206
+ rev_dict = {}
207
+ for key , value in file_hash_dict .items ():
208
+ rev_dict .setdefault (value , set ()).add (key )
209
+ duplicates = [key for key , values in rev_dict .items ()
210
+ if len (values ) > 1 ]
211
+
212
212
for duplicate in duplicates :
213
213
print ("WARNING: Duplicate files" )
214
214
for file_path , file_hash in file_hash_dict .items ():
215
215
if file_hash == duplicate :
216
216
errors .append ({ "file" : file_path , "error" : "duplicate file" })
217
217
print ("\t " + file_path )
218
-
218
+
219
219
return errors
220
220
221
221
def check_duplicate_markers (test_mode = False ):
@@ -225,7 +225,7 @@ def check_duplicate_markers(test_mode=False):
225
225
errors = []
226
226
227
227
markers = dict ()
228
-
228
+
229
229
if test_mode :
230
230
search_dir = pathlib .Path (__file__ ).parent .joinpath ('test_files' ).absolute ()
231
231
else :
@@ -234,12 +234,12 @@ def check_duplicate_markers(test_mode=False):
234
234
for f in search_dir .rglob ("PinNames.h" ):
235
235
with open (f ) as pin_names_file :
236
236
pin_names_file_content = pin_names_file .read ()
237
-
237
+
238
238
target_list_match = re .search (
239
239
"\/* MBED TARGET LIST: ([0-9A-Z_,* \n ]+)*\/" ,
240
240
pin_names_file_content
241
241
)
242
-
242
+
243
243
marker_target_list = []
244
244
if target_list_match :
245
245
marker_target_list = list (
@@ -249,7 +249,7 @@ def check_duplicate_markers(test_mode=False):
249
249
re .MULTILINE ,
250
250
)
251
251
)
252
-
252
+
253
253
for target in marker_target_list :
254
254
if target in markers :
255
255
print ("WARNING: target duplicate in " + str (f ) + ", " + target + " first listed in " + markers [target ])
@@ -610,13 +610,13 @@ def print_pretty_html_report(report):
610
610
output .append ("'>" )
611
611
output .append (case ["result" ])
612
612
output .append ("</td>" )
613
-
613
+
614
614
output .append ("<td style='color:" )
615
615
output .append (count_color )
616
616
output .append ("'>" )
617
617
output .append (str (len (case ["errors" ])))
618
618
output .append ("</td>" )
619
-
619
+
620
620
output .append ("<td>" )
621
621
output .extend (error_details )
622
622
output .append ("</td>" )
0 commit comments