Skip to content

Commit 6c504d9

Browse files
committed
Avoid copying the same file multiple times.
1 parent 3614f97 commit 6c504d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/attributecode/util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,10 @@ def copy_license_notice_files(fields, base_dir, reference_dir, afp):
472472
from_lic_path = posixpath.join(to_posix(reference_dir), copy_file_name)
473473
about_file_dir = os.path.dirname(to_posix(afp)).lstrip('/')
474474
to_lic_path = posixpath.join(to_posix(base_dir), about_file_dir)
475-
476-
err = copy_file(from_lic_path, to_lic_path)
477-
if err:
478-
errors.append(err)
475+
if not os.path.exists(posixpath.join(to_lic_path, copy_file_name)):
476+
err = copy_file(from_lic_path, to_lic_path)
477+
if err:
478+
errors.append(err)
479479
return errors
480480

481481

0 commit comments

Comments
 (0)