From: Alexander B. <bi...@uk...> - 2006-02-03 11:54:54
|
Avery Andrews пишет: > Is there any way to arrange things so that py2exe will make a single ..exe containing the bytecoded script, but using a pre-existing Python installation rather than including most of one? The use would be to have something small that worked like ordinay exe, and consisted of only one file, unlike the output of exemaker. I wonder to know why for it needed for you. For me is enough to write simple batch launcher file. I'm slightly hacks exemaker and rewrite its internal python ineraction mechanism. So if you have working win32 compiler (Borland C++5.5 or MS Toolkit 2003 -- both are free to downloads) installed on your machine I can give you some hints: You need include your main script as global const str into your program source and use PyRun_SimpleString from Python C/API instead of Py_Main as usual exemaker does for run script as string in your custom exe. But you need to recompile exe each time. I suppose it's slightly not ideal solution and not completely fit your needs. I think it's better to store script as exe-resource that could be linked to modified exemaker without recompiling it, but at this moment I not playing with it. If someone want to help -- I can rewrite my exemaker modification. If you wish to bundling into exe all needed library that your python program needs to work (like py2exe does) you should to build your exe always against specified python dll, because py2exe store python compiled bytecodes that depends on version of python (pyc for 2.4 won't work with python23.dll). That's one important reason why py2exe always bundle into produced exe pythonXX.dll. -- Alexander |