[Python-checkins] CVS: distutils/distutils dist.py,1.38,1.39
Greg Ward
python-dev@python.org
Mon, 25 Sep 2000 18:52:27 -0700
Update of /cvsroot/python/distutils/distutils
In directory slayer.i.sourceforge.net:/tmp/cvs-serv14966
Modified Files:
dist.py
Log Message:
Standardize whitespace in function calls and docstrings.
Index: dist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/dist.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** dist.py 2000/09/25 01:58:07 1.38
--- dist.py 2000/09/26 01:52:25 1.39
***************
*** 119,123 ****
# worth it. Also delegate 'get_XXX()' methods to the 'metadata'
# object in a sneaky and underhanded (but efficient!) way.
! self.metadata = DistributionMetadata ()
method_basenames = dir(self.metadata) + \
['fullname', 'contact', 'contact_email']
--- 119,123 ----
# worth it. Also delegate 'get_XXX()' methods to the 'metadata'
# object in a sneaky and underhanded (but efficient!) way.
! self.metadata = DistributionMetadata()
method_basenames = dir(self.metadata) + \
['fullname', 'contact', 'contact_email']
***************
*** 188,192 ****
# command options will override any supplied redundantly
# through the general options dictionary.
! options = attrs.get ('options')
if options:
del attrs['options']
--- 188,192 ----
# command options will override any supplied redundantly
# through the general options dictionary.
! options = attrs.get('options')
if options:
del attrs['options']
***************
*** 199,206 ****
# not already defined is invalid!
for (key,val) in attrs.items():
! if hasattr (self.metadata, key):
! setattr (self.metadata, key, val)
! elif hasattr (self, key):
! setattr (self, key, val)
else:
raise DistutilsSetupError, \
--- 199,206 ----
# not already defined is invalid!
for (key,val) in attrs.items():
! if hasattr(self.metadata, key):
! setattr(self.metadata, key, val)
! elif hasattr(self, key):
! setattr(self, key, val)
else:
raise DistutilsSetupError, \
***************
*** 378,385 ****
self.commands = []
! parser = FancyGetopt (self.global_options + self.display_options)
! parser.set_negative_aliases (self.negative_opt)
! parser.set_aliases ({'license': 'licence'})
! args = parser.getopt (args=self.script_args, object=self)
option_order = parser.get_option_order()
--- 378,385 ----
self.commands = []
! parser = FancyGetopt(self.global_options + self.display_options)
! parser.set_negative_aliases(self.negative_opt)
! parser.set_aliases({'license': 'licence'})
! args = parser.getopt(args=self.script_args, object=self)
option_order = parser.get_option_order()
***************
*** 428,434 ****
# Pull the current command from the head of the command line
command = args[0]
! if not command_re.match (command):
raise SystemExit, "invalid command name '%s'" % command
! self.commands.append (command)
# Dig up the command class that implements this command, so we
--- 428,434 ----
# Pull the current command from the head of the command line
command = args[0]
! if not command_re.match(command):
raise SystemExit, "invalid command name '%s'" % command
! self.commands.append(command)
# Dig up the command class that implements this command, so we
***************
*** 436,440 ****
# it takes.
try:
! cmd_class = self.get_command_class (command)
except DistutilsModuleError, msg:
raise DistutilsArgError, msg
--- 436,440 ----
# it takes.
try:
! cmd_class = self.get_command_class(command)
except DistutilsModuleError, msg:
raise DistutilsArgError, msg
***************
*** 442,446 ****
# Require that the command class be derived from Command -- want
# to be sure that the basic "command" interface is implemented.
! if not issubclass (cmd_class, Command):
raise DistutilsClassError, \
"command class %s must subclass Command" % cmd_class
--- 442,446 ----
# Require that the command class be derived from Command -- want
# to be sure that the basic "command" interface is implemented.
! if not issubclass(cmd_class, Command):
raise DistutilsClassError, \
"command class %s must subclass Command" % cmd_class
***************
*** 448,453 ****
# Also make sure that the command object provides a list of its
# known options.
! if not (hasattr (cmd_class, 'user_options') and
! type (cmd_class.user_options) is ListType):
raise DistutilsClassError, \
("command class %s must provide " +
--- 448,453 ----
# Also make sure that the command object provides a list of its
# known options.
! if not (hasattr(cmd_class, 'user_options') and
! type(cmd_class.user_options) is ListType):
raise DistutilsClassError, \
("command class %s must provide " +
***************
*** 458,469 ****
# merge it in with the global negative aliases.
negative_opt = self.negative_opt
! if hasattr (cmd_class, 'negative_opt'):
! negative_opt = copy (negative_opt)
! negative_opt.update (cmd_class.negative_opt)
# Check for help_options in command class. They have a different
# format (tuple of four) so we need to preprocess them here.
if (hasattr(cmd_class, 'help_options') and
! type (cmd_class.help_options) is ListType):
help_options = fix_help_options(cmd_class.help_options)
else:
--- 458,469 ----
# merge it in with the global negative aliases.
negative_opt = self.negative_opt
! if hasattr(cmd_class, 'negative_opt'):
! negative_opt = copy(negative_opt)
! negative_opt.update(cmd_class.negative_opt)
# Check for help_options in command class. They have a different
# format (tuple of four) so we need to preprocess them here.
if (hasattr(cmd_class, 'help_options') and
! type(cmd_class.help_options) is ListType):
help_options = fix_help_options(cmd_class.help_options)
else:
***************
*** 473,481 ****
# All commands support the global options too, just by adding
# in 'global_options'.
! parser.set_option_table (self.global_options +
! cmd_class.user_options +
! help_options)
! parser.set_negative_aliases (negative_opt)
! (args, opts) = parser.getopt (args[1:])
if hasattr(opts, 'help') and opts.help:
self._show_help(parser, display_options=0, commands=[cmd_class])
--- 473,481 ----
# All commands support the global options too, just by adding
# in 'global_options'.
! parser.set_option_table(self.global_options +
! cmd_class.user_options +
! help_options)
! parser.set_negative_aliases(negative_opt)
! (args, opts) = parser.getopt(args[1:])
if hasattr(opts, 'help') and opts.help:
self._show_help(parser, display_options=0, commands=[cmd_class])
***************
*** 483,487 ****
if (hasattr(cmd_class, 'help_options') and
! type (cmd_class.help_options) is ListType):
help_option_found=0
for (help_option, short, desc, func) in cmd_class.help_options:
--- 483,487 ----
if (hasattr(cmd_class, 'help_options') and
! type(cmd_class.help_options) is ListType):
help_option_found=0
for (help_option, short, desc, func) in cmd_class.help_options:
***************
*** 535,545 ****
if global_options:
! parser.set_option_table (self.global_options)
! parser.print_help ("Global options:")
print
if display_options:
! parser.set_option_table (self.display_options)
! parser.print_help (
"Information display options (just display " +
"information, ignore any commands)")
--- 535,545 ----
if global_options:
! parser.set_option_table(self.global_options)
! parser.print_help("Global options:")
print
if display_options:
! parser.set_option_table(self.display_options)
! parser.print_help(
"Information display options (just display " +
"information, ignore any commands)")
***************
*** 550,561 ****
klass = command
else:
! klass = self.get_command_class (command)
if (hasattr(klass, 'help_options') and
! type (klass.help_options) is ListType):
! parser.set_option_table (klass.user_options +
! fix_help_options(klass.help_options))
else:
! parser.set_option_table (klass.user_options)
! parser.print_help ("Options for '%s' command:" % klass.__name__)
print
--- 550,561 ----
klass = command
else:
! klass = self.get_command_class(command)
if (hasattr(klass, 'help_options') and
! type(klass.help_options) is ListType):
! parser.set_option_table(klass.user_options +
! fix_help_options(klass.help_options))
else:
! parser.set_option_table(klass.user_options)
! parser.print_help("Options for '%s' command:" % klass.__name__)
print
***************
*** 578,582 ****
# we ignore "foo bar").
if self.help_commands:
! self.print_commands ()
print
print gen_usage(self.script_name)
--- 578,582 ----
# we ignore "foo bar").
if self.help_commands:
! self.print_commands()
print
print gen_usage(self.script_name)
***************
*** 609,615 ****
for cmd in commands:
! klass = self.cmdclass.get (cmd)
if not klass:
! klass = self.get_command_class (cmd)
try:
description = klass.description
--- 609,615 ----
for cmd in commands:
! klass = self.cmdclass.get(cmd)
if not klass:
! klass = self.get_command_class(cmd)
try:
description = klass.description
***************
*** 640,658 ****
for cmd in self.cmdclass.keys():
if not is_std.get(cmd):
! extra_commands.append (cmd)
max_length = 0
for cmd in (std_commands + extra_commands):
! if len (cmd) > max_length:
! max_length = len (cmd)
! self.print_command_list (std_commands,
! "Standard commands",
! max_length)
if extra_commands:
print
! self.print_command_list (extra_commands,
! "Extra commands",
! max_length)
# print_commands ()
--- 640,658 ----
for cmd in self.cmdclass.keys():
if not is_std.get(cmd):
! extra_commands.append(cmd)
max_length = 0
for cmd in (std_commands + extra_commands):
! if len(cmd) > max_length:
! max_length = len(cmd)
! self.print_command_list(std_commands,
! "Standard commands",
! max_length)
if extra_commands:
print
! self.print_command_list(extra_commands,
! "Extra commands",
! max_length)
# print_commands ()
***************
*** 823,830 ****
"""Run each command that was seen on the setup script command line.
Uses the list of commands found and cache of command objects
! created by 'get_command_obj()'."""
!
for cmd in self.commands:
! self.run_command (cmd)
--- 823,830 ----
"""Run each command that was seen on the setup script command line.
Uses the list of commands found and cache of command objects
! created by 'get_command_obj()'.
! """
for cmd in self.commands:
! self.run_command(cmd)
***************
*** 839,851 ****
'run()' on that command object (or an existing one).
"""
-
# Already been here, done that? then return silently.
! if self.have_run.get (command):
return
! self.announce ("running " + command)
! cmd_obj = self.get_command_obj (command)
! cmd_obj.ensure_finalized ()
! cmd_obj.run ()
self.have_run[command] = 1
--- 839,850 ----
'run()' on that command object (or an existing one).
"""
# Already been here, done that? then return silently.
! if self.have_run.get(command):
return
! self.announce("running " + command)
! cmd_obj = self.get_command_obj(command)
! cmd_obj.ensure_finalized()
! cmd_obj.run()
self.have_run[command] = 1
***************
*** 854,864 ****
def has_pure_modules (self):
! return len (self.packages or self.py_modules or []) > 0
def has_ext_modules (self):
! return self.ext_modules and len (self.ext_modules) > 0
def has_c_libraries (self):
! return self.libraries and len (self.libraries) > 0
def has_modules (self):
--- 853,863 ----
def has_pure_modules (self):
! return len(self.packages or self.py_modules or []) > 0
def has_ext_modules (self):
! return self.ext_modules and len(self.ext_modules) > 0
def has_c_libraries (self):
! return self.libraries and len(self.libraries) > 0
def has_modules (self):
***************
*** 891,895 ****
class DistributionMetadata:
"""Dummy class to hold the distribution meta-data: name, version,
! author, and so forth."""
def __init__ (self):
--- 890,895 ----
class DistributionMetadata:
"""Dummy class to hold the distribution meta-data: name, version,
! author, and so forth.
! """
def __init__ (self):
***************
*** 964,967 ****
if __name__ == "__main__":
! dist = Distribution ()
print "ok"
--- 964,967 ----
if __name__ == "__main__":
! dist = Distribution()
print "ok"