Re: [Distutils] Passing compiler options via the pydistutils.cfg file

At 10:02 AM 1/10/2008 -0800, kieran hervold wrote:
I've run into a problem using mod_python under OS X Leopard: because the apache2 process runs in 64-bit mode, the python interpreter is forced into 64-bit mode, which breaks compatibility with any Python library with underlying C code.
I suspect that adding a compiler flag specifying "-arch x86_64" to any gcc invocation would fix the problem, but I'd rather not do this package by package: I'd like to set one global parameter and be done with it.
Apparently, I can add an entry to the global pydistutils.cfg file. However, I can't seem to find the appropriate parameter. The pydistutils.cfg file follows the nomenclature of command-line setup.py invocation, but I haven't found a C compiler pass-through parameter for setup.py.
Does such a parameter exist?
Apparently not: $ python setup.py build_ext --help ... Options for 'build_ext' command: --build-lib (-b) directory for compiled extension modules --build-temp (-t) directory for temporary files (build by-products) --inplace (-i) ignore build-lib and put compiled extensions into the source directory alongside your pure Python modules --include-dirs (-I) list of directories to search for header files (separated by ';') --define (-D) C preprocessor macros to define --undef (-U) C preprocessor macros to undefine --libraries (-l) external C libraries to link with --library-dirs (-L) directories to search for external C libraries (separated by ';') --rpath (-R) directories to search for shared C libraries at runtime --link-objects (-O) extra explicit link objects to include in the link --debug (-g) compile/link with debugging information --force (-f) forcibly build everything (ignore file timestamps) --compiler (-c) specify the compiler type --swig-cpp make SWIG create C++ files (default is C) --swig-opts list of SWIG command line options --swig path to the SWIG executable --help-compiler list available compilers
If I want to add a flag ("-arch x86_64", in this case) to the C compiler invocation, how do I pass that to setup.py?
There's probably an environment variable you can use, like CFLAGS or some such; check the distutils.sysconfig module to see if you can find something useful. Otherwise, you may have to have apache run your setup.py files to do the building.
participants (1)
-
Phillip J. Eby