/[ascend]/trunk/pygtk/versioncheck.py
ViewVC logotype

Contents of /trunk/pygtk/versioncheck.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 930 - (show annotations) (download) (as text)
Wed Nov 22 13:09:09 2006 UTC (17 years, 9 months ago) by johnpye
File MIME type: text/x-python
File size: 1264 byte(s)
solve.py raises ImportError if 'browser' object is not available (right approach?)
Freeing some variables in dsgsat2.a4c.
Returing Py_None from extpy routine in 'browser' object not defined (eg during non-GUI unit testing)
Error reporting from extpy import handler (ongoing)
Timeout in versioncheck (when server unavailable)
A little more tinkering with IDA.
1 import urllib2, ConfigParser, platform
2 import socket
3
4 class VersionCheck:
5 def __init__(self):
6 self.url = "http://ascend.cruncher2.dyndns.org/version.ini"
7 self.download = None
8 self.latest = None
9 self.info = None
10 def check(self):
11 socket.setdefaulttimeout(1)
12 auth_handler = urllib2.HTTPBasicAuthHandler()
13 opener = urllib2.build_opener(auth_handler)
14 urllib2.install_opener(opener)
15 fp = urllib2.urlopen(self.url)
16
17 cp = ConfigParser.SafeConfigParser()
18 cp.readfp(fp,self.url)
19
20 opersys = platform.system()
21
22 if opersys=="Windows":
23 self.vertype = "Windows"
24 self.latest = cp.get('Windows','version').strip()
25 self.info = cp.get('Windows','info').strip()
26 try:
27 self.download = cp.get('Windows','download').strip()
28 except:
29 pass
30 return True
31 else:
32 self.vertype = "Source code"
33 self.latest = cp.get('Generic','version').strip()
34 self.info = cp.get('Generic','info').strip()
35 try:
36 self.download = cp.get('Generic','download').strip()
37 except:
38 pass
39 return True
40
41 raise RuntimeError("No version info available for this operating system")
42
43 if __name__=="__main__":
44 v = VersionCheck()
45 if v.check():
46 print v.latest
47 print "Info at %s" % v.info
48 if v.download:
49 print "Download from %s" % v.download

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22