[Python-checkins] python/dist/src/Lib/distutils dist.py,1.56,1.57

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Thu, 31 Oct 2002 05:22:43 -0800


Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory usw-pr-cvs1:/tmp/cvs-serv10235

Modified Files:
	dist.py 
Log Message:
Make the Distribution() constructor forgiving of unknown keyword
arguments, triggering a warning instead of raising an exception.  (In
1.5.2/2.0, it will print to stderr.)

Bugfix candidate for all previous versions.  This changes behaviour,
but the old behaviour wasn't very useful.  If Distutils version X+1
adds a new keyword argument, using the new keyword means your setup.py 
file won't work with Distutils version X any more.  


Index: dist.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** dist.py	11 Sep 2002 16:31:52 -0000	1.56
--- dist.py	31 Oct 2002 13:22:41 -0000	1.57
***************
*** 13,16 ****
--- 13,22 ----
  from types import *
  from copy import copy
+ 
+ try:
+     import warnings
+ except:
+     warnings = None
+ 
  from distutils.errors import *
  from distutils.fancy_getopt import FancyGetopt, translate_longopt
***************
*** 207,212 ****
                      setattr(self, key, val)
                  else:
!                     raise DistutilsSetupError, \
!                           "invalid distribution option '%s'" % key
  
          self.finalize_options()
--- 213,221 ----
                      setattr(self, key, val)
                  else:
!                     msg = "Unknown distribution option: %s" % repr(key)
!                     if warnings is not None:
!                         warnings.warn(msg)
!                     else:
!                         sys.stderr.write(msg + "\n")
  
          self.finalize_options()