[Distutils] Proposed patch: allowing unknown keywords

A.M. Kuchling amk@amk.ca
Wed Oct 30 20:19:02 2002


I'd like to check in the following patch; it causes unknown keywords
in the setup() invocation to trigger a warning instead of an
exception.  This will make it possible to add more metadata arguments
to setup() in future versions while still letting packages be
installed with Distutils versions lacking the added arguments.

Any objections?  Should it be backported to Python 2.2?

--amk

Index: dist.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v
retrieving revision 1.56
diff -u -u -r1.56 dist.py
--- dist.py	11 Sep 2002 16:31:52 -0000	1.56
+++ dist.py	31 Oct 2002 00:24:55 -0000
@@ -9,7 +9,7 @@
 
 __revision__ = "$Id: dist.py,v 1.56 2002/09/11 16:31:52 jhylton Exp $"
 
-import sys, os, string, re
+import sys, os, string, re, warnings
 from types import *
 from copy import copy
 from distutils.errors import *
@@ -206,8 +206,7 @@
                 elif hasattr(self, key):
                     setattr(self, key, val)
                 else:
-                    raise DistutilsSetupError, \
-                          "invalid distribution option '%s'" % key
+                    warnings.warn("Unknown distribution option: %r" % key)
 
         self.finalize_options()