0
0
mirror of https://github.com/python/cpython.git synced 2024-11-28 08:20:55 +01:00

Added 'get_name()' and 'get_full_name()' methods to Distribution.

Simplified 'Command.get_peer_option()' a tad -- just call 'find_peer()'
  to get the peer command object.
Updated 'Command.copy_file()' to take a 'link' parameter, just like
  'util.copy_file()' does now.
Added 'Command.make_archive()' to wrap 'util.make_archive()'.
This commit is contained in:
Greg Ward 2000-03-31 03:05:18 +00:00
parent 32ce329ce4
commit 1b64a7e4a5

View File

@ -638,6 +638,13 @@ class Distribution:
not self.has_ext_modules() and
not self.has_c_libraries())
def get_name (self):
return self.name or "UNKNOWN"
def get_full_name (self):
return "%s-%s" % ((self.name or "UNKNOWN"), (self.version or "???"))
# class Distribution
@ -887,7 +894,7 @@ class Command:
"""Find or create the command object for 'command', and return
its 'option' option."""
cmd_obj = self.distribution.find_command_obj (command)
cmd_obj = self.find_peer (command)
return cmd_obj.get_option (option)
@ -939,12 +946,13 @@ class Command:
def copy_file (self, infile, outfile,
preserve_mode=1, preserve_times=1, level=1):
preserve_mode=1, preserve_times=1, link=None, level=1):
"""Copy a file respecting verbose, dry-run and force flags."""
return util.copy_file (infile, outfile,
preserve_mode, preserve_times,
not self.force,
link,
self.verbose >= level,
self.dry_run)
@ -976,6 +984,12 @@ class Command:
self.dry_run)
def make_archive (self, base_name, format,
root_dir=None, base_dir=None):
util.make_archive (base_name, format, root_dir, base_dir,
self.verbose, self.dry_run)
def make_file (self, infiles, outfile, func, args,
exec_msg=None, skip_msg=None, level=1):