[Pythonmac-SIG] universal python framework?

Ronald Oussoren ronaldoussoren at mac.com
Sat Dec 10 10:04:44 CET 2005

On 9-dec-2005, at 21:36, Jack Jansen wrote:

> On 9-dec-2005, at 18:56, William Kyngesburye wrote:
>> I'm starting to build universal binaries for a bunch of 'nix stuff,
>> some of which have python bindings/extensions.  Has anyone looked at
>> a universal Python framework?  I'd hate to have to step backwards to
>> Apple's included Python framework for that, but I may have to.
> There's a fairly recent Apple technote that discusses how to build
> universal binaries for products with a configure/make build
> procedure, such as Python, and I hope to look at that next week. But
> Ronald already discovered that distutils has problems with building
> universal extensions, so that may also turn out to be a problem
> (although he wants to build something more complicated, with the PPC
> binary being 10.3/10.4 compatible).

The problem I discovered has nothing to do with being 10.3  
compatible. The
problem is that distutils exposes the contents of pyconfig.h through a
python interface. Some python packages use that functionality  
(although I
guess only those of people that really understand distutils). This is
from the setup.py in cElementTree:

     config_h = sysconfig.get_config_h_filename()
     config_h_vars = sysconfig.parse_config_h(open(config_h))
     for feature_macro in ["HAVE_MEMMOVE", "HAVE_BCOPY"]:
         if config_h_vars.has_key(feature_macro):
             defines.append((feature_macro, "1"))
     defines.append(("XML_NS", "1"))
     defines.append(("XML_DTD", "1"))
     if sys.byteorder == "little":
         defines.append(("BYTEORDER", "1234"))
         defines.append(("BYTEORDER", "4321"))

This luckily doesn't use stuff like 'WORDS_BIGENDIAN' or 'SIZEOF_INT'  
and should
therefore not cause problems with universal builds in that regard.  
sys.byteorder to the compiler does of course cause minor problems.

I don't know how serious this problem is, I'd guess that most python  
packages with
extensions don't contain compilications like this.

I ran into this issue when I tried to build a binary installer for  
Python 2.4.2,
I tried to replace pyconfig.h by a header file that includes the  
pyconfig.h for 10.3
or 10.4 based on feature macros, but that caused problems when I  
tried to build

With respect to 10.3 compatibility: I like the fact that there's  
currently 1 binairy
distribution of python for OSX and would like to keep it that way.  
Getting without
having discrepancies in functionality between python-universal  
running on 10.4-x86
and python-universal running on 10.4-ppc is a bit of a challenge, but  
should be

> And the "easy" way is to simply configure Python twice (Python builds
> nicely in a different directory than the source, I'm doing that all
> the time), once for ppc once for x86, and then using lipo to combine
> everything.
> --
> Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
> If I can't dance I don't want to be part of your revolution -- Emma
> Goldman
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

More information about the Pythonmac-SIG mailing list