This is the same fix I posted a few days ago for hivex (<1369351909-23821-3-git-send-email-bengen@hilluzination.de>). Cheers, -Hilko
Hilko Bengen
2013-Jun-03 22:35 UTC
[Libguestfs] [PATCH] python: Build extension with PEP-3149 compliant suffix if defined.
---
configure.ac | 9 +++++++++
python/Makefile.am | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index ea403c3..00ef507 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1163,6 +1163,14 @@ AS_IF([test "x$enable_python" !=
"xno"],[
AC_MSG_RESULT([$PYTHON_INSTALLDIR])
fi
+ AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
+ if test -z "$PYTHON_EXT_SUFFIX"; then
+ python_ext_suffix=`$PYTHON -c "import sysconfig; \
+ print
(sysconfig.get_config_var('EXT_SUFFIX') or
sysconfig.get_config_var('SO'))"`
+ PYTHON_EXT_SUFFIX=$python_ext_suffix
+ fi
+ AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
+
dnl Look for some optional symbols in libpython.
old_LIBS="$LIBS"
@@ -1183,6 +1191,7 @@ AS_IF([test "x$enable_python" !=
"xno"],[
AC_SUBST(PYTHON_PREFIX)
AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_INSTALLDIR)
+ AC_SUBST(PYTHON_EXT_SUFFIX)
])
AM_CONDITIONAL([HAVE_PYTHON],
[test "x$PYTHON" != "xno" && test
"x$PYTHON_LIBS" != "x" ])
diff --git a/python/Makefile.am b/python/Makefile.am
index ecc25d5..d513695 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -56,7 +56,7 @@ libguestfsmod_la_LIBADD = \
$(LIBVIRT_LIBS) \
../gnulib/lib/libgnu.la
-libguestfsmod_la_LDFLAGS = -avoid-version -shared
+libguestfsmod_la_LDFLAGS = -avoid-version -shared -module -shrext
$(PYTHON_EXT_SUFFIX)
TESTS_ENVIRONMENT = $(top_builddir)/run --test
--
1.7.10.4
Richard W.M. Jones
2013-Jun-04 07:48 UTC
Re: [Libguestfs] [PATCH] python: Build extension with PEP-3149 compliant suffix if defined.
On Tue, Jun 04, 2013 at 12:35:27AM +0200, Hilko Bengen wrote:> --- > configure.ac | 9 +++++++++ > python/Makefile.am | 2 +- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index ea403c3..00ef507 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1163,6 +1163,14 @@ AS_IF([test "x$enable_python" != "xno"],[ > AC_MSG_RESULT([$PYTHON_INSTALLDIR]) > fi > > + AC_MSG_CHECKING([for Python extension suffix (PEP-3149)]) > + if test -z "$PYTHON_EXT_SUFFIX"; then > + python_ext_suffix=`$PYTHON -c "import sysconfig; \ > + print (sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"` > + PYTHON_EXT_SUFFIX=$python_ext_suffix > + fi > + AC_MSG_RESULT([$PYTHON_EXT_SUFFIX]) > + > dnl Look for some optional symbols in libpython. > old_LIBS="$LIBS" > > @@ -1183,6 +1191,7 @@ AS_IF([test "x$enable_python" != "xno"],[ > AC_SUBST(PYTHON_PREFIX) > AC_SUBST(PYTHON_VERSION) > AC_SUBST(PYTHON_INSTALLDIR) > + AC_SUBST(PYTHON_EXT_SUFFIX) > ]) > AM_CONDITIONAL([HAVE_PYTHON], > [test "x$PYTHON" != "xno" && test "x$PYTHON_LIBS" != "x" ]) > diff --git a/python/Makefile.am b/python/Makefile.am > index ecc25d5..d513695 100644 > --- a/python/Makefile.am > +++ b/python/Makefile.am > @@ -56,7 +56,7 @@ libguestfsmod_la_LIBADD = \ > $(LIBVIRT_LIBS) \ > ../gnulib/lib/libgnu.la > > -libguestfsmod_la_LDFLAGS = -avoid-version -shared > +libguestfsmod_la_LDFLAGS = -avoid-version -shared -module -shrext $(PYTHON_EXT_SUFFIX) > > TESTS_ENVIRONMENT = $(top_builddir)/run --testACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top