Avoid using setup.py for intsallation.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 12 Feb 2008 00:21:10 +0000 (01:21 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 12 Feb 2008 00:21:10 +0000 (01:21 +0100)
source/lib/ldb/configure.ac
source/lib/ldb/ldb.mk
source/lib/ldb/tests/python/api.py
source/lib/tdb/Makefile.in
source/lib/tdb/configure.ac
source/lib/tdb/python/tests/simple.py
source/lib/tdb/tdb.mk

index 1435536373d0e20125c3e724acf5f428c64f4131..4d9444ad104132a67c89d646998e38c51bc6ce55 100644 (file)
@@ -78,6 +78,7 @@ 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"
index 69c1bf6ad90cc7a99e56eb60984388ccaf6049e6..6d0ad44d38b887b729402e5555ddefb29ade7941 100644 (file)
@@ -74,13 +74,14 @@ _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)
+       cp $(ldbdir)/ldb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0)"`
+       cp _ldb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)"`
 
 install-swig::
        cp ldb.i `$(SWIG) -swiglib`
 
 check-python:: build-python
-       LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) trial $(ldbdir)/tests/python/api.py
+       LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) $(PYTHON) $(ldbdir)/tests/python/api.py
 
 clean::
        rm -f _ldb.$(SHLIBEXT)
index d5346c30b09a244fcd1c892caa58298557b49f79..5f3f727b5d18694a3cb75b6b8791d9e44c20fc7e 100755 (executable)
@@ -418,3 +418,6 @@ class ModuleTests(unittest.TestCase):
     def test_register_module(self):
         ldb.register_module(ExampleModule())
 
+if __name__ == '__main__':
+    import unittest
+    unittest.TestProgram()
index f900469afae876cf5fc2a7227b726171d5a02389..8c79f6e24cee1071c679c41bddc4c5d3a0d8ff48 100644 (file)
@@ -22,6 +22,7 @@ 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@
index 36d409ac11edda1dc5b1d3c62b5cc41cdbb8155d..9b16a82c339da5c0ecea7396f9ee7e6e46e1e7c6 100644 (file)
@@ -14,6 +14,7 @@ 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"
index 1cc51aea07fb4e0ca350ee5ab7c0c74dab423052..94407b6398134093e7e9372a1ec31bfdfafc4e92 100644 (file)
@@ -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()
index 10b7c6a92d6fde254049d301ee5adb498ad76260..976589fd0fd7c1d31aae3ea1d87716f6ffb79a8a 100644 (file)
@@ -35,8 +35,8 @@ clean::
 
 build-python:: _tdb.$(SHLIBEXT) 
 
-tdb_wrap.o: tdb_wrap.c
-       $(CC) -c $< $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+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`
@@ -44,11 +44,12 @@ _tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o
 install:: installdirs installbin installheaders installlibs \
                  $(PYTHON_INSTALL_TARGET)
 
-installpython:: build-python
-       ./setup.py install --prefix=$(DESTDIR)$(prefix)
+install-python:: build-python
+       cp $(tdbdir)/tdb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0)"`
+       cp _tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)"`
 
 check-python:: build-python
-       $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" trial $(tdbdir)/python/tests/simple.py
+       $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py
 
 install-swig::
        mkdir -p $(DESTDIR)`$(SWIG) -swiglib`