@@ -2550,14 +2550,12 @@ def copy_file(path, target_path, force_in_dry_run=False):
25502550 if os .path .exists (target_path ) and os .stat (target_path ).st_mode & stat .S_IWUSR :
25512551 raise EasyBuildError ("Failed to copy file %s to %s: %s" , path , target_path , err )
25522552
2553- pyver = LooseVersion ( platform . python_version ())
2554- if pyver >= LooseVersion ( '3.7' ):
2553+ # If we have anything other than a PermissionError we bail out
2554+ if not isinstance ( err , PermissionError ):
25552555 raise EasyBuildError ("Failed to copy file %s to %s: %s" , path , target_path , err )
2556- elif LooseVersion ('3.7' ) > pyver >= LooseVersion ('3' ):
2557- if not isinstance (err , PermissionError ):
2558- raise EasyBuildError ("Failed to copy file %s to %s: %s" , path , target_path , err )
25592556
2560- # double-check whether the copy actually succeeded
2557+ # double-check whether the copy actually succeeded (or may have already happened
2558+ # if the contents are the same)
25612559 if not os .path .exists (target_path ) or not filecmp .cmp (path , target_path , shallow = False ):
25622560 raise EasyBuildError ("Failed to copy file %s to %s: %s" , path , target_path , err )
25632561
@@ -2569,8 +2567,10 @@ def copy_file(path, target_path, force_in_dry_run=False):
25692567 except OSError as err :
25702568 raise EasyBuildError ("Failed to copy file %s to %s: %s" , path , target_path , err )
25712569
2572- msg = ("Failed to copy extended attributes from file %s to %s, due to a bug in shutil (see "
2573- "https://bugs.python.org/issue24538). Copy successful with workaround." )
2570+ msg = ("In some cases, we may fail to copy extended attributes from file %s to %s, due to a "
2571+ "bug in shutil (see https://bugs.python.org/issue24538). We may also have already "
2572+ "copied the file over so we just check the contents and update the xattrs. "
2573+ "Copy successful with workaround." )
25742574 _log .info (msg , path , target_path )
25752575
25762576 elif os .path .islink (path ):
0 commit comments