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.

45 lines
1.6 KiB

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