[Distutils] Distutils windows binaries...

Phil Hornby phil.hornby at accutest.co.uk
Wed Feb 4 15:45:58 EST 2004


>> 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.

Doing this the seems to not modify the right resource...or maybe I just need
to work out exactly which resource it is that I need to mod...

>>  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
> gui.

Okay I had seen what was done in with appending the data - I assumed that it
was simply faking up an entry in the exe's resource table.

>> 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.

That was my plan...

>> 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.
>
> Cool.

Although I think my first version will simply use the stuff from py2exe -
testing for it's presence... this might be the best solution anyway - as why
would I want to re-invent the wheel...;)

--
Phil

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




More information about the Distutils-SIG mailing list