# HG changeset patch # User William Roberts # Date 1268921863 0 # Node ID a99c74c53f62e71294ddae5da48655fa59ef5ad4 # Parent 90e6dc7191317123920a86ef7b3db1e9a2bda047 v0.16 - generate correct URL for downloading a specific version, and enable "Latest Symbian^X" functionality. Specify just "2" or "3" to get the latest version of Symbian^2 or Symbian^3 respectively diff -r 90e6dc719131 -r a99c74c53f62 downloadkit/downloadkit.py --- a/downloadkit/downloadkit.py Tue Mar 16 12:52:44 2010 +0000 +++ b/downloadkit/downloadkit.py Thu Mar 18 14:17:43 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")