File tree 1 file changed +15
-8
lines changed 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 8
8
# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
9
9
# why we ignore the type on this import.
10
10
from pip ._vendor .retrying import retry # type: ignore
11
+ from pip ._vendor .six import PY2
11
12
12
13
from pip ._internal .utils .compat import get_path_uid
13
14
from pip ._internal .utils .misc import cast
@@ -98,11 +99,17 @@ def adjacent_tmp_file(path):
98
99
os .fsync (result .file .fileno ())
99
100
100
101
101
- @retry (stop_max_delay = 1000 , wait_fixed = 250 )
102
- def replace (src , dest ):
103
- # type: (str, str) -> None
104
- try :
105
- os .rename (src , dest )
106
- except OSError :
107
- os .remove (dest )
108
- os .rename (src , dest )
102
+ _replace_retry = retry (stop_max_delay = 1000 , wait_fixed = 250 )
103
+
104
+ if PY2 :
105
+ @_replace_retry
106
+ def replace (src , dest ):
107
+ # type: (str, str) -> None
108
+ try :
109
+ os .rename (src , dest )
110
+ except OSError :
111
+ os .remove (dest )
112
+ os .rename (src , dest )
113
+
114
+ else :
115
+ replace = _replace_retry (os .replace )
You can’t perform that action at this time.
0 commit comments