@@ -26,7 +26,8 @@ def strip_protocol(url) :
26
26
return protocol_matcher .sub ("" , str (url ))
27
27
28
28
def largest_version (content ) :
29
- return sorted ([t ['version' ] for t in content .package .releases ('release' )], reverse = True )[0 ]
29
+ return sorted ([t ['version' ] for t in content .package .releases ('release' )],
30
+ reverse = True , key = lambda v : map (int , v .split ("." )))[0 ]
30
31
31
32
def do_queue (Class , function , interable ) :
32
33
q = Queue ()
@@ -251,8 +252,9 @@ def get_flash_algorthim_binary(self, device_name) :
251
252
:return: A file-like object that, when read, is the ELF file that describes the flashing algorithm
252
253
:rtype: ZipExtFile
253
254
"""
254
- pack = self .pack_from_cache (self .index [device_name ])
255
- return pack .open (device ['algorithm' ]['file' ])
255
+ device = self .index [device_name ]
256
+ pack = self .pack_from_cache (device )
257
+ return pack .open (device ['algorithm' ].keys ()[0 ])
256
258
257
259
def get_svd_file (self , device_name ) :
258
260
"""Retrieve the flash algorithm file for a particular part.
@@ -264,7 +266,8 @@ def get_svd_file(self, device_name) :
264
266
:return: A file-like object that, when read, is the ELF file that describes the flashing algorithm
265
267
:rtype: ZipExtFile
266
268
"""
267
- pack = self .pack_from_cache (self .index [device_name ])
269
+ device = self .index [device_name ]
270
+ pack = self .pack_from_cache (device )
268
271
return pack .open (device ['debug' ])
269
272
270
273
def generate_index (self ) :
@@ -407,7 +410,7 @@ def pdsc_from_cache(self, url) :
407
410
with open (dest , "r" ) as fd :
408
411
return BeautifulSoup (fd , "html.parser" )
409
412
410
- def pack_from_cache (self , url ) :
413
+ def pack_from_cache (self , device ) :
411
414
"""Low level inteface for extracting a PACK file from the cache.
412
415
413
416
Assumes that the file specified is a PACK file and is in the cache.
0 commit comments