Issue 664131: distutils config exe_extension on Mac OS X, Linux (original) (raw)

I have been using distutils' "python setup.py config" command in order to do some configuration steps before the build and install. On Linux and Mac OS X, when doing trial compilations I get this error:

File "/usr/local/lib/python2.3/distutils/command/config.py", line 154, in _link prog = prog + self.compiler.exe_extension TypeError: cannot concatenate 'str' and 'NoneType' objects

The problem is that on Mac OS X and Linux, self.compiler.exe_extension is None instead of "", and Python doesn't allow None to be concatenated with a string. The solution would be either to set self.compiler.exe_extension to "" instead of None, or to check if self.compiler.exe_extension is None before concatenating. The attached patch does the latter:

if self.compiler.exe_extension: prog = prog + self.compiler.exe_extension

Changing self.compiler.exe_extension to "" instead of None may be a cleaner solution, but I don't know how that would affect other parts of the distutils, which is why I went with the solution above.

Michiel de Hoon (mdehoon@ims.u-tokyo.ac.jp) University of Tokyo, Human Genome Center