1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

28 Commits

Author SHA1 Message Date
Douglas Bagnall
aecb2b779b python: remove all 'from __future__ import print_function'
This made Python 2's print behave like Python 3's print().

In some cases, where we had:

   from __future__ import print_function
   """Intended module documentation..."""

this will have the side effect of making the intended module documentation
work as the actual module documentation (i.e. becoming __doc__), because
it is once again the first statement in the module.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-28 03:43:34 +00:00
Jule Anger
0847f56f24 pytdb tests: add test for storev()
Signed-off-by: Jule Anger <ja@sernet.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue May  5 11:24:52 UTC 2020 on sn-devel-184
2020-05-05 11:24:52 +00:00
Joe Guo
a07279b78a PY3: change shebang to python3 in lib dir
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
2018-12-14 14:40:20 +01:00
Joe Guo
f3b5287538 python: bulk replace dict.iteritems to items for py3
In py3, iterxxx methods are removed.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-04-13 07:27:12 +02:00
Noel Power
0844c5aa22 lib/tdb: convert print func to be py2/py3 compatible
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-23 07:28:24 +01:00
Michael Adam
3330c79324 tdb: eliminate deprecation warnings in python tests
assertEquals() is superseded by assertEqual()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Feb 16 19:58:39 CET 2016 on sn-devel-144
2016-02-16 19:58:39 +01:00
Petr Viktorin
075799ac17 pytdb: Add tests for text interface
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-21 19:04:15 +02:00
Petr Viktorin
1853a74b4e pytdb: Use new dict API on Python 3
- Remove has_key() method, add a fast "in" operator
- Rename iterkeys() to keys()

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-21 19:04:15 +02:00
Petr Viktorin
11eb2e4e3d pytdb: Port to Python 3
- Use bytes for all data, text strings for repr()
- Use PyLong instead of PyInt on py3
- Use new module initialization
- Update tests
- Run tests in "make test"

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-21 19:04:15 +02:00
Jelmer Vernooij
28b5b7e28e tdb tests: Remove custom code for "tdb2", which has been split out into ntdb.
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-12-06 05:21:03 +01:00
Andrew Bartlett
c92a5670e3 pytdb: Check if the database is closed before we touch it
If .close() has already been called, we have to play dead - the
self->ctx is just not valid any more, as we have been shut down to
allow some other part of Samba to open the tdb.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul 16 13:51:52 CEST 2012 on sn-devel-104
2012-07-16 13:51:51 +02:00
Michael Adam
0688cf102d tdb:tests: fix use of a non-existent word (existant) 2012-06-12 07:21:42 +02:00
Rusty Russell
5eecc85423 tdb2: create tdb2 versions of various testing TDBs.
Soon, TDB2 will handle tdb1 files, but until then, we substitute.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:36 +02:00
Rusty Russell
43ab5aa390 lib/tdb/python/tests/simple.py: don't assume TDB ordering.
TDB2 can break this assumption.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Jun  2 12:07:40 CEST 2011 on sn-devel-104
2011-06-02 12:07:39 +02:00
Jelmer Vernooij
6cd722d950 pytdb: Add __version__ attribute. 2010-10-04 13:52:09 +02:00
Kirill Smelkov
bdd6bef5dd pytdb: Add support for tdb_repack()
Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2010-10-02 22:40:56 +02:00
Jelmer Vernooij
7a59c90189 pytdb: Make filename argument optional. 2010-09-19 10:42:29 -07:00
Kirill Smelkov
4c72655678 pytdb: Add support for tdb_freelist_size()
Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2010-09-19 10:03:00 -07:00
Kirill Smelkov
b3314d6ad8 pytdb: Add support for tdb_transaction_prepare_commit()
Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2010-09-19 09:35:43 -07:00
Kirill Smelkov
b826ef9697 pytdb: Add support for tdb_enable_seqnum, tdb_get_seqnum and tdb_increment_seqnum_nonblock
Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2010-09-19 09:34:33 -07:00
Kirill Smelkov
277a1b229c pytdb: Fix repr segfault for internal db
The problem was tdb->name is NULL for TDB_INTERNAL databases, and
so it was crashing ...

    #0  0xb76944f3 in strlen () from /lib/i686/cmov/libc.so.6
    #1  0x0809862b in PyString_FromFormatV (format=0xb72b6a26 "Tdb('%s')", vargs=0xbfc26a94 "")
        at ../Objects/stringobject.c:211
    #2  0x08098888 in PyString_FromFormat (format=0xb72b6a26 "Tdb('%s')") at ../Objects/stringobject.c:358
    #3  0xb72b65f2 in tdb_object_repr (self=0xb759e060) at ./pytdb.c:439

Cc: 597089@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2010-09-19 09:31:20 -07:00
Kirill Smelkov
c4b1971259 pytdb: Add support for tdb_add_flags() & tdb_remove_flags()
Note, unlike tdb_open where flags is `int', tdb_{add,remove}_flags want
flags as `unsigned', so instead of "i" I used "I" in PyArg_ParseTuple.

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2010-09-19 09:31:08 -07:00
Jelmer Vernooij
5e67566f5e pytdb: Cleanup formatting. 2010-06-19 22:46:44 +02:00
Andrew Tridgell
088096d1ba python: use '#!/usr/bin/env python' to cope with varying install locations
this should be much more portable
2010-03-25 14:37:19 +11:00
Kirill Smelkov
71a21393dd tdb: add tests for double .close() in pytdb
The reason I do it is that when using older python-tdb as shipped in
Debian Lenny, python interpreter crashes on this test:

    (gdb) bt
    #0  0xb7f8c424 in __kernel_vsyscall ()
    #1  0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6
    #2  0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6
    #3  0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6
    #4  0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6
    #5  0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6
    #6  0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1
    #7  0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so
    #8  0x0a038d08 in ?? ()
    #9  0x00000000 in ?? ()

master's pytdb does not (we have a check for self->closed in obj_close()),
but still...

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29 10:14:33 +10:30
Jelmer Vernooij
2da551bbcc Implement missing functions in pytdb. 2008-12-18 19:41:02 +00:00
Jelmer Vernooij
2a61fd41e9 Add simple manually written replacement for the tdb module. 2008-12-18 18:57:21 +00:00
Jelmer Vernooij
94855cd692 Move common libraries from root to lib/. 2008-09-17 14:11:12 +02:00