r266 - in /debtorrent/trunk: ./ DebTorrent/ DebTorrent/BT1/

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Sat Aug 18 02:06:35 UTC 2007


Author: camrdale-guest
Date: Sat Aug 18 02:06:35 2007
New Revision: 266

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=266
Log:
Remove some unnecessary stuff that was supporting old python versions.

Modified:
    debtorrent/trunk/DebTorrent/BT1/Choker.py
    debtorrent/trunk/DebTorrent/BT1/Connecter.py
    debtorrent/trunk/DebTorrent/BT1/Downloader.py
    debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py
    debtorrent/trunk/DebTorrent/BT1/Encrypter.py
    debtorrent/trunk/DebTorrent/BT1/FileSelector.py
    debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py
    debtorrent/trunk/DebTorrent/BT1/NatCheck.py
    debtorrent/trunk/DebTorrent/BT1/PiecePicker.py
    debtorrent/trunk/DebTorrent/BT1/Rerequester.py
    debtorrent/trunk/DebTorrent/BT1/Statistics.py
    debtorrent/trunk/DebTorrent/BT1/Storage.py
    debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py
    debtorrent/trunk/DebTorrent/BT1/StreamCheck.py
    debtorrent/trunk/DebTorrent/BT1/T2T.py
    debtorrent/trunk/DebTorrent/BT1/Uploader.py
    debtorrent/trunk/DebTorrent/BT1/track.py
    debtorrent/trunk/DebTorrent/BTcrypto.py
    debtorrent/trunk/DebTorrent/ConfigDir.py
    debtorrent/trunk/DebTorrent/HTTPCache.py
    debtorrent/trunk/DebTorrent/HTTPHandler.py
    debtorrent/trunk/DebTorrent/RateLimiter.py
    debtorrent/trunk/DebTorrent/RateMeasure.py
    debtorrent/trunk/DebTorrent/RawServer.py
    debtorrent/trunk/DebTorrent/ServerPortHandler.py
    debtorrent/trunk/DebTorrent/SocketHandler.py
    debtorrent/trunk/DebTorrent/bitfield.py
    debtorrent/trunk/DebTorrent/download_bt1.py
    debtorrent/trunk/DebTorrent/inifile.py
    debtorrent/trunk/DebTorrent/iprangeparse.py
    debtorrent/trunk/DebTorrent/launchmanycore.py
    debtorrent/trunk/DebTorrent/parsedir.py
    debtorrent/trunk/DebTorrent/piecebuffer.py
    debtorrent/trunk/DebTorrent/subnetparse.py
    debtorrent/trunk/DebTorrent/torrentlistparse.py
    debtorrent/trunk/btcompletedir.py
    debtorrent/trunk/btmakemetafile.py
    debtorrent/trunk/btshowmetainfo.py
    debtorrent/trunk/debtorrent-client.py
    debtorrent/trunk/debtorrent-tracker.py
    debtorrent/trunk/setup.py

Modified: debtorrent/trunk/DebTorrent/BT1/Choker.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Choker.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Choker.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Choker.py Sat Aug 18 02:06:35 2007
@@ -8,11 +8,6 @@
 
 from random import randrange, shuffle
 from DebTorrent.clock import clock
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 class Choker:
     """Manages the choking and unchoking of other downloaders.

Modified: debtorrent/trunk/DebTorrent/BT1/Connecter.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Connecter.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Connecter.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Connecter.py Sat Aug 18 02:06:35 2007
@@ -32,36 +32,10 @@
 from DebTorrent.bitfield import Bitfield
 from DebTorrent.clock import clock
 from binascii import b2a_hex
+import struct
 import logging
 
-try:
-    True
-except:
-    True = 1
-    False = 0
-
 logger = logging.getLogger('DebTorrent.BT1.Connecter')
-
-def toint(s):
-    """Convert four-byte big endian representation to a long.
-    
-    @type s: C{string}
-    @param s: the string to convert
-    
-    """
-    
-    return long(b2a_hex(s), 16)
-
-def tobinary(i):
-    """Convert an integer to a four-byte big endian representation.
-    
-    @type i: C{int}
-    @param i: the integer to convert
-    
-    """
-    
-    return (chr(i >> 24) + chr((i >> 16) & 0xFF) + 
-        chr((i >> 8) & 0xFF) + chr(i & 0xFF))
 
 CHOKE = chr(0)
 UNCHOKE = chr(1)
@@ -229,8 +203,7 @@
         
         """
         
-        self._send_message(REQUEST + tobinary(index) + 
-            tobinary(begin) + tobinary(length))
+        self._send_message(REQUEST + struct.pack('>iii', index, begin, length))
         logger.debug(self.get_ip()+': sent request '+str(index)+', '+str(begin)+'-'+str(begin+length))
 
     def send_cancel(self, index, begin, length):
@@ -247,8 +220,7 @@
         
         """
         
-        self._send_message(CANCEL + tobinary(index) + 
-            tobinary(begin) + tobinary(length))
+        self._send_message(CANCEL + struct.pack('>iii', index, begin, length))
         logger.debug(self.get_ip()+': sent cancel '+str(index)+', '+str(begin)+'-'+str(begin+length))
 
     def send_bitfield(self, bitfield):
@@ -269,7 +241,7 @@
         
         """
         
-        self._send_message(HAVE + tobinary(index))
+        self._send_message(HAVE + struct.pack('>i', index))
 
     def send_keepalive(self):
         """Send a keepalive message."""
@@ -287,7 +259,7 @@
             logger.debug(self.get_ip()+': SENDING MESSAGE '+str(ord(s[0]))+' ('+str(len(s))+')')
         else:
             logger.debug(self.get_ip()+': SENDING MESSAGE keepalive (0)')
-        s = tobinary(len(s))+s
+        s = struct.pack('>i', len(s))+s
         if self.partial_message:
             self.outqueue.append(s)
         else:
@@ -311,8 +283,8 @@
                 return 0
             index, begin, piece = s
             self.partial_message = ''.join((
-                            tobinary(len(piece) + 9), PIECE,
-                            tobinary(index), tobinary(begin), piece.tostring() ))
+                            struct.pack('>i', len(piece) + 9), PIECE,
+                            struct.pack('>ii', index, begin), piece.tostring() ))
             logger.debug(self.get_ip()+': sending chunk '+str(index)+', '+str(begin)+'-'+str(begin+len(piece)))
 
         if bytes < len(self.partial_message):
@@ -324,7 +296,7 @@
         self.partial_message = None
         if self.send_choke_queued:
             self.send_choke_queued = False
-            self.outqueue.append(tobinary(1)+CHOKE)
+            self.outqueue.append(struct.pack('>i', 1)+CHOKE)
             self.upload.choke_sent()
             self.just_unchoked = 0
         q.extend(self.outqueue)
@@ -567,7 +539,7 @@
                 logger.warning(c.get_ip()+': bad message length, closing connection')
                 connection.close()
                 return
-            i = toint(message[1:])
+            i = struct.unpack('>i', message[1:])[0]
             if i >= self.numpieces:
                 logger.warning(c.get_ip()+': bad piece number, closing connection')
                 connection.close()
@@ -588,36 +560,36 @@
                 logger.warning(c.get_ip()+': bad message length, closing connection')
                 connection.close()
                 return
-            i = toint(message[1:5])
+            i = struct.unpack('>i', message[1:5])[0]
             if i >= self.numpieces:
                 logger.warning(c.get_ip()+': bad piece number, closing connection')
                 connection.close()
                 return
-            c.got_request(i, toint(message[5:9]), 
-                toint(message[9:]))
+            c.got_request(i, struct.unpack('>i', message[5:9])[0], 
+                struct.unpack('>i', message[9:])[0])
         elif t == CANCEL:
             if len(message) != 13:
                 logger.warning(c.get_ip()+': bad message length, closing connection')
                 connection.close()
                 return
-            i = toint(message[1:5])
+            i = struct.unpack('>i', message[1:5])[0]
             if i >= self.numpieces:
                 logger.warning(c.get_ip()+': bad piece number, closing connection')
                 connection.close()
                 return
-            c.upload.got_cancel(i, toint(message[5:9]), 
-                toint(message[9:]))
+            c.upload.got_cancel(i, struct.unpack('>i', message[5:9])[0], 
+                struct.unpack('>i', message[9:])[0])
         elif t == PIECE:
             if len(message) <= 9:
                 logger.warning(c.get_ip()+': bad message length, closing connection')
                 connection.close()
                 return
-            i = toint(message[1:5])
+            i = struct.unpack('>i', message[1:5])[0]
             if i >= self.numpieces:
                 logger.warning(c.get_ip()+': bad piece number, closing connection')
                 connection.close()
                 return
-            if c.download.got_piece(i, toint(message[5:9]), message[9:]):
+            if c.download.got_piece(i, struct.unpack('>i', message[5:9])[0], message[9:]):
                 self.got_piece(i)
         else:
             logger.warning(c.get_ip()+': unknown message type, closing connection')

Modified: debtorrent/trunk/DebTorrent/BT1/Downloader.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Downloader.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Downloader.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Downloader.py Sat Aug 18 02:06:35 2007
@@ -18,11 +18,6 @@
 from random import shuffle
 from DebTorrent.clock import clock
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.BT1.Downloader')
 

Modified: debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/DownloaderFeedback.py Sat Aug 18 02:06:35 2007
@@ -15,12 +15,6 @@
 from cStringIO import StringIO
 from urllib import quote
 from threading import Event
-
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 INIT_STATE = (('R','R+'),('L','L+'))
 

Modified: debtorrent/trunk/DebTorrent/BT1/Encrypter.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Encrypter.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Encrypter.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Encrypter.py Sat Aug 18 02:06:35 2007
@@ -21,18 +21,12 @@
 
 from cStringIO import StringIO
 from binascii import b2a_hex
+import struct
 from socket import error as socketerror
 from DebTorrent.BTcrypto import Crypto
 from DebTorrent.__init__ import protocol_name, make_readable
 import logging
 
-try:
-    True
-except:
-    True = 1
-    False = 0
-    bool = lambda x: not not x
-
 logger = logging.getLogger('DebTorrent.BT1.Encrypter')
 
 DEBUG = False
@@ -40,30 +34,6 @@
 MAX_INCOMPLETE = 8
 
 option_pattern = chr(0)*8
-
-def toint(s):
-    """Convert a 2-byte big-endian string representation back to an integer.
-    
-    @type s: C{string}
-    @param s: the 2 byte big-endian string representation to convert
-    @rtype: C{long}
-    @return: the integer
-    
-    """
-    
-    return long(b2a_hex(s), 16)
-
-def tobinary16(i):
-    """Convert an integer to a 2-byte big-endian string representation.
-    
-    @type i: C{int}
-    @param i: the integer to convert
-    @rtype: C{string}
-    @return: the 2 byte big-endian string representation
-    
-    """
-    
-    return chr((i >> 8) & 0xFF) + chr(i & 0xFF)
 
 
 class IncompleteCounter:
@@ -423,7 +393,7 @@
                       + self.encrypter.encrypt(
                             ('\x00'*8)            # VC
                           + cryptmode             # acceptable crypto modes
-                          + tobinary16(len(padc))
+                          + struct.pack('>h', len(padc))
                           + padc                  # PadC
                           + '\x00\x00' ) )        # no initial payload data
             self._max_search = 520
@@ -504,7 +474,7 @@
         if s[:8] != ('\x00'*8):             # check VC
             logger.info('Dropped the encrypted connection due to a bad VC: '+self.readable_id)
             return None
-        self.cryptmode = toint(s[8:12]) % 4
+        self.cryptmode = struct.unpack('>i', s[8:12])[0] % 4
         if self.cryptmode == 0:
             logger.info('Dropped the encrypted connection due to a bad crypt mode: '+self.readable_id)
             return None                     # no encryption selected
@@ -541,7 +511,7 @@
         padd = self.encrypter.padding()
         self.write( ('\x00'*8)            # VC
                   + cryptmode             # encryption mode
-                  + tobinary16(len(padd))
+                  + struct.pack('>h', len(padd))
                   + padd )                # PadD
         if ialen:
             return ialen, self.read_crypto_ia
@@ -615,7 +585,7 @@
         
         """
         
-        self.cryptmode = toint(s[:4]) % 4
+        self.cryptmode = struct.unpack('>i',s[:4])[0] % 4
         if self.cryptmode == 1:             # only header encryption
             if self.Encoder.config['crypto_only']:
                 logger.info('Dropped the header-only encrypted connection: '+self.readable_id)
@@ -764,7 +734,7 @@
         
         """
         
-        l = toint(s)
+        l = struct.unpack('>i', s)[0]
         if l > self.Encoder.max_len:
             logger.warning('Dropped the connection due to bad length message: '+self.readable_id)
             return None

Modified: debtorrent/trunk/DebTorrent/BT1/FileSelector.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/FileSelector.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/FileSelector.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/FileSelector.py Sat Aug 18 02:06:35 2007
@@ -13,11 +13,6 @@
 
 from random import shuffle
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.BT1.FileSelector')
 

Modified: debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/HTTPDownloader.py Sat Aug 18 02:06:35 2007
@@ -23,11 +23,6 @@
 from threading import Thread
 import logging
 from DebTorrent.__init__ import product_name,version_short
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.BT1.HTTPDownloader')
 

Modified: debtorrent/trunk/DebTorrent/BT1/NatCheck.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/NatCheck.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/NatCheck.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/NatCheck.py Sat Aug 18 02:06:35 2007
@@ -16,12 +16,7 @@
 from DebTorrent.BTcrypto import Crypto, CRYPTO_OK
 from DebTorrent.__init__ import protocol_name
 from binascii import b2a_hex
-
-try:
-    True
-except:
-    True = 1
-    False = 0
+import struct
 
 CHECK_PEER_ID_ENCRYPTED = True
 
@@ -203,7 +198,7 @@
                   + self.encrypter.encrypt(
                         ('\x00'*8)            # VC
                       + cryptmode             # acceptable crypto modes
-                      + tobinary16(len(padc))
+                      + struct.pack('>h', len(padc))
                       + padc                  # PadC
                       + '\x00\x00' ) )        # no initial payload data
         self._max_search = 520
@@ -265,7 +260,7 @@
         
         """
         
-        self.cryptmode = toint(s[:4]) % 4
+        self.cryptmode = struct.unpack('>i',s[:4])[0] % 4
         if self.cryptmode != 2:
             logger.info('Dropped the encrypted connection due to an unknown crypt mode: '+self.readable_id)
             return None                     # unknown encryption

Modified: debtorrent/trunk/DebTorrent/BT1/PiecePicker.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/PiecePicker.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/PiecePicker.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/PiecePicker.py Sat Aug 18 02:06:35 2007
@@ -14,11 +14,6 @@
 from random import randrange, shuffle
 from DebTorrent.clock import clock
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.BT1.Rerequester')
 

Modified: debtorrent/trunk/DebTorrent/BT1/Rerequester.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Rerequester.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Rerequester.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Rerequester.py Sat Aug 18 02:06:35 2007
@@ -37,12 +37,6 @@
     def getpid():
         return 1
     
-try:
-    True
-except:
-    True = 1
-    False = 0
-
 logger = logging.getLogger('DebTorrent.BT1.Rerequester')
 
 mapbase64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-'

Modified: debtorrent/trunk/DebTorrent/BT1/Statistics.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Statistics.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Statistics.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Statistics.py Sat Aug 18 02:06:35 2007
@@ -7,11 +7,6 @@
 """Generate statistics for the swarm."""
 
 from threading import Event
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 class Statistics_Response:
     """Empty class to add arbitrary variables to."""

Modified: debtorrent/trunk/DebTorrent/BT1/Storage.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Storage.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Storage.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Storage.py Sat Aug 18 02:06:35 2007
@@ -28,18 +28,9 @@
 from os.path import exists, getsize, getmtime, basename, split
 from os import makedirs
 import logging
-try:
-    from os import fsync
-except ImportError:
-    fsync = lambda x: None
+from os import fsync
 from bisect import bisect
     
-try:
-    True
-except:
-    True = 1
-    False = 0
-
 logger = logging.getLogger('DebTorrent.BT1.Storage')
 
 MAXREADSIZE = 32768

Modified: debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py Sat Aug 18 02:06:35 2007
@@ -18,17 +18,7 @@
 from DebTorrent.clock import clock
 from random import randrange
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
-try:
-    from bisect import insort
-except:
-    def insort(l, item):
-        l.append(item)
-        l.sort()
+from bisect import insort
 
 logger = logging.getLogger('DebTorrent.BT1.StorageWrapper')
 

Modified: debtorrent/trunk/DebTorrent/BT1/StreamCheck.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/StreamCheck.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/StreamCheck.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/StreamCheck.py Sat Aug 18 02:06:35 2007
@@ -15,46 +15,13 @@
 from binascii import b2a_hex
 from socket import error as socketerror
 from urllib import quote
-from DebTorrent.__init__ import protocol_name
+from DebTorrent.__init__ import protocol_name, make_readable
 import Connecter
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.BT1.StreamCheck')
 
 option_pattern = chr(0)*8
-
-def toint(s):
-    return long(b2a_hex(s), 16)
-
-def tobinary(i):
-    return (chr(i >> 24) + chr((i >> 16) & 0xFF) + 
-        chr((i >> 8) & 0xFF) + chr(i & 0xFF))
-
-hexchars = '0123456789ABCDEF'
-hexmap = []
-for i in xrange(256):
-    hexmap.append(hexchars[(i&0xF0)/16]+hexchars[i&0x0F])
-
-def tohex(s):
-    r = []
-    for c in s:
-        r.append(hexmap[ord(c)])
-    return ''.join(r)
-
-def make_readable(s):
-    if not s:
-        return ''
-    if quote(s).find('%') >= 0:
-        return tohex(s)
-    return '"'+s+'"'
-   
-def toint(s):
-    return long(b2a_hex(s), 16)
 
 # header, reserved, download id, my id, [length, message]
 
@@ -83,7 +50,7 @@
         return 20, self.read_download_id
 
     def read_download_id(self, s):
-        logger.debug(str(self.no)+' download ID ' + tohex(s))
+        logger.debug(str(self.no)+' download ID ' + b2a_hex(s))
         return 20, self.read_peer_id
 
     def read_peer_id(self, s):
@@ -91,7 +58,7 @@
         return 4, self.read_len
 
     def read_len(self, s):
-        l = toint(s)
+        l = struct.unpack('>i',s)[0]
         if l > 2 ** 23:
             logger.warning(str(self.no)+' BAD LENGTH: '+str(l)+' ('+s+')')
         return l, self.read_message
@@ -106,21 +73,16 @@
             if len(s) != 13:
                 logger.warning(str(self.no)+' BAD REQUEST SIZE: '+str(len(s)))
                 return 4, self.read_len
-            index = toint(s[1:5])
-            begin = toint(s[5:9])
-            length = toint(s[9:])
+            index, begin, length = struct.unpack('>iii',s[1:])
             logger.info(str(self.no)+' Request: '+str(index)+': '+str(begin)+'-'+str(begin)+'+'+str(length))
         elif m == Connecter.CANCEL:
             if len(s) != 13:
                 logger.warning(str(self.no)+' BAD CANCEL SIZE: '+str(len(s)))
                 return 4, self.read_len
-            index = toint(s[1:5])
-            begin = toint(s[5:9])
-            length = toint(s[9:])
+            index, begin, length = struct.unpack('>iii',s[1:])
             logger.info(str(self.no)+' Cancel: '+str(index)+': '+str(begin)+'-'+str(begin)+'+'+str(length))
         elif m == Connecter.PIECE:
-            index = toint(s[1:5])
-            begin = toint(s[5:9])
+            index, begin = struct.unpack('>ii',s[1:9])
             length = len(s)-9
             logger.info(str(self.no)+' Piece: '+str(index)+': '+str(begin)+'-'+str(begin)+'+'+str(length))
         else:

Modified: debtorrent/trunk/DebTorrent/BT1/T2T.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/T2T.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/T2T.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/T2T.py Sat Aug 18 02:06:35 2007
@@ -22,11 +22,6 @@
 from string import lower
 import sys, logging
 import __init__
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.BT1.T2T')
 

Modified: debtorrent/trunk/DebTorrent/BT1/Uploader.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Uploader.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Uploader.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Uploader.py Sat Aug 18 02:06:35 2007
@@ -7,12 +7,6 @@
 """Manage uploading to a single peer."""
 
 from DebTorrent.CurrentRateMeasure import Measure
-
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 class Upload:
     """Manage uploading to a single peer.

Modified: debtorrent/trunk/DebTorrent/BT1/track.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/track.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/track.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/track.py Sat Aug 18 02:06:35 2007
@@ -51,12 +51,6 @@
 import DebTorrent.__init__
 from DebTorrent.__init__ import version, createPeerID
 from DebTorrent.ConfigDir import ConfigDir
-try:
-    True
-except:
-    True = 1
-    False = 0
-    bool = lambda x: not not x
 
 logger = logging.getLogger('DebTorrent.BT1.track')
 

Modified: debtorrent/trunk/DebTorrent/BTcrypto.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BTcrypto.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BTcrypto.py (original)
+++ debtorrent/trunk/DebTorrent/BTcrypto.py Sat Aug 18 02:06:35 2007
@@ -27,12 +27,6 @@
     urandom = lambda x: ''.join([chr(randint(0,255)) for i in xrange(x)])
 from sha import sha
 
-try:
-    True
-except:
-    True = 1
-    False = 0
-    
 try:
     from Crypto.Cipher import ARC4
     CRYPTO_OK = True

Modified: debtorrent/trunk/DebTorrent/ConfigDir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/ConfigDir.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/ConfigDir.py (original)
+++ debtorrent/trunk/DebTorrent/ConfigDir.py Sat Aug 18 02:06:35 2007
@@ -8,12 +8,6 @@
 
 @type DIRNAME: C{string}
 @var DIRNAME: the directory name to use for storing config files
- at type hexchars: C{string}
- at var hexchars: the 16 hex characters, in order
- at type hexmap: C{list}
- at var hexmap: a mapping from characters to the hex repesentation of the character
- at type revmap: C{dictionary}
- at var revmap: the reverse of L{hexmap}
 
 """
 
@@ -24,51 +18,10 @@
 from __init__ import product_name, version_short
 import sys,os
 from time import time, strftime
-
-try:
-    True
-except:
-    True = 1
-    False = 0
+from binascii import b2a_hex, a2b_hex
 
 DIRNAME = '.'+product_name
 MASTER_CONFIG = '/etc/debtorrent'
-
-hexchars = '0123456789abcdef'
-hexmap = []
-revmap = {}
-for i in xrange(256):
-    x = hexchars[(i&0xF0)/16]+hexchars[i&0x0F]
-    hexmap.append(x)
-    revmap[x] = chr(i)
-
-def tohex(s):
-    """Convert a string to hex representation.
-    
-    @type s: C{string}
-    @param s: the string to convert
-    @rtype: C{string}
-    @return: the converted string
-    
-    """
-    
-    r = []
-    for c in s:
-        r.append(hexmap[ord(c)])
-    return ''.join(r)
-
-def unhex(s):
-    """Convert a hex representation back to a string.
-    
-    @type s: C{string}
-    @param s: the hex representation of a string
-    @rtype: C{string}
-    @return: the original string
-    
-    """
-    
-    r = [ revmap[s[x:x+2]] for x in xrange(0, len(s), 2) ]
-    return ''.join(r)
 
 def copyfile(oldpath, newpath):
     """Simple file copy, all in RAM.
@@ -408,7 +361,7 @@
                 f, garbage = f.split('.')
             except:
                 pass
-            d[unhex(f)] = 1
+            d[a2b_hex(f)] = 1
         return d.keys()
 
     def getTorrentVariations(self, t):
@@ -421,7 +374,7 @@
         
         """
         
-        t = tohex(t)
+        t = b2a_hex(t)
         d = []
         for f in os.listdir(self.dir_torrentcache):
             f = os.path.basename(f)
@@ -448,7 +401,7 @@
         
         if v == -1:
             v = max(self.getTorrentVariations(t))   # potential exception
-        t = tohex(t)
+        t = b2a_hex(t)
         if v:
             t += '.'+str(v)
         try:
@@ -504,7 +457,7 @@
                 v = max(self.getTorrentVariations(t))+1
             except:
                 v = 0
-        t = tohex(t)
+        t = b2a_hex(t)
         if v:
             t += '.'+str(v)
         try:
@@ -533,7 +486,7 @@
         
         if self.TorrentDataBuffer.has_key(t):
             return self.TorrentDataBuffer[t]
-        t = os.path.join(self.dir_datacache,tohex(t))
+        t = os.path.join(self.dir_datacache,b2a_hex(t))
         if not os.path.exists(t):
             return None
         try:
@@ -562,7 +515,7 @@
 
         self.TorrentDataBuffer[t] = data
         try:
-            f = open(os.path.join(self.dir_datacache,tohex(t)),'wb')
+            f = open(os.path.join(self.dir_datacache,b2a_hex(t)),'wb')
             f.write(bencode(data))
             success = True
         except:
@@ -584,7 +537,7 @@
         """
 
         try:
-            os.remove(os.path.join(self.dir_datacache,tohex(t)))
+            os.remove(os.path.join(self.dir_datacache,b2a_hex(t)))
         except:
             pass
 
@@ -598,7 +551,7 @@
         
         """
 
-        return os.path.join(self.dir_piececache,tohex(t))
+        return os.path.join(self.dir_piececache,b2a_hex(t))
 
 
     ###### EXPIRATION HANDLING ######
@@ -630,7 +583,7 @@
             except:
                 pass
             try:
-                f = unhex(f)
+                f = a2b_hex(f)
                 assert len(f) == 20
             except:
                 continue
@@ -645,7 +598,7 @@
         for f in os.listdir(self.dir_datacache):
             p = os.path.join(self.dir_datacache,f)
             try:
-                f = unhex(os.path.basename(f))
+                f = a2b_hex(os.path.basename(f))
                 assert len(f) == 20
             except:
                 continue
@@ -659,7 +612,7 @@
         for f in os.listdir(self.dir_piececache):
             p = os.path.join(self.dir_piececache,f)
             try:
-                f = unhex(os.path.basename(f))
+                f = a2b_hex(os.path.basename(f))
                 assert len(f) == 20
             except:
                 continue

Modified: debtorrent/trunk/DebTorrent/HTTPCache.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/HTTPCache.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/HTTPCache.py (original)
+++ debtorrent/trunk/DebTorrent/HTTPCache.py Sat Aug 18 02:06:35 2007
@@ -28,11 +28,6 @@
 from time import strftime, strptime, gmtime
 from calendar import timegm
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.HTTPCache')
 

Modified: debtorrent/trunk/DebTorrent/HTTPHandler.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/HTTPHandler.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/HTTPHandler.py (original)
+++ debtorrent/trunk/DebTorrent/HTTPHandler.py Sat Aug 18 02:06:35 2007
@@ -21,11 +21,6 @@
 from clock import clock
 from gzip import GzipFile
 import signal, logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.HTTPHandler')
 

Modified: debtorrent/trunk/DebTorrent/RateLimiter.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/RateLimiter.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/RateLimiter.py (original)
+++ debtorrent/trunk/DebTorrent/RateLimiter.py Sat Aug 18 02:06:35 2007
@@ -51,16 +51,6 @@
 from CurrentRateMeasure import Measure
 from cStringIO import StringIO
 from math import sqrt
-
-try:
-    True
-except:
-    True = 1
-    False = 0
-try:
-    sum([1])
-except:
-    sum = lambda a: reduce(lambda x,y: x+y, a, 0)
 
 logger = logging.getLogger('DebTorrent.RateLimiter')
 

Modified: debtorrent/trunk/DebTorrent/RateMeasure.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/RateMeasure.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/RateMeasure.py (original)
+++ debtorrent/trunk/DebTorrent/RateMeasure.py Sat Aug 18 02:06:35 2007
@@ -12,11 +12,6 @@
 """
 
 from clock import clock
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 FACTOR = 0.999
 

Modified: debtorrent/trunk/DebTorrent/RawServer.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/RawServer.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/RawServer.py (original)
+++ debtorrent/trunk/DebTorrent/RawServer.py Sat Aug 18 02:06:35 2007
@@ -24,11 +24,6 @@
 from clock import clock
 from signal import signal, SIGINT, SIG_DFL
 import sys, logging
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.RawServer')
 

Modified: debtorrent/trunk/DebTorrent/ServerPortHandler.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/ServerPortHandler.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/ServerPortHandler.py (original)
+++ debtorrent/trunk/DebTorrent/ServerPortHandler.py Sat Aug 18 02:06:35 2007
@@ -17,14 +17,8 @@
 #from RawServer import RawServer
 from BTcrypto import Crypto
 from binascii import b2a_hex
+from BT1.Encrypter import protocol_name
 import logging
-try:
-    True
-except:
-    True = 1
-    False = 0
-
-from BT1.Encrypter import protocol_name
 
 logger = logging.getLogger('DebTorrent.ServerPortHandler')
 

Modified: debtorrent/trunk/DebTorrent/SocketHandler.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/SocketHandler.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/SocketHandler.py (original)
+++ debtorrent/trunk/DebTorrent/SocketHandler.py Sat Aug 18 02:06:35 2007
@@ -27,11 +27,6 @@
 from random import shuffle, randrange
 # from BT1.StreamCheck import StreamCheck
 # import inspect
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.SocketHandler')
 
@@ -334,10 +329,7 @@
                 socktype = socket.AF_INET
             bind = bind.split(',')
             for addr in bind:
-                if sys.version_info < (2,2):
-                    addrinfos.append((socket.AF_INET, None, None, None, (addr, port)))
-                else:
-                    addrinfos.extend(socket.getaddrinfo(addr, port,
+                addrinfos.extend(socket.getaddrinfo(addr, port,
                                                socktype, socket.SOCK_STREAM))
         else:
             if self.ipv6_enable:
@@ -492,30 +484,27 @@
         
         if handler is None:
             handler = self.handler
-        if sys.version_info < (2,2):
-            s = self.start_connection_raw(dns,socket.AF_INET,handler)
+        if self.ipv6_enable:
+            socktype = socket.AF_UNSPEC
         else:
-            if self.ipv6_enable:
-                socktype = socket.AF_UNSPEC
-            else:
-                socktype = socket.AF_INET
-            try:
-                addrinfos = socket.getaddrinfo(dns[0], int(dns[1]),
-                                               socktype, socket.SOCK_STREAM)
-            except socket.error, e:
-                raise
-            except Exception, e:
-                raise socket.error(str(e))
-            if randomize:
-                shuffle(addrinfos)
-            for addrinfo in addrinfos:
-                try:
-                    s = self.start_connection_raw(addrinfo[4],addrinfo[0],handler)
-                    break
-                except:
-                    pass
-            else:
-                raise socket.error('unable to connect')
+            socktype = socket.AF_INET
+        try:
+            addrinfos = socket.getaddrinfo(dns[0], int(dns[1]),
+                                           socktype, socket.SOCK_STREAM)
+        except socket.error, e:
+            raise
+        except Exception, e:
+            raise socket.error(str(e))
+        if randomize:
+            shuffle(addrinfos)
+        for addrinfo in addrinfos:
+            try:
+                s = self.start_connection_raw(addrinfo[4],addrinfo[0],handler)
+                break
+            except:
+                pass
+        else:
+            raise socket.error('unable to connect')
         return s
 
 

Modified: debtorrent/trunk/DebTorrent/bitfield.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/bitfield.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/bitfield.py (original)
+++ debtorrent/trunk/DebTorrent/bitfield.py Sat Aug 18 02:06:35 2007
@@ -17,18 +17,7 @@
 
 """
 
-try:
-    True
-except:
-    True = 1
-    False = 0
-    bool = lambda x: not not x
-
-try:
-    sum([1])
-    negsum = lambda a: len(a)-sum(a)
-except:
-    negsum = lambda a: reduce(lambda x,y: x+(not y), a, 0)
+negsum = lambda a: len(a)-sum(a)
     
 def _int_to_booleans(x):
     """Convert an integer to a list of booleans.

Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Sat Aug 18 02:06:35 2007
@@ -50,12 +50,6 @@
 from gzip import GzipFile
 from StringIO import StringIO
 import binascii, logging
-
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.download_bt1')
 

Modified: debtorrent/trunk/DebTorrent/inifile.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/inifile.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/inifile.py (original)
+++ debtorrent/trunk/DebTorrent/inifile.py Sat Aug 18 02:06:35 2007
@@ -36,16 +36,7 @@
 from cStringIO import StringIO
 from types import DictType, StringType
 import logging
-try:
-    from types import BooleanType
-except ImportError:
-    BooleanType = None
-
-try:
-    True
-except:
-    True = 1
-    False = 0
+from types import BooleanType
 
 logger = logging.getLogger('DebTorrent.inifile')
 

Modified: debtorrent/trunk/DebTorrent/iprangeparse.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/iprangeparse.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/iprangeparse.py (original)
+++ debtorrent/trunk/DebTorrent/iprangeparse.py Sat Aug 18 02:06:35 2007
@@ -16,13 +16,6 @@
 
 from bisect import bisect, insort
 import logging
-
-try:
-    True
-except:
-    True = 1
-    False = 0
-    bool = lambda x: not not x
 
 logger = logging.getLogger('DebTorrent.iprangeparse')
 

Modified: debtorrent/trunk/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/launchmanycore.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/launchmanycore.py (original)
+++ debtorrent/trunk/DebTorrent/launchmanycore.py Sat Aug 18 02:06:35 2007
@@ -35,12 +35,6 @@
 import logging
 from DebTorrent.BT1.AptListener import AptListener
 from DebTorrent.HTTPHandler import HTTPHandler
-
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.launchmanycore')
 

Modified: debtorrent/trunk/DebTorrent/parsedir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/parsedir.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/parsedir.py (original)
+++ debtorrent/trunk/DebTorrent/parsedir.py Sat Aug 18 02:06:35 2007
@@ -16,12 +16,6 @@
 from os.path import exists, isfile
 from sha import sha
 import sys, os, logging
-
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.parsedir')
 

Modified: debtorrent/trunk/DebTorrent/piecebuffer.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/piecebuffer.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/piecebuffer.py (original)
+++ debtorrent/trunk/DebTorrent/piecebuffer.py Sat Aug 18 02:06:35 2007
@@ -19,11 +19,6 @@
 from threading import Lock
 import logging
 # import inspect
-try:
-    True
-except:
-    True = 1
-    False = 0
     
 logger = logging.getLogger('DebTorrent.piecebuffer')
 

Modified: debtorrent/trunk/DebTorrent/subnetparse.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/subnetparse.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/subnetparse.py (original)
+++ debtorrent/trunk/DebTorrent/subnetparse.py Sat Aug 18 02:06:35 2007
@@ -20,13 +20,6 @@
 
 from bisect import bisect, insort
 import logging
-
-try:
-    True
-except:
-    True = 1
-    False = 0
-    bool = lambda x: not not x
 
 logger = logging.getLogger('DebTorrent.subnetparse')
 

Modified: debtorrent/trunk/DebTorrent/torrentlistparse.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/torrentlistparse.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/torrentlistparse.py (original)
+++ debtorrent/trunk/DebTorrent/torrentlistparse.py Sat Aug 18 02:06:35 2007
@@ -13,12 +13,6 @@
 
 from binascii import unhexlify
 import logging
-
-try:
-    True
-except:
-    True = 1
-    False = 0
 
 logger = logging.getLogger('DebTorrent.torrentlistparse')
 

Modified: debtorrent/trunk/btcompletedir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/btcompletedir.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/btcompletedir.py (original)
+++ debtorrent/trunk/btcompletedir.py Sat Aug 18 02:06:35 2007
@@ -21,8 +21,8 @@
     except:
         pass
 
-from sys import argv, version, exit
-assert version >= '2', "Install Python 2.0 or greater"
+from sys import argv, version_info, exit
+assert version_info >= (2,3), "Install Python 2.3 or greater"
 from os.path import split
 from DebTorrent.BT1.makemetafile import defaults, completedir, print_announcelist_details
 from DebTorrent.parseargs import parseargs, formatDefinitions

Modified: debtorrent/trunk/btmakemetafile.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/btmakemetafile.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/btmakemetafile.py (original)
+++ debtorrent/trunk/btmakemetafile.py Sat Aug 18 02:06:35 2007
@@ -23,12 +23,11 @@
     except:
         pass
 
-from sys import argv, version, exit
+from sys import argv, version, exit, version_info
 from os.path import split
-assert version >= '2', "Install Python 2.0 or greater"
+assert version_info >= (2,3), 'Requires Python 2.3 or better'
 from DebTorrent.BT1.makemetafile import make_meta_file, defaults, print_announcelist_details
 from DebTorrent.parseargs import parseargs, formatDefinitions
-
 
 def prog(amount):
     """Display the current status of the file scan.

Modified: debtorrent/trunk/btshowmetainfo.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/btshowmetainfo.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/btshowmetainfo.py (original)
+++ debtorrent/trunk/btshowmetainfo.py Sat Aug 18 02:06:35 2007
@@ -14,6 +14,8 @@
 from sha import *
 from DebTorrent.bencode import *
 from DebTorrent.download_bt1 import get_packages
+
+assert version_info >= (2,3), 'Requires Python 2.3 or better'
 
 NAME, EXT = splitext(basename(argv[0]))
 VERSION = '20030621'

Modified: debtorrent/trunk/debtorrent-client.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent-client.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent-client.py (original)
+++ debtorrent/trunk/debtorrent-client.py Sat Aug 18 02:06:35 2007
@@ -26,10 +26,12 @@
 from DebTorrent.launchmanycore import LaunchMany
 from DebTorrent.download_bt1 import defaults, get_usage
 from DebTorrent.parseargs import parseargs
-from sys import argv, exit
+from sys import argv, exit, version_info
 import os, logging
 from DebTorrent import version
 from DebTorrent.ConfigDir import ConfigDir
+
+assert version_info >= (2,3), 'Requires Python 2.3 or better'
 
 logger = logging.getLogger()
 

Modified: debtorrent/trunk/debtorrent-tracker.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent-tracker.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent-tracker.py (original)
+++ debtorrent/trunk/debtorrent-tracker.py Sat Aug 18 02:06:35 2007
@@ -19,8 +19,10 @@
 
 PROFILE = 0
     
-from sys import argv
+from sys import argv, version_info
 from DebTorrent.BT1.track import track
+
+assert version_info >= (2,3), 'Requires Python 2.3 or better'
 
 if __name__ == '__main__':
     if PROFILE:

Modified: debtorrent/trunk/setup.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/setup.py?rev=266&op=diff
==============================================================================
--- debtorrent/trunk/setup.py (original)
+++ debtorrent/trunk/setup.py Sat Aug 18 02:06:35 2007
@@ -15,7 +15,7 @@
 """
 
 import sys
-assert sys.version >= '2', "Install Python 2.0 or greater"
+assert sys.version_info >= (2,3), "Install Python 2.3 or greater"
 from distutils.core import setup, Extension
 import DebTorrent
 




More information about the Debtorrent-commits mailing list