diff options
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/Makefile.in | 3 | ||||
-rw-r--r-- | source4/lib/ldb/configure.ac | 4 | ||||
-rw-r--r-- | source4/lib/ldb/ldb.mk | 21 | ||||
-rwxr-xr-x | source4/lib/ldb/setup.py | 15 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/python/api.py | 3 |
5 files changed, 23 insertions, 23 deletions
diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in index 738ffe1adb..d3e027425b 100644 --- a/source4/lib/ldb/Makefile.in +++ b/source4/lib/ldb/Makefile.in @@ -19,6 +19,7 @@ SWIG = swig EXTRA_OBJ=@EXTRA_OBJ@ TESTS=test-tdb.sh @TESTS@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PYTHON_CONFIG = @PYTHON_CONFIG@ tdbdir = @tdbdir@ ldbdir = $(srcdir) tallocdir = @tallocdir@ @@ -121,7 +122,7 @@ distclean:: clean realdistclean:: distclean rm -f configure.in include/config.h.in -check:: test +check:: test @PYTHON_CHECK_TARGET@ check-soloading: sample_module.$(SHLIBEXT) LDB_MODULES_PATH=$(builddir) $(srcdir)/tests/test-soloading.sh diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac index 176cef0f3e..4d9444ad10 100644 --- a/source4/lib/ldb/configure.ac +++ b/source4/lib/ldb/configure.ac @@ -78,14 +78,18 @@ AC_LIBREPLACE_MDLD_FLAGS AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR 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_CHECK_TARGET="" PYTHON_INSTALL_TARGET="" fi diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index b9aa24b276..ec4c34f6d8 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -65,18 +65,25 @@ examples/ldifreader: examples/ldifreader.o $(LIBS) $(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS) # Python bindings -build-python:: lib/libldb.$(SHLIBEXT) ldb_wrap.c - $(ldbdir)/setup.py build +build-python:: _ldb.$(SHLIBEXT) + +ldb_wrap.o: $(ldbdir)/ldb_wrap.c + $(CC) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` + +_ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o + $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) install-python:: build-python - $(ldbdir)/setup.py install --prefix=$(DESTDIR)$(prefix) + 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 $(ldbdir)/ldb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` + cp _ldb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` install-swig:: cp ldb.i `$(SWIG) -swiglib` check-python:: build-python - # FIXME: This isn't portable - LD_LIBRARY_PATH=lib PYTHONPATH=.:build/lib.linux-i686-2.4/ trial tests/python/api.py + LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) $(PYTHON) $(ldbdir)/tests/python/api.py -clean-python:: - $(ldbdir)/setup.py clean +clean:: + rm -f _ldb.$(SHLIBEXT) diff --git a/source4/lib/ldb/setup.py b/source4/lib/ldb/setup.py deleted file mode 100755 index b04f3b09f1..0000000000 --- a/source4/lib/ldb/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python -from distutils.core import setup -from distutils.extension import Extension - -setup(name="ldb", - version="1.0", - url="http://ldb.samba.org/", - author="LDB Developers", - author_email="ldb@samba.org", - license="LGPLv3", - keywords=["ldap","ldb","db","ldif"], - py_modules=["ldb"], - ext_modules=[Extension('_ldb', ['ldb_wrap.c'], include_dirs=['include'], - library_dirs=["lib"], libraries=['ldb'])], - ) diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py index d5346c30b0..5f3f727b5d 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -418,3 +418,6 @@ class ModuleTests(unittest.TestCase): def test_register_module(self): ldb.register_module(ExampleModule()) +if __name__ == '__main__': + import unittest + unittest.TestProgram() |