فهرست منبع

Use shutil when moving gsutil.

Bug:b/242209562
Change-Id: Icdb145c15fe6f4fc2a61fe3342e0dd495b972b14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3879825
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Joanna Wang 2 سال پیش
والد
کامیت
07d6e6985b
1فایلهای تغییر یافته به همراه1 افزوده شده و 5 حذف شده
  1. 1 5
      gsutil.py

+ 1 - 5
gsutil.py

@@ -127,11 +127,7 @@ def ensure_gsutil(version, target, clean):
     with zipfile.ZipFile(target_zip_filename, 'r') as target_zip:
     with zipfile.ZipFile(target_zip_filename, 'r') as target_zip:
       target_zip.extractall(download_dir)
       target_zip.extractall(download_dir)
 
 
-    try:
-      os.rename(download_dir, bin_dir)
-    except (OSError, IOError):
-      # Something else did this in parallel.
-      pass
+    shutil.move(download_dir, bin_dir)
     # Final check that the gsutil bin exists.  This should never fail.
     # Final check that the gsutil bin exists.  This should never fail.
     if not os.path.isfile(gsutil_bin):
     if not os.path.isfile(gsutil_bin):
       raise InvalidGsutilError()
       raise InvalidGsutilError()