On Thu, 2010-12-02 at 18:09 -0500, Nathan Weston wrote:
> PyInstaller 1.5rc1 fails to build executables on Snow Leopard. It always 
> wants to use the 64-bit bootloader (which doesn't exist) even when I 
> configure/build with a 32-bit python.
> 
> Python on Snow Leopard is an i386/x64 universal binary, which runs as a 
> 64-bit executable by default. You can choose 32-bit by setting the 
> environment variable VERSIONER_PYTHON_PREFER_32_BIT=yes. However, 
> platform.architecture(), which PyInstaller uses to choose a bootloader, 
> doesn't work correctly -- it apparently gets confused by the universal 
> binary an always returns ('64bit', '').
> 
> After poking around a bit it seems that the most reliable way to detect 
> the architecture is by checking sys.maxint. I was able to fix the 
> problem by replacing "platform.architecture()[0]" with this function:
> 
> def architecture():
>    if sys.maxint > 3**32:
>      return '64bit'
>    else:
>      return '32bit'
> 
> I can submit a patch if that would be helpful.

Yes, please! If you can submit a patch that you know it is fully
working, I can slip it in before PyInstaller 1.5 is released.

So, let see if I understood:

 * Mac OSX 64-bit does not work (or at least there is no bootloader --
it would be interesting to find out what happens if you build the
bootloader as explained in the manual, it might even work).

 * To use the 32-bit version within the universal binary (which defaults
to 64-bit), you need an environment variable set but then PyInstaller
fails to detect that it's a 32-bit version because of
platform.architecture() (which is a Python bug IMO).

 * By manually implementing architecture(), PyInstaller correctly
detects that you are running a 32-bit version of Python and works as
expected.

Since you are at it, it would be really great if you could add at the
top of Configure.py an early error for Darwin 64-bit, something like:

if darwin and architecture() == "64bit":
   print "ERROR: PyInstaller does not support Python 64-bit on Mac OSX"
   print "Try using the 32-bit version of Python, by setting"
   print "VERSIONER_PYTHON_PREFER_32_BIT=yes in the environment"
   sys.exit(2)

This would lead to less confusion for Mac people.

> The good news is that once I fix this problem, it works perfectly -- I 
> don't need any of the patches or workarounds that I had with previous 
> versions.

I'm really happy to hear that, Lorenzo has gone through many hoops to
test and complete the patches that were dangling around :)

Since you seem to be knowledgeable on the Mac OSX platform, any idea
about the issue reported by Isaac Wagner on this mailing list ("Mac OSX
Support", Dec 1st)?  He can't build a working executable with Python 2.7
from python.org on Mac.

Thanks!
-- 
Giovanni Bajo   ::  [email protected]
Develer S.r.l.  ::  http://www.develer.com

My Blog: http://giovanni.bajo.it
Last post: Compile-time Function Execution in D

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to