summaryrefslogtreecommitdiff
path: root/gitdb/stream.py
diff options
context:
space:
mode:
authorKevin Brown <kevin@kevinbrown.in>2014-07-13 15:41:15 -0400
committerKevin Brown <kevin@kevinbrown.in>2014-07-13 15:41:15 -0400
commitb6c493deb2341fb843d71b66b2aa23078638755c (patch)
treedb4695c1056b41136180c9cef8fdf4342e499862 /gitdb/stream.py
parent1c6f4c19289732bd13507eba9e54c9d692957137 (diff)
downloadgitdb-b6c493deb2341fb843d71b66b2aa23078638755c.tar.gz
Pick off the low hanging fruit
This fixes most of the import errors that came from using the implicit relative imports that Python 2 supports. This also fixes the use of `xrange`, which has replaced `range` in Python 3. The same has happened for `izip`, which is also being aliased. The octal number syntax changed in Python 3, so we are now converting from strings using the `int` built-in function, which will produce the same output across both versions of Python.
Diffstat (limited to 'gitdb/stream.py')
-rw-r--r--gitdb/stream.py43
1 files changed, 25 insertions, 18 deletions
diff --git a/gitdb/stream.py b/gitdb/stream.py
index b21c39c..52b54af 100644
--- a/gitdb/stream.py
+++ b/gitdb/stream.py
@@ -3,28 +3,35 @@
# This module is part of GitDB and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
-from cStringIO import StringIO
+try:
+ from cStringIO import StringIO
+except ImportError:
+ try:
+ from StringIO import StringIO
+ except ImportError:
+ from io import StringIO
+
import errno
import mmap
import os
-from fun import (
- msb_size,
- stream_copy,
- apply_delta_data,
- connect_deltas,
- DeltaChunkList,
- delta_types
- )
-
-from util import (
- allocate_memory,
- LazyMixin,
- make_sha,
- write,
- close,
- zlib
- )
+from gitdb.fun import (
+ msb_size,
+ stream_copy,
+ apply_delta_data,
+ connect_deltas,
+ DeltaChunkList,
+ delta_types
+)
+
+from gitdb.util import (
+ allocate_memory,
+ LazyMixin,
+ make_sha,
+ write,
+ close,
+ zlib
+)
has_perf_mod = False
try: