# HG changeset patch # User MattD # Date 1269257748 0 # Node ID 97a2261627a2f8c9c8e67b56fc33b437222a4620 # Parent 01c2b1268053fcb0d36d5d8a96374e199e0f90db# Parent a99c74c53f62e71294ddae5da48655fa59ef5ad4 Catchup merge diff -r 01c2b1268053 -r 97a2261627a2 downloadkit/downloadkit.py --- a/downloadkit/downloadkit.py Mon Mar 22 11:35:04 2010 +0000 +++ b/downloadkit/downloadkit.py Mon Mar 22 11:35:48 2010 +0000 @@ -26,7 +26,7 @@ import hashlib import xml.etree.ElementTree as ET -version = '0.15' +version = '0.16' user_agent = 'downloadkit.py script v' + version headers = { 'User-Agent' : user_agent } top_level_url = "https://developer.symbian.org" @@ -380,11 +380,14 @@ urlbase = top_level_url + '/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 - if version[0] == 2: + if version[0] == '2': viewid= 1 # Symbian^2 - if version[0] == 3: + if version[0] == '3': viewid= 5 # Symbian^3 - url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version + url = urlbase + ('view.php?id=%d'% viewid) + if len(version) > 1: + # single character version means "give me the latest" + url = url + '&vId=' + version req = urllib2.Request(url, None, headers) response = urllib2.urlopen(req) @@ -406,11 +409,18 @@ # check that this is the right version match = re.search('Platform Release (\(Public\) )?v(\d\.\d\.[0-9a-z]+)', doc, re.IGNORECASE) - if match and match.group(2) != version: - print "*** ERROR: version %s is not available" % version - print "*** the website is offering version %s instead" % match.group(1) + if not match: + print "*** ERROR: no version information in the download page" return 0 + if len(version) > 1: + if match.group(2) != version: + print "*** ERROR: version %s is not available" % version + print "*** the website is offering version %s instead" % match.group(2) + return 0 + else: + print "The latest version of Symbian^%s is PDK %s" % (version, match.group(2)) + # let's hope the HTML format never changes... # ... threadlist = [] @@ -488,7 +498,7 @@ (options, args) = parser.parse_args() if len(args) != 1: - parser.error("Must supply a PDK version, e.g. 3.0.f") + parser.error("Must supply a PDK version, e.g. 3 or 3.0.h") if not check_unzip_environment() : parser.error("Unable to execute 7z command")