From 1b64a7e4a54b41ab2ebfb942bb5bc2c04deb16f9 Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Fri, 31 Mar 2000 03:05:18 +0000 Subject: [PATCH] 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()'. --- Lib/distutils/core.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py index 08a1d641d18..025e1c0df50 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -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):