Add SEEK_END to misc.py, since it was added in 2.5.
authorDave Borowitz <dborowitz@google.com>
Fri, 16 Apr 2010 23:05:53 +0000 (16:05 -0700)
committerDave Borowitz <dborowitz@google.com>
Fri, 30 Apr 2010 16:42:54 +0000 (09:42 -0700)
Change-Id: I9caa891e53423b444063b2801da4043489647703

dulwich/misc.py
dulwich/pack.py
dulwich/protocol.py

index c1e313a05f0a6941c8b5f0a0f38f123f765c2842..fba21bc6bb22323c3ee87c16cc83970aee9ec651 100644 (file)
@@ -30,6 +30,11 @@ try:
 except ImportError:
     from cgi import parse_qs
 
+try:
+    from os import SEEK_END
+except ImportError:
+    SEEK_END = 2
+
 import struct
 
 
index e52dc7cb81001797d1c18af23ed2d61afbbc9688..43bc24de0c0560f9984ef9a97eb74b5f08e0456d 100644 (file)
@@ -67,6 +67,7 @@ from dulwich.lru_cache import (
     )
 from dulwich.misc import (
     make_sha,
+    SEEK_END,
     )
 from dulwich.objects import (
     ShaFile,
@@ -553,7 +554,7 @@ class PackStreamReader(object):
     def _buf_len(self):
         buf = self._rbuf
         start = buf.tell()
-        buf.seek(0, os.SEEK_END)
+        buf.seek(0, SEEK_END)
         end = buf.tell()
         buf.seek(start)
         return end - start
index 340373c504f2fb1a40edba4329b8da79b555c30c..7b339281cbab73e6c210ec4f82151b8e439c35c0 100644 (file)
@@ -27,6 +27,9 @@ from dulwich.errors import (
     HangupException,
     GitProtocolError,
     )
+from dulwich.misc import (
+    SEEK_END,
+    )
 
 TCP_GIT_PORT = 9418
 
@@ -193,7 +196,7 @@ class ReceivableProtocol(Protocol):
         #  - omit the size <= 0 branch
         #  - seek back to start rather than 0 in case some buffer has been
         #    consumed.
-        #  - use os.SEEK_END instead of the magic number.
+        #  - use SEEK_END instead of the magic number.
         # Copyright (c) 2001-2010 Python Software Foundation; All Rights Reserved
         # Licensed under the Python Software Foundation License.
         # TODO: see if buffer is more efficient than cStringIO.
@@ -204,7 +207,7 @@ class ReceivableProtocol(Protocol):
         # rbufsize is large compared to the typical return value of recv().
         buf = self._rbuf
         start = buf.tell()
-        buf.seek(0, os.SEEK_END)
+        buf.seek(0, SEEK_END)
         # buffer may have been partially consumed by recv()
         buf_len = buf.tell() - start
         if buf_len >= size:
@@ -252,7 +255,7 @@ class ReceivableProtocol(Protocol):
 
         buf = self._rbuf
         start = buf.tell()
-        buf.seek(0, os.SEEK_END)
+        buf.seek(0, SEEK_END)
         buf_len = buf.tell()
         buf.seek(start)