Manually compile python files rather than use setup.py.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 11 Feb 2008 23:49:36 +0000 (00:49 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 11 Feb 2008 23:49:36 +0000 (00:49 +0100)
source/lib/ldb/Makefile.in
source/lib/ldb/configure.ac
source/lib/ldb/ldb.mk
source/lib/ldb/setup.py [deleted file]

index 738ffe1adbc837e4efb481a791c4fdaca8fb3453..d3e027425b562ace49a491ccd6b51af9c63c5639 100644 (file)
@@ -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
index 176cef0f3e067b5c0938c1b09c6f6df52701494b..1435536373d0e20125c3e724acf5f428c64f4131 100644 (file)
@@ -81,11 +81,14 @@ AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-conf
 
 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
 
index b9aa24b276d1c9f768c5f81093d234c965b59fd3..69c1bf6ad90cc7a99e56eb60984388ccaf6049e6 100644 (file)
@@ -65,8 +65,13 @@ 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)
@@ -75,8 +80,7 @@ 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) trial $(ldbdir)/tests/python/api.py
 
-clean-python::
-       $(ldbdir)/setup.py clean
+clean::
+       rm -f _ldb.$(SHLIBEXT)
diff --git a/source/lib/ldb/setup.py b/source/lib/ldb/setup.py
deleted file mode 100755 (executable)
index b04f3b0..0000000
+++ /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'])],
-      )