diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2002-10-31 13:22:41 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2002-10-31 13:22:41 (GMT) |
commit | ff4ad9a1cec90b66b65cb5f1b647e41742d7aab1 (patch) | |
tree | 6905c7f1cb970a1bf17d35c7b32aa0e72ec45d19 /Lib/distutils | |
parent | 699799e6f33788d7bd302e5fea2c86a747a2897a (diff) | |
download | cpython-ff4ad9a1cec90b66b65cb5f1b647e41742d7aab1.zip cpython-ff4ad9a1cec90b66b65cb5f1b647e41742d7aab1.tar.gz cpython-ff4ad9a1cec90b66b65cb5f1b647e41742d7aab1.tar.bz2 |
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.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/dist.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 92cb832..c71cb36 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -12,6 +12,12 @@ __revision__ = "$Id$" import sys, os, string, re 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 from distutils.util import check_environ, strtobool, rfc822_escape @@ -206,8 +212,11 @@ class Distribution: elif hasattr(self, key): setattr(self, key, val) else: - raise DistutilsSetupError, \ - "invalid distribution option '%s'" % key + msg = "Unknown distribution option: %s" % repr(key) + if warnings is not None: + warnings.warn(msg) + else: + sys.stderr.write(msg + "\n") self.finalize_options() |