[Python-checkins] CVS: distutils/distutils dist.py,1.15,1.16
Greg Ward
python-dev@python.org
Mon, 22 May 2000 20:47:38 -0700
Update of /cvsroot/python/distutils/distutils
In directory slayer.i.sourceforge.net:/tmp/cvs-serv13253
Modified Files:
dist.py
Log Message:
Fixed so options from config files and command lines actually work:
* 'get_command_obj()' now sets command attributes based on
the 'command_options' dictionary
* some typos fixed
* kludged 'parse_config_files()' to re-initialize the ConfigParser
instance after each file, so we know for sure which config
file each option comes form
* added lots of handy debugging output
Index: dist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/dist.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** dist.py 2000/05/23 01:42:17 1.15
--- dist.py 2000/05/23 03:47:35 1.16
***************
*** 7,11 ****
# (extricated from core.py; actually dates back to the beginning)
! __revision__ = "$Id: dist.py,v 1.15 2000/05/23 01:42:17 gward Exp $"
import sys, os, string, re
--- 7,11 ----
# (extricated from core.py; actually dates back to the beginning)
! __revision__ = "$Id: dist.py,v 1.16 2000/05/23 03:47:35 gward Exp $"
import sys, os, string, re
***************
*** 259,264 ****
--- 259,267 ----
filenames = self.find_config_files()
+ print "Distribution.parse_config_files():"
+
parser = ConfigParser()
for filename in filenames:
+ print " reading", filename
parser.read(filename)
for section in parser.sections():
***************
*** 272,278 ****
opts[opt] = (filename, parser.get(section,opt))
! from pprint import pprint
! print "options (after parsing config files):"
! pprint (self.command_options)
--- 275,283 ----
opts[opt] = (filename, parser.get(section,opt))
! # Make the ConfigParser forget everything (so we retain
! # the original filenames that options come from) -- gag,
! # retch, puke -- another good reason for a distutils-
! # specific config parser (sigh...)
! parser.__init__()
***************
*** 398,402 ****
parser.set_negative_aliases (negative_opt)
(args, opts) = parser.getopt (args[1:])
! if opts.help:
print "showing help for command", cmd_class
self._show_help(parser, display_options=0, commands=[cmd_class])
--- 403,407 ----
parser.set_negative_aliases (negative_opt)
(args, opts) = parser.getopt (args[1:])
! if hasattr(opts, 'help') and opts.help:
print "showing help for command", cmd_class
self._show_help(parser, display_options=0, commands=[cmd_class])
***************
*** 409,413 ****
cmd_opts = self.command_options[command]
for (name, value) in vars(opts).items():
! cmd_opts[command] = ("command line", value)
return args
--- 414,418 ----
cmd_opts = self.command_options[command]
for (name, value) in vars(opts).items():
! cmd_opts[name] = ("command line", value)
return args
***************
*** 606,612 ****
cmd_obj = self.command_obj.get(command)
if not cmd_obj and create:
klass = self.get_command_class(command)
! cmd_obj = self.command_obj[command] = klass()
! self.command_run[command] = 0
return cmd_obj
--- 611,632 ----
cmd_obj = self.command_obj.get(command)
if not cmd_obj and create:
+ print "Distribution.get_command_obj(): " \
+ "creating '%s' command object" % command
+
klass = self.get_command_class(command)
! cmd_obj = self.command_obj[command] = klass(self)
! self.have_run[command] = 0
!
! # Set any options that were supplied in config files
! # or on the command line. (NB. support for error
! # reporting is lame here: any errors aren't reported
! # until 'finalize_options()' is called, which means
! # we won't report the source of the error.)
! options = self.command_options.get(command)
! if options:
! print " setting options:"
! for (option, (source, value)) in options.items():
! print " %s = %s (from %s)" % (option, value, source)
! setattr(cmd_obj, option, value)
return cmd_obj