Hi folks I have a little problem with a Python extension and could not find a good solution in the documentation. So hopefully someone here has a clever idea.
Here is the problem: I have two extensions written in C++ (bindings to
existing C++ code). Lets call this two extensions C and B which are part
of a larger package with parent A. So in the simplest case the
installation on Linux would somehow look like this
A/
__init__.py
B/
__init__.py
_b.so
C/
__init__.py
_c.so
The extension C is optional but depends on B. In the code for C I would
like to use some utilities developed for B. The idea was to keep this
utility functions in a shared library and link B and C against this
library. Lets call this library libb_utils.so. The problem here is that
the code in libb_utils.so depends on the Python version used to build
the extensions so it is not possible to build a Python agnostic version
of the library.
My idea now was to build extension B and in the same code tree build
libb_utils.so. The idea was to install this shared object along with the
extension and then link C against it. The new installation would look
like this
A/
__init__.py
B/
__init__.py
_b.so
libb_utils.so
with header files for libb_utils.so in
$PREFIX/include/pythonX.Y/A/B/
My hope is that I can do all this with distutils. Building and
installing the extension is trivial. But
1.) is there a better way to build a shared library with distutils
than using the CCompiler submodule?
2.) is the way I am planning the installation of my code ok
or is there a better way (maybe even a kind of standard) to deal
with such a situation.
best regards and thanks in advance
Eugen Wintersberger
signature.asc
Description: This is a digitally signed message part
-- https://mail.python.org/mailman/listinfo/python-list
