diff options
author | Greg Ward <gward@python.net> | 2000-09-30 17:29:35 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-09-30 17:29:35 (GMT) |
commit | 0d4a85310937f686d70188dabe3aacde8703e47a (patch) | |
tree | cc41c8ab97878827c0bb15ea1814eaf99b07f7bd | |
parent | ec84c21ce2d022ea95bb67ab711f7580036611e5 (diff) | |
download | cpython-0d4a85310937f686d70188dabe3aacde8703e47a.zip cpython-0d4a85310937f686d70188dabe3aacde8703e47a.tar.gz cpython-0d4a85310937f686d70188dabe3aacde8703e47a.tar.bz2 |
Changed 'copy_file()' so it returns a tuple (dest_name, copied) -- hopefully,
this will please everyone (as if that's possible).
-rw-r--r-- | Lib/distutils/file_util.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index d05b456..a9e12ce 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -95,8 +95,9 @@ def copy_file (src, dst, Under Mac OS, uses the native file copy function in macostools; on other systems, uses '_copy_file_contents()' to copy file contents. - Return the name of the destination file, whether it was actually copied - or not. + Return a tuple (dest_name, copied): 'dest_name' is the actual name of + the output file, and 'copied' is true if the file was copied (or would + have been copied, if 'dry_run' true). """ # XXX if the destination file already exists, we clobber it if # copying, but blow up if linking. Hmmm. And I don't know what @@ -121,7 +122,7 @@ def copy_file (src, dst, if update and not newer(src, dst): if verbose: print "not copying %s (output up-to-date)" % src - return dst + return (dst, 0) try: action = _copy_action[link] @@ -135,9 +136,9 @@ def copy_file (src, dst, print "%s %s -> %s" % (action, src, dst) if dry_run: - return dst + return (dst, 1) - # On a Mac, use the native file copy routine + # On Mac OS, use the native file copy routine if os.name == 'mac': import macostools try: @@ -169,7 +170,7 @@ def copy_file (src, dst, if preserve_mode: os.chmod(dst, S_IMODE(st[ST_MODE])) - return dst + return (dst, 1) # copy_file () |