Building python packages for the correct architecture on OSX 10.5
Arnaud Delobelle
arnodel at googlemail.com
Wed Nov 14 12:35:00 EST 2007
Hi fellow python enthusiasts.
Having recently acquired a MacBook Pro (Intel Core 2 Duo) which comes
with python2.5, I have been installing some modules that I need (PIL,
psycopg2, PyXML ...).
The problem is that [$python setup.py build] compiles all the binaries
to universal files for i386 and ppc32, but not x86_64 or ppc64. It
does not appear to be a problem when running scripts from the shell
(as python seems to run as a 32 bits problems), but it is a problem
from apache2/mod_python as the included apache2 runs as 64 bits
processes.
This means the modules need to be compiles for at least both i386 and
x86_64 in my case. I have been looking at the setup.py files of
various modules but I cannot see a suitable way to indicate what
architectures I want them compiled for. So far, I have managed by
adding the following lines in setup.py just after the Extension class
is imported:
OrigExtension = Extension
def Extension(*args, **kwargs):
extra_args = ['-arch', 'ppc', '-arch', 'ppc64',
'-arch', 'i386', '-arch', 'x86_64 ']
kwargs['extra_compile_args'] = extra_args +
kwargs.get('extra_compile_args', [])
kwargs['extra_link_args'] = extra_args +
kwargs.get('extra_link_args', [])
return OrigExtension(*args, **kwargs)
Obviously this is a dirty hack, and I would like to know how to do
this the right way. How can this be done better?
--
Arnaud
More information about the Python-list
mailing list