[Distutils] Distutils windows binaries...

Thomas Heller theller at python.net
Wed Feb 4 13:48:22 EST 2004

"Phil Hornby" <phil.hornby at accutest.co.uk> writes:

> Thomas,
> Thanks for the info....IT WORKS!!
> import py2exe.py2exe_util
> py2exe.py2exe_util.update_icon( U'wininst.exe', U'myicon.ico', 1 )
> the little code snippet above will change the ico for a *.exe but deletes
> any other resources.

The last parameter is a flag which specifies whether to delete existing
resources or not.  Setting it to 0 should keep them intact.

>  This includes the attached zip archive in the produced
> installers... so my assumption is that the archive is appended as a
> resource.

No, it isn't.  It it simply appended to the exe-file, look into
bdist_wininst.py to see how it's done.

Other resources present in wininst.exe are the dialogs needed for the

> So my guess is that I will have to modify the exe pre- building
> the distro package. I may do it by making a temporary copy of the
> wininst.exe before adding the zip archive and modify this temporary
> version - so as not to change the version in the main python dir.

I guess you can do it by subclassing the bdist_wininst class in
bdist_wininst.py - read the sources.

> I haven't done much testing with it - including whether the modified
> installer work but the ico is modified happily - the one potential issue I
> could see is if the more resources exist within the installer other than the
> basic installer icon as this code delete's all reasources in the file.
> When I have a working sample - that doesn't need py2exe installed - I will
> make it available by posting here - incase you want to put the functionality
> into the official version.



More information about the Distutils-SIG mailing list