I am working on packaging an application that uses a library called "harp". This python code loads a library using the CFFI module. This is all well and good, except for one problem: the script containing the initialization code expects to live in:
As such, it has the following line of code to find the path to the C library .so/.dylib:
which, under normal usage, gives it a path to the 'lib' directory. However, once packaged using Pyinstaller, the "__file__" is moved, so the above code ends up pointing to the .app directory (on MacOS X, presumably on windows/linux it would be some other equally incorrect path).
Of course, I could easily fix this by changing that line of code (I'm thinking something like "../lib" might work, but it might take some tweaking), however that would then break things when running my app normally (not through Pyinstaller). So how should I best approach this? Is there a way in Pyinstaller to tell it "this file needs to live here" such that the existing path definition would be correct? Or, alternately, is there a way to say "substitute this custom file?" Or maybe a way to write a hook that would change that one line of code on packaging (hopefully that's all that needs changed)? Thanks.
Israel Brewster Software Engineer Alaska Volcano Observatory Geophysical Institute - UAF 2156 Koyukuk Drive Fairbanks AK 99775-7320