Skip to content

Commit

Permalink
Return real boolean from copy_file
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Nov 24, 2024
1 parent 2517976 commit ff9c684
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions distutils/file_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def copy_file( # noqa: C901
if update and not newer(src, dst):
if verbose >= 1:
log.debug("not copying %s (output up-to-date)", src)
return (dst, 0)
return (dst, False)

try:
action = _copy_action[link]
Expand All @@ -132,7 +132,7 @@ def copy_file( # noqa: C901
log.info("%s %s -> %s", action, src, dst)

if dry_run:
return (dst, 1)
return (dst, True)

# If linking (hard or symbolic), use the appropriate system call
# (Unix only, of course, but that's the caller's responsibility)
Expand All @@ -146,11 +146,11 @@ def copy_file( # noqa: C901
# even under Unix, see issue #8876).
pass
else:
return (dst, 1)
return (dst, True)
elif link == 'sym':
if not (os.path.exists(dst) and os.path.samefile(src, dst)):
os.symlink(src, dst)
return (dst, 1)
return (dst, True)

# Otherwise (non-Mac, not linking), copy the file contents and
# (optionally) copy the times and mode.
Expand All @@ -165,7 +165,7 @@ def copy_file( # noqa: C901
if preserve_mode:
os.chmod(dst, S_IMODE(st[ST_MODE]))

return (dst, 1)
return (dst, True)


# XXX I suspect this is Unix-specific -- need porting help!
Expand Down

0 comments on commit ff9c684

Please sign in to comment.