summaryrefslogtreecommitdiff
path: root/source4/lib/tdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r--source4/lib/tdb/Makefile.in6
-rw-r--r--source4/lib/tdb/configure.ac5
-rw-r--r--source4/lib/tdb/python/tests/simple.py5
-rwxr-xr-xsource4/lib/tdb/setup.py11
-rw-r--r--source4/lib/tdb/tdb.mk25
5 files changed, 30 insertions, 22 deletions
diff --git a/source4/lib/tdb/Makefile.in b/source4/lib/tdb/Makefile.in
index 9730dffe60..8c79f6e24c 100644
--- a/source4/lib/tdb/Makefile.in
+++ b/source4/lib/tdb/Makefile.in
@@ -22,8 +22,12 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PICFLAG = @PICFLAG@
SHLIBEXT = @SHLIBEXT@
SWIG = swig
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
PYTHON_BUILD_TARGET = @PYTHON_BUILD_TARGET@
PYTHON_INSTALL_TARGET = @PYTHON_INSTALL_TARGET@
+PYTHON_CHECK_TARGET = @PYTHON_CHECK_TARGET@
+LIB_PATH_VAR = @LIB_PATH_VAR@
tdbdir = @tdbdir@
TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@
@@ -39,7 +43,7 @@ $(SOLIB): $(TDB_OBJ)
check: test
-test::
+test:: $(PYTHON_CHECK_TARGET)
installcheck:: test install
clean::
diff --git a/source4/lib/tdb/configure.ac b/source4/lib/tdb/configure.ac
index 5747107f38..9b16a82c33 100644
--- a/source4/lib/tdb/configure.ac
+++ b/source4/lib/tdb/configure.ac
@@ -11,15 +11,20 @@ AC_LD_PICFLAG
AC_LD_SHLIBEXT
AC_LIBREPLACE_SHLD
AC_LIBREPLACE_SHLD_FLAGS
+AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
m4_include(libtdb.m4)
AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
+AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python])
PYTHON_BUILD_TARGET="build-python"
PYTHON_INSTALL_TARGET="install-python"
+PYTHON_CHECK_TARGET="check-python"
AC_SUBST(PYTHON_BUILD_TARGET)
AC_SUBST(PYTHON_INSTALL_TARGET)
+AC_SUBST(PYTHON_CHECK_TARGET)
if test -z "$PYTHON_CONFIG"; then
PYTHON_BUILD_TARGET=""
PYTHON_INSTALL_TARGET=""
+ PYTHON_CHECK_TARGET=""
fi
AC_OUTPUT(Makefile tdb.pc)
diff --git a/source4/lib/tdb/python/tests/simple.py b/source4/lib/tdb/python/tests/simple.py
index 1cc51aea07..94407b6398 100644
--- a/source4/lib/tdb/python/tests/simple.py
+++ b/source4/lib/tdb/python/tests/simple.py
@@ -142,3 +142,8 @@ class SimpleTdbTests(TestCase):
self.assertEquals(0, len(self.tdb))
self.tdb["entry"] = "value"
self.assertEquals(1, len(self.tdb))
+
+
+if __name__ == '__main__':
+ import unittest
+ unittest.TestProgram()
diff --git a/source4/lib/tdb/setup.py b/source4/lib/tdb/setup.py
deleted file mode 100755
index 8be0c67e0b..0000000000
--- a/source4/lib/tdb/setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/python
-from distutils.core import setup
-from distutils.extension import Extension
-
-setup(name='tdb',
- version='1.0',
- url="http://tdb.samba.org/",
- py_modules=["tdb"],
- ext_modules=[Extension('_tdb', ['tdb_wrap.c'], include_dirs=['include'],
- library_dirs=["."], libraries=['tdb'])],
-)
diff --git a/source4/lib/tdb/tdb.mk b/source4/lib/tdb/tdb.mk
index d6118dd38f..fe77a0492d 100644
--- a/source4/lib/tdb/tdb.mk
+++ b/source4/lib/tdb/tdb.mk
@@ -33,25 +33,32 @@ clean::
rm -f $(SONAME) $(SOLIB) libtdb.a libtdb.$(SHLIBEXT)
rm -f $(ALL_PROGS) tdb.pc
-build-python:: libtdb.$(SHLIBEXT) tdb_wrap.c
- $(tdbdir)/setup.py build
+build-python:: _tdb.$(SHLIBEXT)
+
+tdb_wrap.o: $(tdbdir)/tdb_wrap.c
+ $(CC) -c $(tdbdir)/tdb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+
+_tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o
+ $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --libs`
install:: installdirs installbin installheaders installlibs \
$(PYTHON_INSTALL_TARGET)
-installpython:: build-python
- ./setup.py install --prefix=$(DESTDIR)$(prefix)
+install-python:: build-python
+ mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \
+ $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
+ cp $(tdbdir)/tdb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"`
+ cp _tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
check-python:: build-python
- # FIXME: Should be more portable:
- LD_LIBRARY_PATH=. PYTHONPATH=.:build/lib.linux-i686-2.4 trial python/tests/simple.py
+ $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py
install-swig::
mkdir -p $(DESTDIR)`$(SWIG) -swiglib`
cp tdb.i $(DESTDIR)`$(SWIG) -swiglib`
-clean-python::
- ./setup.py clean
+clean::
+ rm -f _tdb.$(SHLIBEXT)
installdirs::
mkdir -p $(DESTDIR)$(bindir)
@@ -77,5 +84,3 @@ libtdb.$(SHLIBEXT): $(SOLIB)
$(SONAME): $(SOLIB)
ln -fs $< $@
-
-