Intra-package C extensions with freeze.py

Pascal Chambon chambon.pascal at gmail.com
Wed Jan 13 14:52:55 EST 2010


Hello everyone
Some times ago, I've had unexpected problems while trying to freeze some 
scripts into a standalone executable with the "freeze.py" script.
I had already done it : normally, you simply freeze pure python modules 
into a standalone executable, you package it along with python 
extensions (_ssl.so, time.so etc.), and you're done.

But the problem is that I had a dependency with python-fuse bindings, 
and these bindings contains a python extension (_fusemodule.so) inside 
the "fuseparts" package.
So pure python modules of this fuse wrapper got frozen into the 
standalone executable, and I had that "fuseparts/_fusemodule.so" left 
outside, which was not found by the module loader, since it was expected 
to appear inside a "fuseparts package" now embedded into the executable....

I've managed to solve that by manually "monkey patching" sys.modules, 
before fusemodule's actual import. But this looks like an unsatisfying 
solution, to me.
Does anyone have a clue about how to freeze a python program cleanly, in 
case such inner C extensions are involved ? Does any of the freezers 
(freeze.py, py2exe, pyrex, cx_freeze...) do that ? I haven't seen such 
things so far in their docs.

Thanks for the attention,
Regards,
Pascal




More information about the Python-list mailing list