Mercurial > ~astiob > upreckon > hgweb
changeset 14:28b1f4853968
Get the latest published version from /test.py/version.txt
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Sat, 13 Mar 2010 00:04:57 +0000 |
parents | a2c9f7cfa174 |
children | c0e925ae721e |
files | test-svn.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/test-svn.py Sat Mar 13 00:00:48 2010 +0000 +++ b/test-svn.py Sat Mar 13 00:04:57 2010 +0000 @@ -21,11 +21,8 @@ def update(): import urllib - homepage = urllib.urlopen('http://chortos.selfip.net/~astiob/test.py/').read() - i = homepage.find("The latest version of test.py is <span style='font-weight: bold; font-size: larger'>") - i += len("The latest version of test.py is <span style='font-weight: bold; font-size: larger'>") - j = homepage.find(".</span>", i) - latest = homepage[i:j].split('.') + latesttext = urllib.urlopen('http://chortos.selfip.net/~astiob/test.py/version.txt').read() + latest = latesttext.split('.') installed = version.split('.') update = '' if latest[0] > installed[0]: @@ -44,7 +41,7 @@ return print 'A ' + update + ' update to test.py is available. Downloading...' urllib.urlretrieve('http://chortos.selfip.net/~astiob/test.py/test.py', 'test.py') - print 'Downloaded and installed. Now you are using test.py ' + homepage[i:j] + '.' + print 'Downloaded and installed. Now you are using test.py ' + latesttext + '.' if options.update: update()