Let's say I have a Foo package organized like this:
Foo\
__init__.py
foo.py
bar.py
lib\
libwhatever.so
My foo.py module uses python types to wrap the C methods contained in my libwhatever.lib, which includes checking lib where it should be. 2 questions:
1) How to check in my package that the required lib is in its place (in Foo \ lib), wherever the entire Foo package is placed?
Right now, the path to my lib is hard-coded, but since I can distribute things later, the problem will come.
2) Then I have a module bar.py that contains a slower version of C-routines in Python inside libwhatever. I would like to use them instead of whether the libwhatever import fails. Is there a way to abstractly switch between versions of C and Python routines to succeed or fail to import a library?
Thank you in advance for your advice.
source
share