]> arthur.barton.de Git - bup.git/commitdiff
Fix some problems running on older Debian.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 3 Jan 2010 11:32:32 +0000 (06:32 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 3 Jan 2010 11:32:32 +0000 (06:32 -0500)
python 2.5 (pre-2.5.2) can't struct.unpack from a buffer(); coerce it to a
string first.

The default python is 2.4, so run /usr/bin/python2.5 explicitly.

bup.py
cmd-init.py
cmd-save.py
cmd-server.py
cmd-split.py
git.py
wvtest.py

diff --git a/bup.py b/bup.py
index d5b5c767df98ab8eb5cae1027de2577c3e3006a0..281ac7397f24a517a8549f9480ee509fa5bff50e 100755 (executable)
--- a/bup.py
+++ b/bup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 import sys, os, git
 
 argv = sys.argv
index 651541afde08db51f6ebcf857e6f6e637fd47137..cbcdad002e9b918b24ae391aa702852ff1ef0b60 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 import git, options
 from helpers import *
 
index 14cacf1c695ef34ed7ea19ba5ea398f42874c06a..e68539c730a3e57ac6f1213fcd8c78c528bf4404 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 import sys, re, errno, stat
 import hashsplit, git, options
 from helpers import *
index a535fdf3f5fd13b86ed92f4599e751338fff5528..920340c3c1e7799cade5242b4d16f690b311e947 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 import sys, struct, mmap
 import options, git
 from helpers import *
index a165d946428708be1c142887529a2f3dc16ba0c1..ed28fc2a7c84fdc98f24abb198e5327c315a943e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 import sys, time, re, struct
 import hashsplit, git, options
 from helpers import *
diff --git a/git.py b/git.py
index 4f9c5e4379342a69304724edfaa1f8444ab87c91..ec60ae45b98c9af4fc7fab3d8dc5f27b48eb1877 100644 (file)
--- a/git.py
+++ b/git.py
@@ -20,7 +20,8 @@ class PackIndex:
                              mmap.MAP_SHARED, mmap.PROT_READ)
         f.close()  # map will persist beyond file close
         assert(str(self.map[0:8]) == '\377tOc\0\0\0\2')
-        self.fanout = list(struct.unpack('!256I', buffer(self.map, 8, 256*4)))
+        self.fanout = list(struct.unpack('!256I',
+                                         str(buffer(self.map, 8, 256*4))))
         self.fanout.append(0)  # entry "-1"
         nsha = self.fanout[255]
         self.ofstable = buffer(self.map,
@@ -30,10 +31,11 @@ class PackIndex:
                                  8 + 256*4 + nsha*20 + nsha*4 + nsha*4)
 
     def _ofs_from_idx(self, idx):
-        ofs = struct.unpack('!I', buffer(self.ofstable, idx*4, 4))[0]
+        ofs = struct.unpack('!I', str(buffer(self.ofstable, idx*4, 4)))[0]
         if ofs & 0x80000000:
             idx64 = ofs & 0x7fffffff
-            ofs = struct.unpack('!I', buffer(self.ofs64table, idx64*8, 8))[0]
+            ofs = struct.unpack('!I',
+                                str(buffer(self.ofs64table, idx64*8, 8)))[0]
         return ofs
 
     def _idx_from_hash(self, hash):
index a5d1930c43dbfbdbb648661e81fbf15a42df5e80..b5e86ba2d64eb064879d66638b5caa3d0a918d2c 100755 (executable)
--- a/wvtest.py
+++ b/wvtest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.5
 import traceback
 import os
 import re