Changed 'copy_tree()' so it returns the list of all files that were copied or

might have been copied, regardless of the 'update' flag.
This commit is contained in:
Greg Ward 2000-03-29 03:27:45 +00:00
parent 739d06689d
commit 044b7c15c9

View file

@ -322,13 +322,14 @@ def copy_tree (src, dst,
"""Copy an entire directory tree 'src' to a new location 'dst'. Both """Copy an entire directory tree 'src' to a new location 'dst'. Both
'src' and 'dst' must be directory names. If 'src' is not a 'src' and 'dst' must be directory names. If 'src' is not a
directory, raise DistutilsFileError. If 'dst' does not exist, it directory, raise DistutilsFileError. If 'dst' does not exist, it is
is created with 'mkpath()'. The end result of the copy is that created with 'mkpath()'. The end result of the copy is that every
every file in 'src' is copied to 'dst', and directories under file in 'src' is copied to 'dst', and directories under 'src' are
'src' are recursively copied to 'dst'. Return the list of files recursively copied to 'dst'. Return the list of files that were
copied (under their output names) -- note that if 'update' is true, copied or might have been copied, using their output name. The
this might be less than the list of files considered. Return return value is unaffected by 'update' or 'dry_run': it is simply
value is not affected by 'dry_run'. the list of all files under 'src', with the names changed to be
under 'dst'.
'preserve_mode' and 'preserve_times' are the same as for 'preserve_mode' and 'preserve_times' are the same as for
'copy_file'; note that they only apply to regular files, not to 'copy_file'; note that they only apply to regular files, not to
@ -372,10 +373,10 @@ def copy_tree (src, dst,
preserve_mode, preserve_times, preserve_symlinks, preserve_mode, preserve_times, preserve_symlinks,
update, verbose, dry_run)) update, verbose, dry_run))
else: else:
if (copy_file (src_name, dst_name, copy_file (src_name, dst_name,
preserve_mode, preserve_times, preserve_mode, preserve_times,
update, verbose, dry_run)): update, verbose, dry_run)
outputs.append (dst_name) outputs.append (dst_name)
return outputs return outputs