Skip to content

Commit 86ed30e

Browse files
committed
Prefer shutil.move over os.rename #2233
Windows tests fail randomly otherwise on Azure with this error: OSError: [Errno 18] Invalid cross-device link Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 2c1e3ce commit 86ed30e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/extractcode/uncompress.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import gzip
3131
import logging
3232
import os
33+
import shutil
3334

3435
try:
3536
# These imports add support for multistream BZ2 files
@@ -68,7 +69,7 @@ def uncompress(location, target_dir, decompressor, suffix=EXTRACT_SUFFIX):
6869
target_location = os.path.join(target_dir, os.path.basename(location) + suffix)
6970
if os.path.exists(target_location):
7071
fileutils.delete(target_location)
71-
os.rename(tmp_loc, target_location)
72+
shutil.move(tmp_loc, target_location)
7273
return warnings
7374

7475

0 commit comments

Comments
 (0)