Add 'written' to copy_file results dotdict.
This commit is contained in:
parent
9bdee227b3
commit
65f766928c
1 changed files with 5 additions and 2 deletions
|
@ -389,8 +389,9 @@ def copy_file(
|
||||||
and its hash will be compared against the hash of the source file.
|
and its hash will be compared against the hash of the source file.
|
||||||
If hash_class is None, then the global HASH_CLASS is used.
|
If hash_class is None, then the global HASH_CLASS is used.
|
||||||
|
|
||||||
Returns a dotdict containing at least `source`, `destination`,
|
Returns a dotdict containing at least `source`, `destination` (Pathclass),
|
||||||
and `written_bytes`. (Written bytes is 0 if the file already existed.)
|
`written` (False if file was skipped, True if written), and
|
||||||
|
`written_bytes` (integer).
|
||||||
'''
|
'''
|
||||||
# Prepare parameters
|
# Prepare parameters
|
||||||
if not is_xor(destination, destination_new_root):
|
if not is_xor(destination, destination_new_root):
|
||||||
|
@ -419,6 +420,7 @@ def copy_file(
|
||||||
results = dotdict.DotDict(
|
results = dotdict.DotDict(
|
||||||
source=source,
|
source=source,
|
||||||
destination=destination,
|
destination=destination,
|
||||||
|
written=False,
|
||||||
written_bytes=0,
|
written_bytes=0,
|
||||||
default=None,
|
default=None,
|
||||||
)
|
)
|
||||||
|
@ -511,6 +513,7 @@ def copy_file(
|
||||||
destination_handle.close()
|
destination_handle.close()
|
||||||
log.debug('Copying metadata.')
|
log.debug('Copying metadata.')
|
||||||
shutil.copystat(source.absolute_path, destination.absolute_path)
|
shutil.copystat(source.absolute_path, destination.absolute_path)
|
||||||
|
results.written = True
|
||||||
|
|
||||||
if validate_hash:
|
if validate_hash:
|
||||||
verify_hash(
|
verify_hash(
|
||||||
|
|
Loading…
Reference in a new issue