mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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.
This commit is contained in:
parent
77751c0b49
commit
40313cfe6e
1 changed files with 4 additions and 0 deletions
|
@ -627,6 +627,10 @@ class Distribution:
|
||||||
print " setting options:"
|
print " setting options:"
|
||||||
for (option, (source, value)) in options.items():
|
for (option, (source, value)) in options.items():
|
||||||
print " %s = %s (from %s)" % (option, value, source)
|
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)
|
setattr(cmd_obj, option, value)
|
||||||
|
|
||||||
return cmd_obj
|
return cmd_obj
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue