diff options
author | Greg Ward <gward@python.net> | 2000-05-23 04:11:14 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-05-23 04:11:14 (GMT) |
commit | 40313cfe6ef09a47557e7c18f7f02622fe879158 (patch) | |
tree | 6cf7aa009e65a1d4f36c895a9a45fb34778b5e59 /Lib | |
parent | 77751c0b4903470bdd630dac25270b21670323ff (diff) | |
download | cpython-40313cfe6ef09a47557e7c18f7f02622fe879158.zip cpython-40313cfe6ef09a47557e7c18f7f02622fe879158.tar.gz cpython-40313cfe6ef09a47557e7c18f7f02622fe879158.tar.bz2 |
Fix 'get_command_obj()' so it checks if a command object has an attribute
before setting it -- this will catch bad options (eg. typos) in config files.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/dist.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 3ceadf1..7bdd9aa 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -627,6 +627,10 @@ class Distribution: print " setting options:" for (option, (source, value)) in options.items(): print " %s = %s (from %s)" % (option, value, source) + if not hasattr(cmd_obj, option): + raise DistutilsOptionError, \ + ("%s: command '%s' has no such option '%s'") % \ + (source, command, option) setattr(cmd_obj, option, value) return cmd_obj |