NewVersion.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # The contents of this file are subject to the BitTorrent Open Source License
  2. # Version 1.1 (the License). You may not copy or use this file, in either
  3. # source code or executable form, except in compliance with the License. You
  4. # may obtain a copy of the License at http://www.bittorrent.com/license/.
  5. #
  6. # Software distributed under the License is distributed on an AS IS basis,
  7. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  8. # for the specific language governing rights and limitations under the
  9. # License.
  10. # written by Matt Chisholm, destroyed by Greg Hazel
  11. DEBUG = False
  12. from BitTorrent import version
  13. version_host = 'http://version.bittorrent.com/'
  14. download_url = 'http://www.bittorrent.com/download.html'
  15. # based on Version() class from ShellTools package by Matt Chisholm,
  16. # used with permission
  17. class Version(list):
  18. def __str__(self):
  19. return '.'.join(map(str, self))
  20. def is_beta(self):
  21. return self[1] % 2 == 1
  22. def from_str(self, text):
  23. return Version( [int(t) for t in text.split('.')] )
  24. def name(self):
  25. if self.is_beta():
  26. return 'beta'
  27. else:
  28. return 'stable'
  29. from_str = classmethod(from_str)
  30. currentversion = Version.from_str(version)
  31. availableversion = None