[Distutils] patch to unixccompiler.py

Joe Van Andel vanandel@ucar.edu
Tue, 01 Feb 2000 14:05:19 -0700


I've encountered a situation where I'd like to be able to over-ride the
default compiler used by distutils.  I have an extension which requires
a newer version of gcc than I used to build python.

 The following patch uses the value of the CC environment variable to
override the default.  I'd like to see this in the next version of
distutils, if possible:

% diff -c unixccompiler.orig unixccompiler.py

*** unixccompiler.orig  Sun Dec 12 09:57:47 1999
--- unixccompiler.py    Tue Feb  1 13:58:39 2000
***************
*** 22,27 ****
--- 22,32 ----
  from copy import copy
  from sysconfig import \
       CC, CCSHARED, CFLAGS, OPT, LDSHARED, LDFLAGS, RANLIB, AR, SO
+ import os
+ tcc = os.environ.get('CC')
+ if tcc:
+       CC=tcc
+ 
  from ccompiler import CCompiler, gen_preprocess_options,
gen_lib_options
  from util import move_file, newer_pairwise, newer_group



-- 
Joe VanAndel  	          
National Center for Atmospheric Research
http://www.atd.ucar.edu/~vanandel/
Internet: vanandel@ucar.edu