@@ -480,10 +480,10 @@ def copy_license_notice_files(fields, base_dir, reference_dir, afp):
480480
481481
482482def copy_file (from_path , to_path ):
483- error = []
483+ error = ''
484484 # Return if the from_path is empty or None.
485485 if not from_path :
486- return []
486+ return
487487
488488 if on_windows :
489489 if not from_path .startswith (UNC_PREFIXES ):
@@ -496,7 +496,7 @@ def copy_file(from_path, to_path):
496496 to_path = to_path .strip ()
497497 # Errors will be captured when doing the validation
498498 if not os .path .exists (from_path ):
499- return []
499+ return ''
500500
501501 if not posixpath .exists (to_path ):
502502 os .makedirs (to_path )
@@ -509,19 +509,19 @@ def copy_file(from_path, to_path):
509509 to_path = os .path .join (to_path , folder_name )
510510 if os .path .exists (to_path ):
511511 msg = to_path + ' is already existed and is replaced by ' + from_path
512- error . append ( Error (WARNING , msg ) )
512+ error = Error (WARNING , msg )
513513 copy_tree (from_path , to_path )
514514 else :
515515 file_name = os .path .basename (from_path )
516516 to_file_path = os .path .join (to_path , file_name )
517517 if os .path .exists (to_file_path ):
518518 msg = to_file_path + ' is already existed and is replaced by ' + from_path
519- error . append ( Error (WARNING , msg ) )
519+ error = Error (WARNING , msg )
520520 shutil .copy2 (from_path , to_path )
521521 return error
522522 except Exception as e :
523523 msg = 'Cannot copy file at %(from_path)r.' % locals ()
524- error . append ( Error (CRITICAL , msg ) )
524+ error = Error (CRITICAL , msg )
525525 return error
526526
527527
0 commit comments