From: Avery Pennarun Date: Sun, 3 Jan 2010 11:32:32 +0000 (-0500) Subject: Fix some problems running on older Debian. X-Git-Tag: bup-0.01~5 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba4d48af99077d191315b0f7503ab968c2546e22;hp=1fbc13ae740b04e7d14be08b875e42d85e1c1e90;p=bup.git Fix some problems running on older Debian. 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. --- diff --git a/bup.py b/bup.py index d5b5c76..281ac73 100755 --- 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 diff --git a/cmd-init.py b/cmd-init.py index 651541a..cbcdad0 100755 --- a/cmd-init.py +++ b/cmd-init.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2.5 import git, options from helpers import * diff --git a/cmd-save.py b/cmd-save.py index 14cacf1..e68539c 100755 --- a/cmd-save.py +++ b/cmd-save.py @@ -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 * diff --git a/cmd-server.py b/cmd-server.py index a535fdf..920340c 100755 --- a/cmd-server.py +++ b/cmd-server.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2.5 import sys, struct, mmap import options, git from helpers import * diff --git a/cmd-split.py b/cmd-split.py index a165d94..ed28fc2 100755 --- a/cmd-split.py +++ b/cmd-split.py @@ -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 4f9c5e4..ec60ae4 100644 --- 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): diff --git a/wvtest.py b/wvtest.py index a5d1930..b5e86ba 100755 --- 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