| | 9 | def getlatestVersionNumber(): |
| | 10 | """Check if there is a new stable release of nvda.""" |
| | 11 | import re |
| | 12 | import urllib |
| | 13 | try: |
| | 14 | f = urllib.urlopen("http://www.nvda-project.org/wiki/Download") |
| | 15 | pageText = f.read() |
| | 16 | f.close() |
| | 17 | except IOError: |
| | 18 | # Translators: this message is displayed in the about dialog, when trying to find the latest version. |
| | 19 | return _("Unable to contact website.") |
| | 20 | # we know that the version number is on a line where we have stable, release and the ver number. |
| | 21 | verReg = re.compile('.*?stable.*?release.*?(?P<newVer>[0-9]+\.[0-9])', re.IGNORECASE) |
| | 22 | results = verReg.findall(pageText) |
| | 23 | |
| | 24 | if not len(results): |
| | 25 | # Translators: this message is displayed in the about dialog, when trying to find the latest version. |
| | 26 | return _("Could not find latest version information.") |
| | 27 | try: |
| | 28 | # if the current version is less than the one found on the site. |
| | 29 | if float(version[0:6]) < float(results[0]): |
| | 30 | return results[0] # version found number on website |
| | 31 | # Translators: this message is displayed in the about dialog, when trying to find the latest version. |
| | 32 | return _("Your version is up to date.") |
| | 33 | except ValueError: |
| | 34 | # running from bzr or a snapshot. |
| | 35 | # Translators: this message is displayed in the about dialog, when trying to find the latest version. |
| | 36 | return _("Unable to check for newer version, this does not look like a release version of NVDA.") |
| | 37 | |