Python 2.6, py2exe, Vista & manifest questions

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/

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:

py2exe - wxPyWiki
  

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

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.

···

On Fri, May 29, 2009 at 06:54, Andrea Gavana <andrea.gavana@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)

Conrado Porto Lopes Gouvêa wrote:

···

On Fri, May 29, 2009 at 06:54, Andrea Gavana <andrea.gavana@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

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 :slight_smile:

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] Application manifests - Win32 apps

Conrado

···

On Fri, May 29, 2009 at 15:16, Werner F. Bruhin <wbruhin@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.