# HG changeset patch # User William Roberts # Date 1262977669 0 # Node ID 249ca6c587b60d27d1c00b618911567def2335a1 # Parent c63eca238256f2129b2416f7023930bb18ca5fec Changes to control the order of downloading, and hopefully the resulting unzipping (for patches in particular) diff -r c63eca238256 -r 249ca6c587b6 downloadkit/downloadkit.py --- a/downloadkit/downloadkit.py Tue Dec 22 14:17:28 2009 +0000 +++ b/downloadkit/downloadkit.py Fri Jan 08 19:07:49 2010 +0000 @@ -112,6 +112,29 @@ def run(self): self.status = self.unzip(self.filename, self.levels, self.deletelevels) +def orderResults(x,y) : + def ranking(name) : + # 1st = release_metadata, build_BOM.zip (both small things!) + if re.match(r"(build_BOM|release_metadata)", name): + return 1000; + # 2nd = tools, binaries (required for execution and compilation) + elif re.match(r"(binaries_|tools_)", name): + return 2000; + # 3rd = rnd binaries, binary patches + elif re.match(r"(bin_)", name): + return 3000; + # 4th = sources + elif re.match(r"(src_sfl|src_oss)", name): + return 4000; + # 5rd = rnd sources, source patches (not sure we'd ever have those) + elif re.match(r"(src_)", name): + return 5000; + # Last, anything else + return 10000; + xtitle = x['title'] + ytitle = y['title'] + return cmp(ranking(xtitle)+cmp(xtitle,ytitle), ranking(ytitle)) + def downloadkit(version): headers = { 'User-Agent' : user_agent } urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/' @@ -140,6 +163,7 @@ soup=BeautifulSoup(doc) results=soup.findAll('a', href=re.compile("^download"), title=re.compile("\.(zip|xml)$")) + results.sort(orderResults) for result in results: downloadurl = urlbase + result['href'] filename = result['title']