Change os.rename to move to support multi drives.
This fixes the following error:
I tried to update myself but meet below error:
Traceback (most recent call last):
File "./update_prebuilts.py", line 876, in <module>
getBuildId(args), getFile(args)):
File "./update_prebuilts.py", line 567, in update_androidx
mv(java_plugins_bp_path, tmp_java_plugins_bp_path)
File "./update_prebuilts.py", line 339, in mv
os.rename(f, dst)
OSError: [Errno 18] Invalid cross-device link: 'current/androidx/JavaPlugins.bp' -> '/tmp/JavaPlugins.bp'
Bug: 140010714
Test: Tested on multidrive device, script seemed to have succeded
Change-Id: I3049676236254041fff0c3f8a965b8330121768a
diff --git a/update_prebuilts/update_prebuilts.py b/update_prebuilts/update_prebuilts.py
index 1d99403..a237127 100755
--- a/update_prebuilts/update_prebuilts.py
+++ b/update_prebuilts/update_prebuilts.py
@@ -7,7 +7,7 @@
import argparse
import glob
import subprocess
-from shutil import copyfile, rmtree, which
+from shutil import copyfile, rmtree, which, move
from distutils.version import LooseVersion
from functools import reduce
@@ -336,7 +336,7 @@
dst = os.path.join(os.path.dirname(dst_path), os.path.basename(f))
else:
dst = dst_path
- os.rename(f, dst)
+ move(f, dst)
def detect_artifacts(maven_repo_dirs):