66
77__revision__ = "$Id$"
88
9- import sys , os , string , re
9+ import sys , os , re
1010from distutils .errors import DistutilsOptionError
1111from distutils import util , dir_util , file_util , archive_util , dep_util
1212from distutils import log
@@ -156,19 +156,19 @@ def finalize_options (self):
156156 "abstract method -- subclass %s must override" % self .__class__
157157
158158
159- def dump_options (self , header = None , indent = "" ):
159+ def dump_options (self , header = None , indent = "" ):
160160 from distutils .fancy_getopt import longopt_xlate
161161 if header is None :
162162 header = "command options for '%s':" % self .get_command_name ()
163- print indent + header
163+ self . announce ( indent + header , level = log . INFO )
164164 indent = indent + " "
165165 for (option , _ , _ ) in self .user_options :
166- option = string .translate (option , longopt_xlate )
166+ option = option .translate (longopt_xlate )
167167 if option [- 1 ] == "=" :
168168 option = option [:- 1 ]
169169 value = getattr (self , option )
170- print indent + "%s = %s" % (option , value )
171-
170+ self . announce ( indent + "%s = %s" % (option , value ),
171+ level = log . INFO )
172172
173173 def run (self ):
174174 """A command's raison d'etre: carry out the action it exists to
@@ -405,8 +405,8 @@ def make_archive (self, base_name, format,
405405 base_name , format , root_dir , base_dir , dry_run = self .dry_run )
406406
407407
408- def make_file (self , infiles , outfile , func , args ,
409- exec_msg = None , skip_msg = None , level = 1 ):
408+ def make_file (self , infiles , outfile , func , args ,
409+ exec_msg = None , skip_msg = None , level = 1 ):
410410 """Special case of 'execute()' for operations that process one or
411411 more input files and generate one output file. Works just like
412412 'execute()', except the operation is skipped and a different
@@ -415,24 +415,24 @@ def make_file (self, infiles, outfile, func, args,
415415 and it is true, then the command is unconditionally run -- does no
416416 timestamp checks.
417417 """
418- if exec_msg is None :
419- exec_msg = "generating %s from %s" % \
420- (outfile , string .join (infiles , ', ' ))
421418 if skip_msg is None :
422419 skip_msg = "skipping %s (inputs unchanged)" % outfile
423420
424-
425421 # Allow 'infiles' to be a single string
426- if type (infiles ) is StringType :
422+ if isinstance (infiles , str ) :
427423 infiles = (infiles ,)
428- elif type (infiles ) not in ( ListType , TupleType ):
424+ elif not isinstance (infiles , ( list , tuple ) ):
429425 raise TypeError , \
430426 "'infiles' must be a string, or a list or tuple of strings"
431427
428+ if exec_msg is None :
429+ exec_msg = "generating %s from %s" % \
430+ (outfile , ', ' .join (infiles ))
431+
432432 # If 'outfile' must be regenerated (either because it doesn't
433433 # exist, is out-of-date, or the 'force' flag is true) then
434434 # perform the action that presumably regenerates it
435- if self .force or dep_util .newer_group (infiles , outfile ):
435+ if self .force or dep_util .newer_group (infiles , outfile ):
436436 self .execute (func , args , exec_msg , level )
437437
438438 # Otherwise, print the "skip" message
0 commit comments