Python 2.6, py2exe, Vista & manifest questions

114 views
Skip to first unread message

Andrea Gavana

unread,
May 29, 2009, 5:54:23 AM5/29/09
to wxPytho...@googlegroups.com, gui...@googlegroups.com
Hi All,

I am (slowly) working on updating GUI2Exe, and again I stumbled
upon the issue of the manifest file on Python 2.6/Vista/py2exe (and
other executable builders as well). I don't have Vista, so I am
progressing almost as in a dark room with my code. I have read the
very interesting Wiki page Werner has set up:

http://wiki.wxpython.org/py2exe

But I still have some questions. As I understand, with Python 2.6 and
Vista you shouldn't check the manifest option in GUI2Exe: but GUI2Exe
needs to know if a manifest is needed, so I believe I will change what
the manifest option does in case the user is compiling on Vista using
Python 2.6. Anyway, is this line of reasoning correct:

==> Assuming the manifest option in GUI2Exe *is* checked <== :

if operating_system >= Windows Vista and Python_version >= 2.6:

(a) Do not embed the manifest in the executable
(b) Create a Microsoft.VC90.CRT.manifest
(c) Extract the content of the Microsoft.VC90.CRT.manifest from
some other DLL (where??) and copy it to the manifest in (b)

else:

(a) Do everything as you did before the Python 2.6/Windows SxS mess came up

Is this correct? Am I missing something? Does anyone have an answer
for the point (c)?

Other than that, does anyone have any experience with the other
freezing tools (cx_Freeze, bbFreeze, PyInstaller) on Vista with Python
>= 2.6?

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

Werner F. Bruhin

unread,
May 29, 2009, 9:18:01 AM5/29/09
to wxPytho...@googlegroups.com
Hi Andrea,

Andrea Gavana wrote:
> Hi All,
>
> I am (slowly) working on updating GUI2Exe, and again I stumbled
> upon the issue of the manifest file on Python 2.6/Vista/py2exe (and
> other executable builders as well). I don't have Vista, so I am
> progressing almost as in a dark room with my code. I have read the
> very interesting Wiki page Werner has set up:
>
> http://wiki.wxpython.org/py2exe
>

Thank you, but I think it still needs some work.


> But I still have some questions. As I understand, with Python 2.6 and
> Vista you shouldn't check the manifest option in GUI2Exe: but GUI2Exe
> needs to know if a manifest is needed, so I believe I will change what
> the manifest option does in case the user is compiling on Vista using
> Python 2.6. Anyway, is this line of reasoning correct:
>
> ==> Assuming the manifest option in GUI2Exe *is* checked <== :
>
> if operating_system >= Windows Vista and Python_version >= 2.6:
>

if operating_system >= Windows and Python_version >= 2.6:

The problem is not the build machine, but the machine you deploy too. So, ideally we should be able to build an exe/installer on any Windows OS version and deploy to any Windows OS version.

For this to work (as far as I have found so far) you need to put the VC90 manifest and relevant dll's into the same folder then the app.exe, i.e. they can not be in a sub-folder.

If one uses the py2exe option "lib/library.zip" then the "lib" folder needs to get a second copy of the VC90 stuff.

Now, I have second thoughts if Gui2Exe/py2exe should copy these things or if this is not better done in an installer. I.e. an InnoSetup script can check if a particular version the VC90 stuff is available on a system and if it is not install anything, or if it is not install it either as private or into the SxS folders.

So, maybe Gui2Exe/py2exe should just give the information that xyz is needed - i.e. a list of dll's etc.

> (a) Do not embed the manifest in the executable
>

I do not think that it will disturb anything if you keep it.


> (b) Create a Microsoft.VC90.CRT.manifest
> (c) Extract the content of the Microsoft.VC90.CRT.manifest from
> some other DLL (where??) and copy it to the manifest in (b)
>

Best is probably to get it from python25/python.exe or pythonw.exe.

Robin posted some info on how one can update the manifest with some
ctypes/Python code and I tried to adapt it to read this code, but
without any success.


> else:
>
> (a) Do everything as you did before the Python 2.6/Windows SxS mess came up
>
> Is this correct? Am I missing something? Does anyone have an answer
> for the point (c)?
>
> Other than that, does anyone have any experience with the other
> freezing tools (cx_Freeze, bbFreeze, PyInstaller) on Vista with Python
>

I played with cx- and bbFreeze, and I am planning to do some more work
with cxFreeze as it looks like one could very easily support Windows and
Linux with it, which would be nice. I will at least document the points
Anthony Tuininga made in a recent thread on the wiki along the lines of
what I have done for py2exe.

BTW, cxFreeze actually copied the VC90 dll's into the build folder, but
it did not automatically include the manifest, but Anthony explained how
that would be done.

Werner

Conrado Porto Lopes Gouvêa

unread,
May 29, 2009, 1:22:47 PM5/29/09
to wxPytho...@googlegroups.com
On Fri, May 29, 2009 at 06:54, Andrea Gavana <andrea...@gmail.com> wrote:
>    (c) Extract the content of the Microsoft.VC90.CRT.manifest from
> some other DLL (where??) and copy it to the manifest in (b)
>

I don't see the reason to do that... Microsoft.VC90.CRT.manifest is a
static file, so unless I'm wrong, just have the contents hardcoded in
Gui2Exe and write it to the file.

I also agree that this doesn't depends on the host OS, since it may be
deployed to XP, Vista, 7... the approach works for all of them.

Werner F. Bruhin

unread,
May 29, 2009, 2:16:02 PM5/29/09
to wxPytho...@googlegroups.com
Conrado Porto Lopes Gouvêa wrote:
> On Fri, May 29, 2009 at 06:54, Andrea Gavana <andrea...@gmail.com> wrote:
>
>> (c) Extract the content of the Microsoft.VC90.CRT.manifest from
>> some other DLL (where??) and copy it to the manifest in (b)
>>
>>
>
> I don't see the reason to do that... Microsoft.VC90.CRT.manifest is a
> static file, so unless I'm wrong, just have the contents hardcoded in
> Gui2Exe and write it to the file.
>
The Py2.6.2 version of the manifest contains version number and I am not
sure if the publicKeyToken doesn't change too, so extracting it from the
Python 2.6x version might be saver for the future.

Werner

Conrado Porto Lopes Gouvêa

unread,
May 29, 2009, 3:35:28 PM5/29/09
to wxPytho...@googlegroups.com
On Fri, May 29, 2009 at 15:16, Werner F. Bruhin <wbr...@gmail.com> wrote:
> The Py2.6.2 version of the manifest contains version number and I am not
> sure if the publicKeyToken doesn't change too, so extracting it from the
> Python 2.6x version might be saver for the future.
>

OK, I've researched a little...

The publicKeyToken is dependent of the public key used to sign the
DLL's files [1]. So it depends only on the DLL files used. I don't
know which approach Gui2Exe will use to get the DLL's, but if it's
delegated to the user, then the user should provide the manifest file.
If you copy it from somethinhg else, then the same DLL's of that
something else should be used.

The Right Way to do it, though, would be to copy from
%PROGDIR%\Microsoft Visual Studio 9.0\VC\Redist\ but that would
require the developer to have Visual Studio, which is not a simple
assumption :)

I guess there's two options:
- Ship Gui2Exe with a set of DLL's and a corresponding manifest, and use those
- Leave to the user to find a set of DLL's and their manifest

[1] http://msdn.microsoft.com/en-us/library/aa374191(VS.85).aspx

Conrado

Reply all
Reply to author
Forward
0 new messages