From: Stefan K. <pon...@ya...> - 2005-01-04 20:51:00
|
Just some notes for those trying to build stand alone apps. I was able to build a complete stand alone executable using the McMillan installer, thanks to Phil Edwards for the invaluable documentation! It is possible to use the McMillan installer to build a single executable ( using its 'onefile' option ) with the rsrc files included, the Inno tool is not required. Also this works on unix as well as Windows. The trick is to add the rsrc files to the EXE 'TOC' class in the installer .spec file. If you give the rsrc files in the spec file a typecode of 'BINARY' ( rather than 'DATA' ) then they are bundled in the .exe. The exe is really a self extracting archive, all the dependent dlls ( and now the rsrc files as well ) get unzipped into a tmp dir when you run the .exe. The location of this tmp directory is available in os.environ['_MEIPASS2'], weird I know, but it works. You need then to pass that filename ( with the full path to the 'tmp' copy of the rsrc ) to the Application() constructor. Here is some sample code.. from the Installer '.spec' file.. p = path_to_your_app ... exe = EXE( pyz, a.scripts, a.binaries + [('YourFile.rsrc.py', p + 'YourFile.rsrc.py', 'BINARY' )], name='YourName.exe', debug=0, strip=0, upx=0, console=0, icon=p + 'yourfile.ico') and then in your application code... installer_dir = './' if os.environ.has_key( '_MEIPASS2' ): installer_dir = os.environ['_MEIPASS2'] if __name__ == '__main__': app = model.Application(YourFile, installer_dir + 'YourFile.rsrc.py') app.MainLoop() Also you have to have Mark Hammond's win2all extensions installed for the icon assignment to work on windows. The McMillian installer can be found here.. http://paulbaranowski.org/modules.php?name=Downloads&d_op=MostPopular hope this helps someone out there.. S __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo |