classification
Title: distributions built with bdist_msi on 64-bit Windows fail to install correctly
Type: Stage:
Components: Distutils, Windows Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: jaraco, loewis, tarek
Priority: normal Keywords:

Created on 2009-06-10 18:10 by jaraco, last changed 2009-06-13 09:21 by loewis. This issue is now closed.

Messages (8)
msg89221 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2009-06-10 18:10
It appears as if bdist_msi isn't properly tagging 64-bit binary builds.

When launching an .msi built by Python 2.6.2 using bdist_msi, such as
numpy found here
(https://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103),
it improperly detects the location of Python (which it gets from the
registry).  If the 32-bit Python 2.6 is also installed, it finds that
version.  If 32-bit Python 2.6 is not installed, it fails to find the
Python installation.  Even if the proper 64-bit Python 2.6 location is
selected, the files are not installed to the Python 2.6 site-packages. 
Furthermore, the registry Uninstall information is stored in the
Wow6432Node.

bdist_wininst executables appear to detect 64-bit Python and install
correctly.

I will attempt to recreate this problem with a minimal project and clean
64-bit Vista or Windows 7 machine at a later date.
msg89229 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2009-06-10 20:30
Indeed, I confirmed that using the simple example from the distutils manual (http://docs.python.org/distutils/introduction.html#a-simple-example) on a clean install of Python 2.6.2, bdist_msi exhibits the behavior previously described.

I suspect that the TargetPlatform property needs to be set (based on what I read here: http://msdn.microsoft.com/en-us/library/cd7a85k9(VS.80).aspx ).
msg89230 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2009-06-10 21:21
Based on the MSDN article and what I read in a blog entry
(http://blogs.msdn.com/heaths/archive/2005/10/24/windows-installer-on-64-bit-platforms.aspx),
I thought that the enclosed patch might work around the issue... and
while it does set the template property to x64, the undesirable behavior
persists.

Index: Lib/msilib/__init__.py
===================================================================
--- Lib/msilib/__init__.py      (revision 73295)
+++ Lib/msilib/__init__.py      (working copy)
@@ -3,8 +3,11 @@
 # Licensed to PSF under a Contributor Agreement.
 from _msi import *
 import os, string, re
+import sys

-Win64=0
+Intel64=0
+AMD64 = 'AMD64' in sys.version
+Win64 = Intel64 or AMD64

 # Partially taken from Wine
 datasizemask=      0x00ff
@@ -145,8 +148,10 @@
     si.SetProperty(PID_TITLE, "Installation Database")
     si.SetProperty(PID_SUBJECT, ProductName)
     si.SetProperty(PID_AUTHOR, Manufacturer)
-    if Win64:
+    if Intel64:
         si.SetProperty(PID_TEMPLATE, "Intel64;1033")
+    elif AMD64:
+        si.SetProperty(PID_TEMPLATE, "x64;1033")
     else:
         si.SetProperty(PID_TEMPLATE, "Intel;1033")
     si.SetProperty(PID_REVNUMBER, gen_uuid())
msg89231 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2009-06-10 21:23
I'm adding Martin to this as he appears to be the author of msilib.  If
it's inappropriate for me to do this, I apologize.  Just let me know and
I won't do it again.
msg89240 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-06-11 08:38
No that's fine Jason, I was about to do it ;)

I can work on the patch and commit it since it's distutils-related, but
Martin is the one that will validate it and give the green light on msi
matters.
msg89292 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-06-12 17:32
For 2.7 and 3.1, this is now fixed with r73390 and r73391. The trick is
to set the Win64 bit in RegLocator also.
msg89294 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2009-06-12 18:46
That's great.  Thanks Martin!

What about Python 2.6?  If the fix is hard to port back to 2.6, perhaps
bdist_msi should raise an Unsupported error in 64-bit Python.

Let me know if I can help any further.
msg89316 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-06-13 09:21
For 2.6 and 3.0, this is now fixed in r73406 and r73407.
History
Date User Action Args
2009-06-13 09:21:56loewissetstatus: open -> closed
resolution: fixed
messages: + msg89316
2009-06-13 08:10:55tareksetassignee: tarek -> loewis
2009-06-12 18:46:34jaracosetmessages: + msg89294
2009-06-12 17:32:06loewissetmessages: + msg89292
2009-06-11 08:38:14tareksetmessages: + msg89240
2009-06-10 21:23:52jaracosetnosy: + loewis
messages: + msg89231
2009-06-10 21:21:34jaracosetmessages: + msg89230
components: + Windows
2009-06-10 20:30:21jaracosetmessages: + msg89229
title: distributions built with bdist_msi on 64-bit Windows fail to install correctly -> distributions built with bdist_msi on 64-bit Windows fail to install correctly
2009-06-10 18:10:43jaracocreate