downloadkit/downloadkit.py
changeset 199 90e6dc719131
parent 198 04b0678959bf
child 207 a99c74c53f62
equal deleted inserted replaced
198:04b0678959bf 199:90e6dc719131
    24 from BeautifulSoup import BeautifulSoup
    24 from BeautifulSoup import BeautifulSoup
    25 from optparse import OptionParser
    25 from optparse import OptionParser
    26 import hashlib
    26 import hashlib
    27 import xml.etree.ElementTree as ET 
    27 import xml.etree.ElementTree as ET 
    28 
    28 
    29 version = '0.14'
    29 version = '0.15'
    30 user_agent = 'downloadkit.py script v' + version
    30 user_agent = 'downloadkit.py script v' + version
    31 headers = { 'User-Agent' : user_agent }
    31 headers = { 'User-Agent' : user_agent }
    32 top_level_url = "https://developer.symbian.org"
    32 top_level_url = "https://developer.symbian.org"
    33 passman = urllib2.HTTPPasswordMgrWithDefaultRealm()	# not relevant for live Symbian website
    33 passman = urllib2.HTTPPasswordMgrWithDefaultRealm()	# not relevant for live Symbian website
    34 download_list = []
    34 download_list = []
   422 
   422 
   423 		if options.nosrc and re.match(r"(src_sfl|src_oss)", filename) :
   423 		if options.nosrc and re.match(r"(src_sfl|src_oss)", filename) :
   424 			continue 	# no snapshots of Mercurial source thanks...
   424 			continue 	# no snapshots of Mercurial source thanks...
   425 		if options.nowinscw and re.search(r"winscw", filename) :
   425 		if options.nowinscw and re.search(r"winscw", filename) :
   426 			continue 	# no winscw emulator...
   426 			continue 	# no winscw emulator...
   427 
   427 		if options.noarmv5 and re.search(r"armv5", filename) :
       
   428 			continue 	# no armv5 emulator...
       
   429 		if options.noarmv5 and options.nowinscw and re.search(r"binaries_epoc.zip|binaries_epoc_sdk", filename) :
       
   430 			continue 	# skip binaries_epoc and binaries_sdk ...
   428 		if download_file(filename, downloadurl) != True :
   431 		if download_file(filename, downloadurl) != True :
   429 			continue # download failed
   432 			continue # download failed
   430 
   433 
   431 		# unzip the file (if desired)
   434 		# unzip the file (if desired)
   432 		if re.match(r"patch", filename):
   435 		if re.match(r"patch", filename):
   451 	help="print the files to be downloaded, the 7z commands, and the recommended deletions")
   454 	help="print the files to be downloaded, the 7z commands, and the recommended deletions")
   452 parser.add_option("--nosrc", action="store_true", dest="nosrc",
   455 parser.add_option("--nosrc", action="store_true", dest="nosrc",
   453 	help="Don't download any of the source code available directly from Mercurial")
   456 	help="Don't download any of the source code available directly from Mercurial")
   454 parser.add_option("--nowinscw", action="store_true", dest="nowinscw",
   457 parser.add_option("--nowinscw", action="store_true", dest="nowinscw",
   455 	help="Don't download the winscw emulator")
   458 	help="Don't download the winscw emulator")
       
   459 parser.add_option("--noarmv5", action="store_true", dest="noarmv5",
       
   460 	help="Don't download the armv5 binaries")
   456 parser.add_option("--nounzip", action="store_true", dest="nounzip",
   461 parser.add_option("--nounzip", action="store_true", dest="nounzip",
   457 	help="Just download, don't unzip or delete any files")
   462 	help="Just download, don't unzip or delete any files")
   458 parser.add_option("--nodelete", action="store_true", dest="nodelete",
   463 parser.add_option("--nodelete", action="store_true", dest="nodelete",
   459 	help="Do not delete files after unzipping")
   464 	help="Do not delete files after unzipping")
   460 parser.add_option("--progress", action="store_true", dest="progress",
   465 parser.add_option("--progress", action="store_true", dest="progress",
   469 	help="use alternative website (for testing!)")
   474 	help="use alternative website (for testing!)")
   470 parser.set_defaults(
   475 parser.set_defaults(
   471 	dryrun=False, 
   476 	dryrun=False, 
   472 	nosrc=False, 
   477 	nosrc=False, 
   473 	nowinscw=False, 
   478 	nowinscw=False, 
       
   479 	noarmv5=False, 
   474 	nounzip=False, 
   480 	nounzip=False, 
   475 	nodelete=False, 
   481 	nodelete=False, 
   476 	progress=False,
   482 	progress=False,
   477 	username='',
   483 	username='',
   478 	password='',
   484 	password='',