Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. * Copyright © 2009-2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  4. *
  5. * Mumble-Django is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This package is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. """
  15. version = { 'major': 2, 'minor': 2, 'beta': None }
  16. if version['beta']:
  17. version_str = "v%(major)d.%(minor)dbeta%(beta)d" % version
  18. else:
  19. version_str = "v%(major)d.%(minor)d" % version
  20. def getVersions():
  21. """ Generator that yields all available upstream versions. """
  22. url = 'http://bitbucket.org/Svedrin/mumble-django/raw/tip/.hgtags'
  23. from urllib2 import urlopen
  24. webtags = urlopen(url)
  25. try:
  26. while True:
  27. line = webtags.readline().strip()
  28. if not line:
  29. raise StopIteration
  30. _, version = line.split(' ')
  31. yield version
  32. finally:
  33. webtags.close()
  34. def getLatestUpstreamVersion():
  35. """ Return the latest version available upstream. """
  36. return max(getVersions())
  37. def isUptodate():
  38. """ Check if this version of Mumble-Django is the latest available. """
  39. return version_str >= getLatestUpstreamVersion()