From 4c69b5e0fd1440a928ec2c45d391ccbc27a9cff3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 10 Jan 2008 21:44:38 +0100 Subject: tdb: Add simple reimplementation of tdbdump in Python as an example of the tdb Python bindings. (This used to be commit 47d797f7885b1e7bcff724496ecb1990e8440eea) (cherry picked from samba commit 6bdd1425b75c8931965f0e5627f5a63dc6820a7c) Signed-off-by: Stefan Metzmacher (This used to be ctdb commit 363c34d4bb488609317794cd3153d85c12643110) --- ctdb/lib/tdb/python/tdbdump.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ctdb/lib/tdb/python/tdbdump.py (limited to 'ctdb/lib/tdb/python/tdbdump.py') diff --git a/ctdb/lib/tdb/python/tdbdump.py b/ctdb/lib/tdb/python/tdbdump.py new file mode 100644 index 0000000000..d759d771c8 --- /dev/null +++ b/ctdb/lib/tdb/python/tdbdump.py @@ -0,0 +1,12 @@ +#!/usr/bin/python +# Trivial reimplementation of tdbdump in Python + +import tdb, sys + +if len(sys.argv) < 2: + print "Usage: tdbdump.py " + sys.exit(1) + +db = tdb.Tdb(sys.argv[1]) +for (k, v) in db.iteritems(): + print "{\nkey(%d) = %r\ndata(%d) = %r\n}" % (len(k), k, len(v), v) -- cgit From b52a04d987cbc91668dac6e6b2181806bef144ef Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Apr 2010 13:57:17 +0930 Subject: python: use '#!/usr/bin/env python' to cope with varying install locations this should be much more portable (Imported from commit 088096d1bad51428a2e2d487214995d4fdfc7ccc) (This used to be ctdb commit 7f1330adc690360a4a8ce85352df0908a93684a5) --- ctdb/lib/tdb/python/tdbdump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/lib/tdb/python/tdbdump.py') diff --git a/ctdb/lib/tdb/python/tdbdump.py b/ctdb/lib/tdb/python/tdbdump.py index d759d771c8..01859ebce2 100644 --- a/ctdb/lib/tdb/python/tdbdump.py +++ b/ctdb/lib/tdb/python/tdbdump.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Trivial reimplementation of tdbdump in Python import tdb, sys -- cgit