Skip to content
Permalink
Browse files

Include Python 3 ABI flags in shared library name.

Python 3 appends the ABI flags to the version in the shared library file name:
since this library is loaded as a gmodule, the correct file name must be
provided.
  • Loading branch information...
monnerat authored and vkareh committed Jan 19, 2019
1 parent 855e612 commit 7c4ff1a2c72b9a4f2a84a2e10c7ea0450dbf5227
Showing with 5 additions and 2 deletions.
  1. +2 −0 configure.ac
  2. +1 −0 src/Makefile.am
  3. +2 −2 src/caja-python.c
@@ -41,9 +41,11 @@ dnl **************************************************
AM_PATH_PYTHON([2.7])
PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
PYTHON_LIB_LOC="`pkg-config python-${PYTHON_VERSION} --variable=libdir`"
PYTHON_ABIFLAGS=`$PYTHON -c 'import sys; exec("try: print (sys.abiflags)\nexcept: pass")'`
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_LIB_LOC)
AC_SUBST(PYTHON_ABIFLAGS)

PYGOBJECT_MAJOR_VERSION=3
PYGOBJECT_MINOR_VERSION=0
@@ -15,6 +15,7 @@ libcaja_python_la_CPPFLAGS = \
-DDATADIR=\"$(datadir)\" \
-DLIBDIR=\"$(libdir)\" \
-DPYTHON_VERSION=\"$(PYTHON_VERSION)\" \
-DPYTHON_ABIFLAGS=\"$(PYTHON_ABIFLAGS)\" \
-DPY_LIB_LOC="\"$(PYTHON_LIB_LOC)\"" \
$(CAJA_PYTHON_CFLAGS) \
$(AM_CPPFLAGS)
@@ -174,8 +174,8 @@ caja_python_init_python (void)
if (Py_IsInitialized())
return TRUE;

debug("g_module_open " PY_LIB_LOC "/libpython" PYTHON_VERSION "." G_MODULE_SUFFIX ".1.0");
libpython = g_module_open(PY_LIB_LOC "/libpython" PYTHON_VERSION "." G_MODULE_SUFFIX ".1.0", 0);
debug("g_module_open " PY_LIB_LOC "/libpython" PYTHON_VERSION PYTHON_ABIFLAGS "." G_MODULE_SUFFIX ".1.0");
libpython = g_module_open(PY_LIB_LOC "/libpython" PYTHON_VERSION PYTHON_ABIFLAGS "." G_MODULE_SUFFIX ".1.0", 0);
if (!libpython)
g_warning("g_module_open libpython failed: %s", g_module_error());

0 comments on commit 7c4ff1a

Please sign in to comment.
You can’t perform that action at this time.