[Distutils] Distutils windows binaries...

Phil Hornby phil.hornby at accutest.co.uk
Wed Feb 4 12:09:43 EST 2004


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. This includes the attached zip archive in the produced
installers... so my assumption is that the archive is appended as a
resource. 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 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.

--
Phil

"Requirements - what are they I just hack something together that does what
I think they want" ;)

>>>> I know you can change the bitmap displayed during the install but can
you
>>>> change the icon that is displayed for the *.exe that is generated?
>>>
>>> You can change the icon of the
>>> Lib/site-packages/distutils/command/wininst.exe with any tool of your
>>> choice, *before* building the installer.
>>
>> I would like to do this programatically instead of doing it manually.
Anyone
>> know of a python tool that can do that...or is that gonna have to be a
>> project of my own? I am also interested to know why you stressed the
>> *before* statement - surely I could change the icon on the produced
*.exe?
>> and as such after building the installer?
>
> Well, the finished installer exe-file is actually wininst.exe plus an
> appended zip-archive.  I haven't tried tools other than MSVC 6, which is
> able to edit resources in binary files (there are also others), but
> MSVC6 is confused by the appended zip-portion.
>
> I don't know of a Python tool which does this, but py2exe contains a
> compiled extension which updates the icon resources.  You can probably
> either use this as is (it's the py2exe_util.pyd), or you use the source
> code and translate the calls into win32all or ctypes calls.



_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG at python.org
http://mail.python.org/mailman/listinfo/distutils-sig




More information about the Distutils-SIG mailing list