[MOAB-dev] r3054 - in MOAB/trunk: . tools/iMesh/python
jvporter at mcs.anl.gov
jvporter at mcs.anl.gov
Wed Jul 22 14:17:40 CDT 2009
Author: jvporter
Date: 2009-07-22 14:17:40 -0500 (Wed, 22 Jul 2009)
New Revision: 3054
Modified:
MOAB/trunk/configure.ac
MOAB/trunk/tools/iMesh/python/Makefile.am
Log:
* Add $pylibdir to configure, to automatically target the right place
for Python libs
* Simplify some of configure's library autodetection
* Prepend $DESTDIR to Python install paths
Modified: MOAB/trunk/configure.ac
===================================================================
--- MOAB/trunk/configure.ac 2009-07-22 19:13:45 UTC (rev 3053)
+++ MOAB/trunk/configure.ac 2009-07-22 19:17:40 UTC (rev 3054)
@@ -201,18 +201,14 @@
# Check if python interpreter works
AC_MSG_CHECKING([if python works])
-cat >check.py <<'ENDPYTEST'
-from math import *
-aTuple = ('robots', 77, 93, 'try')
-sqrt(aTuple[[1]])
-ENDPYTEST
-if ${PYTHON} check.py >/dev/null 2>&1; then
+py_command="from math import *; aTuple = ('robots', 77, 93, 'try'); \
+ sqrt(aTuple[[1]])"
+if ${PYTHON} -c "$py_command" >/dev/null 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([NO])
PYTHON=
fi
-rm -f check.py
if test "x$PYTHON" != "x"; then
@@ -224,19 +220,13 @@
# Get the default Python include dir containing pyconfig.h
# Note: Python does this automatically via distutils
AC_MSG_CHECKING([for location of python headers])
-cat >check.py <<'ENDPYINCTEST'
-import sys
-minor = sys.hexversion >> 16 & 0xff
-major = sys.hexversion >> 24
-print "%s/include/python%d.%d" % (sys.prefix,major,minor)
-ENDPYINCTEST
- if pydir_out=`$PYTHON check.py`; then
- rm -f check.py
+ py_command="import sys; print '%s/include/python%d.%d' % (sys.prefix, \
+ sys.version_info[[0]],sys.version_info[[1]])"
+ if pydir_out=`$PYTHON -c "$py_command"`; then
PYCONFIG_DIR="$pydir_out"
AC_MSG_RESULT($PYCONFIG_DIR)
else
- rm -f check.py
- AC_MSG_ERROR("python interpretor is broken?")
+ AC_MSG_ERROR("python interpreter is broken?")
fi
# If user did not specify an include dir, use the default
@@ -244,6 +234,12 @@
PYTHON_DIR=PYCONFIG_DIR
fi
+ # Determine location for python libraries
+ py_command="import sys; print '$libdir/python%d.%d/site-packages' % (\
+ sys.version_info[[0]],sys.version_info[[1]])"
+ pylibdir=`$PYTHON -c "$py_command"`
+ AC_SUBST(pylibdir)
+
# Check for expected header in python include dir
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$PYTHON_DIR -I$PYCONFIG_DIR"
@@ -272,12 +268,8 @@
if test -d "${PYTHON_DIR}/numpy"; then
NUMPY_DIR="${PYTHON_DIR}"
else
-cat >check.py <<'ENDNUMPYTEST'
-import numpy.core
-print numpy.core
-ENDNUMPYTEST
- NUMPY_DIR=`$PYTHON check.py | cut -d "'" -f 4 | sed -e 's/__init__.pyc/include/'`
- rm -f check.py
+ py_command="import numpy.core; print numpy.core.__path__[[0]]"
+ NUMPY_DIR=`$PYTHON -c "$py_command"`/include
fi
AC_MSG_RESULT([$NUMPY_DIR])
fi
Modified: MOAB/trunk/tools/iMesh/python/Makefile.am
===================================================================
--- MOAB/trunk/tools/iMesh/python/Makefile.am 2009-07-22 19:13:45 UTC (rev 3053)
+++ MOAB/trunk/tools/iMesh/python/Makefile.am 2009-07-22 19:17:40 UTC (rev 3054)
@@ -2,11 +2,12 @@
--imesh-dir="$(abs_builddir)/.."
INSTALL_FLAGS = --skip-build \
- --prefix="$(prefix)" \
- --exec-prefix="$(exec_prefix)" \
- --install-headers="$(includedir)" \
- --install-data="$(datadir)" \
- --install-scripts="$(bindir)"
+ --prefix="$(DESTDIR)$(prefix)" \
+ --exec-prefix="$(DESTDIR)$(exec_prefix)" \
+ --install-headers="$(DESTDIR)$(includedir)" \
+ --install-lib="$(DESTDIR)$(pylibdir)" \
+ --install-data="$(DESTDIR)$(datadir)" \
+ --install-scripts="$(DESTDIR)$(bindir)"
all:
$(PYTHON) $(abs_srcdir)/setup.py build_ext $(BUILD_EXT_FLAGS)
More information about the moab-dev
mailing list