File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 4
4
from warnings import warn
5
5
import inspect
6
6
import tempfile
7
+ import errno
7
8
from copy import copy
8
9
from collections import Counter
9
10
import typing as ty
@@ -1545,7 +1546,15 @@ def hardlink_dir(src: Path, dest: Path) -> None:
1545
1546
if fspath .is_dir ():
1546
1547
copy_dir (fspath , new_path )
1547
1548
else :
1548
- copy_file (fspath , new_path )
1549
+ try :
1550
+ copy_file (fspath , new_path )
1551
+ except PermissionError as e :
1552
+ if e .errno == errno .EPERM and copy_file is not shutil .copyfile : # type: ignore[comparison-overlap]
1553
+ # Fallback to proper copy if the link fails for some reason
1554
+ shutil .copyfile (fspath , new_path )
1555
+ else :
1556
+ raise
1557
+
1549
1558
new_paths .append (new_path )
1550
1559
return type (self )(new_paths )
1551
1560
You can’t perform that action at this time.
0 commit comments