We expose C++ code to python via boost.python. We produce release and debug builds.
release builds produce lib.so files
debug builds produce lib-g.so files.
Our python code then
import lib<mymodule>
Is there a way to place a hook such that those import statements can explore both libmymodule.so and if not found libmymodule-g.so?
Try the following:
import importlib
try:
import libmymudule
except ImportError:
libmymudule = importlib.import_module("libmymudule-g")