Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return real boolean from copy_file #309

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading