From baa473b96397ff8425b5a06e8d7f93df309cc68d Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sun, 22 Aug 2010 20:27:03 -0700 Subject: [PATCH] Rename _faster.so to _helpers.so. Okay, _faster.so wasn't a good choice of names. Partly because not everything in there is just to make stuff faster, and partly because some *proposed* changes to it don't just make stuff faster. So let's rename it one more time. Hopefully the last time for a while! Signed-off-by: Avery Pennarun --- Makefile | 8 ++++---- cmd/margin-cmd.py | 4 ++-- cmd/random-cmd.py | 4 ++-- lib/bup/{_faster.c => _helpers.c} | 4 ++-- lib/bup/csetup.py | 6 +++--- lib/bup/hashsplit.py | 10 +++++----- lib/bup/t/thashsplit.py | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) rename lib/bup/{_faster.c => _helpers.c} (98%) diff --git a/Makefile b/Makefile index 47b03ea..7f38c7f 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ default: all all: bup Documentation/all -bup: lib/bup/_version.py lib/bup/_faster$(SOEXT) cmds +bup: lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds Documentation/all: bup @@ -62,11 +62,11 @@ install: all %/clean: $(MAKE) -C $* clean -lib/bup/_faster$(SOEXT): \ - lib/bup/bupsplit.c lib/bup/_faster.c lib/bup/csetup.py +lib/bup/_helpers$(SOEXT): \ + lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py @rm -f $@ cd lib/bup && $(PYTHON) csetup.py build - cp lib/bup/build/*/_faster$(SOEXT) lib/bup/ + cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/ .PHONY: lib/bup/_version.py lib/bup/_version.py: diff --git a/cmd/margin-cmd.py b/cmd/margin-cmd.py index 21f711f..cb059a3 100755 --- a/cmd/margin-cmd.py +++ b/cmd/margin-cmd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import sys -from bup import options, git, _faster +from bup import options, git, _helpers from bup.helpers import * @@ -23,7 +23,7 @@ for i in mi: if i == last: continue #assert(str(i) >= last) - pm = _faster.bitmatch(last, i) + pm = _helpers.bitmatch(last, i) longmatch = max(longmatch, pm) last = i print longmatch diff --git a/cmd/random-cmd.py b/cmd/random-cmd.py index 9a24fac..19732b9 100755 --- a/cmd/random-cmd.py +++ b/cmd/random-cmd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import sys -from bup import options, _faster +from bup import options, _helpers from bup.helpers import * optspec = """ @@ -21,7 +21,7 @@ handle_ctrl_c() if opt.force or (not os.isatty(1) and not atoi(os.environ.get('BUP_FORCE_TTY')) & 1): - _faster.write_random(sys.stdout.fileno(), total, opt.seed) + _helpers.write_random(sys.stdout.fileno(), total, opt.seed) else: log('error: not writing binary data to a terminal. Use -f to force.\n') sys.exit(1) diff --git a/lib/bup/_faster.c b/lib/bup/_helpers.c similarity index 98% rename from lib/bup/_faster.c rename to lib/bup/_helpers.c index cfab4fb..3ce5ecb 100644 --- a/lib/bup/_faster.c +++ b/lib/bup/_helpers.c @@ -174,7 +174,7 @@ static PyMethodDef faster_methods[] = { { NULL, NULL, 0, NULL }, // sentinel }; -PyMODINIT_FUNC init_faster(void) +PyMODINIT_FUNC init_helpers(void) { - Py_InitModule("_faster", faster_methods); + Py_InitModule("_helpers", faster_methods); } diff --git a/lib/bup/csetup.py b/lib/bup/csetup.py index 6036e42..2a0eeaf 100644 --- a/lib/bup/csetup.py +++ b/lib/bup/csetup.py @@ -1,8 +1,8 @@ from distutils.core import setup, Extension -_faster_mod = Extension('_faster', sources=['_faster.c', 'bupsplit.c']) +_helpers_mod = Extension('_helpers', sources=['_helpers.c', 'bupsplit.c']) -setup(name='_faster', +setup(name='_helpers', version='0.1', description='accelerator library for bup', - ext_modules=[_faster_mod]) + ext_modules=[_helpers_mod]) diff --git a/lib/bup/hashsplit.py b/lib/bup/hashsplit.py index 71e0327..61840ad 100644 --- a/lib/bup/hashsplit.py +++ b/lib/bup/hashsplit.py @@ -1,5 +1,5 @@ import math -from bup import _faster +from bup import _helpers from bup.helpers import * BLOB_LWM = 8192*2 @@ -38,7 +38,7 @@ class Buf: def splitbuf(buf): b = buf.peek(buf.used()) - (ofs, bits) = _faster.splitbuf(b) + (ofs, bits) = _helpers.splitbuf(b) if ofs: buf.eat(ofs) return (buffer(b, 0, ofs), bits) @@ -135,7 +135,7 @@ def split_to_shalist(w, files): shal.append(('100644', sha, size)) return _make_shalist(shal)[0] else: - base_bits = _faster.blobbits() + base_bits = _helpers.blobbits() fanout_bits = int(math.log(fanout, 2)) def bits_to_idx(n): assert(n >= base_bits) @@ -163,7 +163,7 @@ def split_to_blob_or_tree(w, files): def open_noatime(name): - fd = _faster.open_noatime(name) + fd = _helpers.open_noatime(name) try: return os.fdopen(fd, 'rb', 1024*1024) except: @@ -177,4 +177,4 @@ def open_noatime(name): def fadvise_done(f, ofs): assert(ofs >= 0) if ofs > 0: - _faster.fadvise_done(f.fileno(), ofs) + _helpers.fadvise_done(f.fileno(), ofs) diff --git a/lib/bup/t/thashsplit.py b/lib/bup/t/thashsplit.py index bd8a015..43d589b 100644 --- a/lib/bup/t/thashsplit.py +++ b/lib/bup/t/thashsplit.py @@ -1,6 +1,6 @@ -from bup import hashsplit, _faster +from bup import hashsplit, _helpers from wvtest import * @wvtest def test_rolling_sums(): - WVPASS(_faster.selftest()) + WVPASS(_helpers.selftest()) -- 2.39.2