[Python-checkins] python/dist/src/Lib/distutils dist.py,1.53,1.53.6.1

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Wed, 20 Nov 2002 07:05:44 -0800


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

Modified Files:
      Tag: release22-maint
	dist.py 
Log Message:
Backport of rev1.57: 
 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.)


Index: dist.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v
retrieving revision 1.53
retrieving revision 1.53.6.1
diff -C2 -d -r1.53 -r1.53.6.1
*** dist.py	6 Dec 2001 20:51:35 -0000	1.53
--- dist.py	20 Nov 2002 15:05:41 -0000	1.53.6.1
***************
*** 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
***************
*** 205,210 ****
                      setattr(self, key, val)
                  else:
!                     raise DistutilsSetupError, \
!                           "invalid distribution option '%s'" % key
  
          self.finalize_options()
--- 211,219 ----
                      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()