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.

65 lines
1.9 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. import re
  16. from os import listdir
  17. from os.path import join
  18. from urllib import urlopen
  19. from django.core.management.base import BaseCommand
  20. from django.conf import settings
  21. HEAD_SLICE_URL = 'http://mumble.git.sourceforge.net/git/gitweb.cgi?p=mumble/mumble;a=blob_plain;f=src/murmur/Murmur.ice;hb=HEAD'
  22. class Command( BaseCommand ):
  23. def handle(self, **options):
  24. nameregex = re.compile( "Murmur_(\d)-(\d)-(\d).ice" )
  25. basepath = join( settings.MUMBLE_DJANGO_ROOT, 'pyweb', 'mumble' )
  26. version = [0, 0, 0]
  27. for filename in listdir( basepath ):
  28. match = nameregex.match( filename )
  29. if match:
  30. for idx in range(3):
  31. namedigit = int( match.group(idx + 1) )
  32. if version[idx] < namedigit:
  33. version = [
  34. int( match.group(1) ),
  35. int( match.group(2) ),
  36. int( match.group(3) ),
  37. ]
  38. break
  39. version[2] += 1
  40. userversion = raw_input( "Enter current HEAD version [%d.%d.%d]: " % tuple(version) )
  41. if userversion:
  42. version = [ int(digit) for digit in userversion.split('.') ]
  43. slicefile = join( settings.MUMBLE_DJANGO_ROOT, 'pyweb', 'mumble', 'Murmur_%d-%d-%d.ice' % tuple(version) )
  44. gitfile = urlopen( HEAD_SLICE_URL ).fp.read();
  45. slicefd = open( slicefile, 'wb' );
  46. slicefd.write( gitfile );
  47. slicefd.close();