[Pythonmac-SIG] Re: [Python-Dev] Re: [Python-checkins] python/dist/src/Mac/OSX fixapplepython23.py, 1.1, 1.2

Bob Ippolito bob at redivi.com
Wed Dec 29 11:40:30 CET 2004

On Dec 29, 2004, at 5:23 AM, Jack Jansen wrote:

> On 29-dec-04, at 4:35, Bob Ippolito wrote:
>> This is the wrong fix.  Distutils is dumber than you think.  This 
>> patch just breaks C++ compilation in a different way.  The correct 
>> solution is a patch to distutils of some kind.
>> from distutils/unixccompiler.py:174
>>                 if target_lang == "c++" and self.compiler_cxx:
>>                     linker[0] = self.compiler_cxx[0]
>>                 self.spawn(linker + ld_args)
>> "linker" is the variable expanded LDSHARED (or whatever comes out of 
>> sysconfig.customize_compiler).
> Bah!
> Any suggestions as to what to do to get c++ compilation fixed?

I can think of two ways:

1. Patch distutils to actually do 
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3' because CCompiler.spawn 
doesn't take an environment dict.
2. Patch distutils to skip over environment variables (basically change 
that "0" into something smarter).   This is probably less desirable 
because who knows where this happens, and who knows what third party 
compiler subclasses used this original stupid code as a template.

In either case, setting the environment variable should only be done if 
it's not already set, and it should raise if is set to anything lower 
than 10.3.  For example, an existing MACOSX_DEPLOYMENT_TARGET variable 
of 10.4 should be allowed.  Values smaller than 10.3 should not be 
allowed because they are incompatible with the linker feature we're 
trying to enable.

> Also, could you point me to a readily available extension package that 
> uses c++?

I have no idea, but I remember this issue was brought up at some point 
during one of the many discussions of this issue.  I think it was also 
mentioned that SciPy's distutils extensions (or is it a fork?) does 
something similarly stupid when frobbing in a Fortran compiler.


More information about the Python-Dev mailing list