downloadkit/downloadkit.py
changeset 303 988ad79e9989
parent 302 c1b745b16f58
equal deleted inserted replaced
302:c1b745b16f58 303:988ad79e9989
   149 		print "  Unzipping " + filename
   149 		print "  Unzipping " + filename
   150 		filelist = os.popen("7z x -y "+self.filename)
   150 		filelist = os.popen("7z x -y "+self.filename)
   151 		subzips = []
   151 		subzips = []
   152 		for line in filelist.readlines():
   152 		for line in filelist.readlines():
   153 			# Extracting  src_oss_app_webuis.zip
   153 			# Extracting  src_oss_app_webuis.zip
   154 			match = re.match(r"^Extracting\s+(\S+.zip)$", line)
   154 			match = re.match(r"^Extracting\s+(\S+.(7z|zip))$", line)
   155 			if match is None: continue
   155 			if match is None: continue
   156 			subzips.append(match.group(1))
   156 			subzips.append(match.group(1))
   157 		topstatus = filelist.close()
   157 		topstatus = filelist.close()
   158 
   158 
   159 		if deletelevel > 0:
   159 		if deletelevel > 0:
   479 		print "The latest version of Symbian^%s is PDK %s" % (version, match.group(2))
   479 		print "The latest version of Symbian^%s is PDK %s" % (version, match.group(2))
   480 		
   480 		
   481 	# let's hope the HTML format never changes...
   481 	# let's hope the HTML format never changes...
   482 	# <a href='download.php?id=27&cid=60&iid=270' title='src_oss_mw.zip'> ...</a> 
   482 	# <a href='download.php?id=27&cid=60&iid=270' title='src_oss_mw.zip'> ...</a> 
   483 	threadlist = []
   483 	threadlist = []
   484 	results=soup.findAll('a', href=re.compile("^download"), title=re.compile("\.(zip|xml)$"))
   484 	results=soup.findAll('a', href=re.compile("^download"), title=re.compile("\.(7z|zip|xml)$"))
   485 	results.sort(orderResults)
   485 	results.sort(orderResults)
   486 	for result in results:
   486 	for result in results:
   487 		downloadurl = urlbase + result['href']
   487 		downloadurl = urlbase + result['href']
   488 		filename = result['title']
   488 		filename = result['title']
   489 
   489 
   491 			continue 	# no snapshots of Mercurial source thanks...
   491 			continue 	# no snapshots of Mercurial source thanks...
   492 		if options.nowinscw and re.search(r"winscw", filename) :
   492 		if options.nowinscw and re.search(r"winscw", filename) :
   493 			continue 	# no winscw emulator...
   493 			continue 	# no winscw emulator...
   494 		if options.noarmv5 and re.search(r"armv5", filename) :
   494 		if options.noarmv5 and re.search(r"armv5", filename) :
   495 			continue 	# no armv5 emulator...
   495 			continue 	# no armv5 emulator...
   496 		if options.noarmv5 and options.nowinscw and re.search(r"binaries_epoc.zip|binaries_epoc_sdk", filename) :
   496 		if options.noarmv5 and options.nowinscw and re.search(r"binaries_epoc.(7z|zip)|binaries_epoc_sdk", filename) :
   497 			continue 	# skip binaries_epoc and binaries_sdk ...
   497 			continue 	# skip binaries_epoc and binaries_sdk ...
   498 		if download_file(filename, downloadurl) != True :
   498 		if download_file(filename, downloadurl) != True :
   499 			failure_list.append(filename)
   499 			failure_list.append(filename)
   500 			continue # download failed
   500 			continue # download failed
   501 
   501 
   503 		if re.match(r"patch", filename):
   503 		if re.match(r"patch", filename):
   504 			complete_outstanding_unzips()	# ensure that the thing we are patching is completed first
   504 			complete_outstanding_unzips()	# ensure that the thing we are patching is completed first
   505 			
   505 			
   506 		if re.match(r"release_metadata", filename):
   506 		if re.match(r"release_metadata", filename):
   507 			parse_release_metadata(filename)	# read the md5 checksums etc
   507 			parse_release_metadata(filename)	# read the md5 checksums etc
   508 		elif re.match(r"(bin|tools).*\.zip", filename):
   508 		elif re.match(r"(bin|tools).*\.(7z|zip)", filename):
   509 			schedule_unzip(filename, 1, 0)   # unzip once, don't delete
   509 			schedule_unzip(filename, 1, 0)   # unzip once, don't delete
   510 		elif re.match(r"src_.*\.zip", filename):
   510 		elif re.match(r"src_.*\.(7z|zip)", filename):
   511 			schedule_unzip(filename, 1, 1)   # zip of zips, delete top level
   511 			schedule_unzip(filename, 1, 1)   # zip of zips, delete top level
   512 		elif re.match(r"build_BOM.zip", filename):
   512 		elif re.match(r"build_BOM.(7z|zip)", filename):
   513 			schedule_unzip(filename, 1, 1)   # unpack then delete zip as it's not needed again
   513 			schedule_unzip(filename, 1, 1)   # unpack then delete zip as it's not needed again
   514 
   514 
   515 	# wait for the unzipping threads to complete
   515 	# wait for the unzipping threads to complete
   516 	complete_outstanding_unzips()  
   516 	complete_outstanding_unzips()  
   517 
   517