[Distutils] Proposed patch: allowing unknown keywords

M.-A. Lemburg mal@lemburg.com
Thu Oct 31 03:36:01 2002


A.M. Kuchling wrote:
> 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?

No and yes :-)

> --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()
>  
> 
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG@python.org
> http://mail.python.org/mailman/listinfo/distutils-sig

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/