From 69cd69d59b0dcdbccd754c18b4bf06d2c6c7e2a7 Mon Sep 17 00:00:00 2001 From: Michael Cahill Date: Fri, 11 Mar 2011 12:03:44 +1100 Subject: [PATCH] Build the Python API into the build directory. * * * [mq]: config-script --- .hgignore | 2 +- build_posix/Make.base | 6 +++--- build_posix/aclocal/options.m4 | 2 +- lang/python/setup.py | 9 +++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.hgignore b/.hgignore index 862f32c8f54..7c31e2c45ef 100644 --- a/.hgignore +++ b/.hgignore @@ -5,6 +5,7 @@ ^build.*/(\.deps|COPYING|ChangeLog|INSTALL|Makefile.*|NEWS|README) ^build.*/(aclocal\.m4|config\..*|configure|stamp-h1|prototype.chk|w.*\.h) ^build.*/(ex_.*|lib.*|wt_.*) +^build.*/(_wiredtiger.so|wiredtiger.py|wiredtiger_wrap.c) ^build_posix/gnu-support/(depcomp|install-sh|missing) ^build_posix/autom4te.cache ^docs/(doxygen.log|installdox|search) @@ -12,7 +13,6 @@ ^docs/java ^docs/latex ^docs/python -^lang/python/(_wiredtiger.so|wiredtiger.py|wiredtiger_wrap.c) ^src/server ^test/bt/(CONFIG|__rand|__wt.bdb|__wt.run|__wt.wt|db|t|vgout\..*) /tags$ diff --git a/build_posix/Make.base b/build_posix/Make.base index 925c9dd772c..285524912a6 100644 --- a/build_posix/Make.base +++ b/build_posix/Make.base @@ -30,7 +30,7 @@ if DEBUG PY_SETUP_DEBUG = -g wiredtiger_wrap_o_CFLAGS = -g endif -all-local: ../lang/python/_wiredtiger.so +all-local: _wiredtiger.so endif -../lang/python/_wiredtiger.so: libwiredtiger.a ../lang/python/wiredtiger.i - @(cd ../lang/python ; python setup.py build_ext -f -i $(PY_SETUP_DEBUG)) +_wiredtiger.so: libwiredtiger.a ../lang/python/wiredtiger.i + @(python ../lang/python/setup.py build_ext -f -i $(PY_SETUP_DEBUG)) diff --git a/build_posix/aclocal/options.m4 b/build_posix/aclocal/options.m4 index 5a2907aea8b..304fea8523f 100644 --- a/build_posix/aclocal/options.m4 +++ b/build_posix/aclocal/options.m4 @@ -47,7 +47,7 @@ no) db_cv_enable_python=no;; *) db_cv_enable_python=yes;; esac AC_MSG_RESULT($db_cv_enable_python) -AM_CONDITIONAL([PYTHON], [test x$db_cv_enable_python = xyes]) +AM_CONDITIONAL(PYTHON, test x$db_cv_enable_python = xyes) AH_TEMPLATE(HAVE_VERBOSE, [Define to 1 to support the Env.verbose_set method.]) AC_MSG_CHECKING(if --enable-verbose option specified) diff --git a/lang/python/setup.py b/lang/python/setup.py index 0796aa5761f..609637c2b1a 100644 --- a/lang/python/setup.py +++ b/lang/python/setup.py @@ -1,16 +1,17 @@ -import os +import os, sys from distutils.core import setup, Extension # OS X hack: turn off the Universal binary support that is built into the # Python build machinery, just build for the default CPU architecture. if not 'ARCHFLAGS' in os.environ: os.environ['ARCHFLAGS'] = '' +dir = os.path.dirname(sys.argv[0]) setup(name='wiredtiger', version='1.0', ext_modules=[Extension('_wiredtiger', ['wiredtiger.i'], - swig_opts=['-I../../build_posix'], - include_dirs=['../../build_posix'], - library_dirs=['../../build_posix'], + swig_opts=['-I.', '-I' + dir], + include_dirs=['.'], + library_dirs=['.'], libraries=['wiredtiger'], )], py_modules=['wiredtiger'],