40
40
file_data = []
41
41
42
42
all_libraries = []
43
+ adafruit_library_index = []
43
44
44
45
def list_repos ():
45
46
""" Return a list of all Adafruit repositories with 'Arduino' in either the
@@ -109,7 +110,7 @@ def validate_library_properties(repo):
109
110
release_tag = None
110
111
lib_prop_file = requests .get ("https://raw.githubusercontent.com/adafruit/" + repo ["name" ] + "/master/library.properties" )
111
112
if not lib_prop_file .ok :
112
- print ("{} skipped" .format (repo ["name" ]))
113
+ # print("{} skipped".format(repo["name"]))
113
114
return None # no library properties file!
114
115
115
116
lines = lib_prop_file .text .split ("\n " )
@@ -179,6 +180,7 @@ def run_arduino_lib_checks():
179
180
output_handler ("Found {} Arduino libraries to check\n " .format (len (repo_list )))
180
181
failed_lib_prop = [[" Repo" , "Release Tag" , "library.properties Version" ], [" ----" , "-----------" , "--------------------------" ]]
181
182
needs_release_list = [[" Repo" , "Latest Release" , "Commits Behind" ], [" ----" , "--------------" , "--------------" ]]
183
+ needs_registration_list = [[" Repo" ], [" ----" ]]
182
184
missing_travis_list = [[" Repo" ], [" ----" ]]
183
185
missing_library_properties_list = [[" Repo" ], [" ----" ]]
184
186
@@ -189,12 +191,23 @@ def run_arduino_lib_checks():
189
191
continue
190
192
191
193
entry = {'name' : repo ["name" ]}
192
-
194
+
193
195
lib_check = validate_library_properties (repo )
194
196
if not lib_check :
195
197
missing_library_properties_list .append ([" " + str (repo ["name" ])])
196
198
continue
197
199
200
+ #print(repo['clone_url'])
201
+ needs_registration = False
202
+ for lib in adafruit_library_index :
203
+ if (repo ['clone_url' ] == lib ['repository' ]) or (repo ['html_url' ] == lib ['website' ]):
204
+ entry ['arduino_version' ] = lib ['version' ] # found it!
205
+ break
206
+ else :
207
+ needs_registration = True
208
+ if needs_registration :
209
+ needs_registration_list .append ([" " + str (repo ["name" ])])
210
+
198
211
entry ['release' ] = lib_check [0 ]
199
212
entry ['version' ] = lib_check [1 ]
200
213
repo ['tag_name' ] = lib_check [0 ]
@@ -217,6 +230,9 @@ def run_arduino_lib_checks():
217
230
if len (failed_lib_prop ) > 2 :
218
231
print_list_output ("Libraries Have Mismatched Release Tag and library.properties Version: ({})" , failed_lib_prop )
219
232
233
+ if len (needs_registration_list ) > 2 :
234
+ print_list_output ("Libraries that are not registered with Arduino: ({})" , needs_registration_list )
235
+
220
236
if len (needs_release_list ) > 2 :
221
237
print_list_output ("Libraries have commits since last release: ({})" , needs_release_list );
222
238
@@ -232,8 +248,15 @@ def run_arduino_lib_checks():
232
248
verbosity = cmd_line_args .verbose
233
249
if cmd_line_args .output_file :
234
250
output_filename = cmd_line_args .output_file
235
-
236
251
try :
252
+ reply = requests .get ("http://downloads.arduino.cc/libraries/library_index.json" )
253
+ if not reply .ok :
254
+ print ("Could not fetch http://downloads.arduino.cc/libraries/library_index.json" )
255
+ exit ()
256
+ arduino_library_index = reply .json ()
257
+ for lib in arduino_library_index ['libraries' ]:
258
+ if 'adafruit' in lib ['url' ]:
259
+ adafruit_library_index .append (lib )
237
260
run_arduino_lib_checks ()
238
261
except :
239
262
if output_filename is not None :
0 commit comments