From 014cdaff5d18ef054b57e4f0f540b6c75d35c0f1 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Mon, 18 Feb 2013 14:42:34 -0600 Subject: [PATCH] Officially drop support for Python 2.4. Signed-off-by: Rob Browning Tested-by: Alexander Barton --- README.md | 7 +++---- cmd/midx-cmd.py | 2 +- lib/bup/git.py | 3 +-- lib/bup/helpers.py | 15 ++------------- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 29b096e..0b740ec 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Reasons you might want to avoid bup for you, but we don't know why. It is also missing some probably-critical features. - - It requires python >= 2.4, a C compiler, and an installed git version >= + - It requires python >= 2.5, a C compiler, and an installed git version >= 1.5.3.1. - It currently only works on Linux, MacOS X >= 10.4, @@ -99,9 +99,8 @@ From source apt-get install python-pyxattr python-pylibacl apt-get install linux-libc-dev - Substitute python2.5-dev or python2.4-dev if you have an older - system. Alternately, on newer Debian/Ubuntu versions, you can try - this: + Substitute python2.5-dev if you have an older system. Alternately, + on newer Debian/Ubuntu versions, you can try this: apt-get build-dep bup diff --git a/cmd/midx-cmd.py b/cmd/midx-cmd.py index bbbee07..1243c8d 100755 --- a/cmd/midx-cmd.py +++ b/cmd/midx-cmd.py @@ -123,7 +123,7 @@ def _do_midx(outdir, outfilename, infilenames, prefixstr): count = merge_into(fmap, bits, total, inp) del fmap - f.seek(0, git.SEEK_END) + f.seek(0, os.SEEK_END) f.write('\0'.join(allfilenames)) f.close() os.rename(outfilename + '.tmp', outfilename) diff --git a/lib/bup/git.py b/lib/bup/git.py index 671be13..ad4668b 100644 --- a/lib/bup/git.py +++ b/lib/bup/git.py @@ -8,7 +8,6 @@ from bup import _helpers, path, midx, bloom, xstat max_pack_size = 1000*1000*1000 # larger packs will slow down pruning max_pack_objects = 200*1000 # cache memory usage is about 83 bytes per object -SEEK_END=2 # os.SEEK_END is not defined in python 2.4 verbose = 0 ignore_midx = 0 @@ -662,7 +661,7 @@ class PackWriter: idx_f.truncate(ofs64_ofs) idx_f.seek(0) idx_map = mmap_readwrite(idx_f, close=False) - idx_f.seek(0, SEEK_END) + idx_f.seek(0, os.SEEK_END) count = _helpers.write_idx(idx_f, idx_map, idx, self.count) assert(count == self.count) idx_map.close() diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py index fad48fa..d3eea37 100644 --- a/lib/bup/helpers.py +++ b/lib/bup/helpers.py @@ -1,7 +1,7 @@ """Helper functions and classes for bup.""" import sys, os, pwd, subprocess, errno, socket, select, mmap, stat, re, struct -import heapq, operator, time, platform, grp +import hashlib, heapq, operator, time, platform, grp from bup import _version, _helpers import bup._helpers as _helpers @@ -800,18 +800,7 @@ def grafted_path_components(graft_points, path): return result return path_components(clean_path) -# hashlib is only available in python 2.5 or higher, but the 'sha' module -# produces a DeprecationWarning in python 2.6 or higher. We want to support -# python 2.4 and above without any stupid warnings, so let's try using hashlib -# first, and downgrade if it fails. -try: - import hashlib -except ImportError: - import sha - Sha1 = sha.sha -else: - Sha1 = hashlib.sha1 - +Sha1 = hashlib.sha1 def version_date(): """Format bup's version date string for output.""" -- 2.39.2