From 489304d94984bb006a03e842cf2c171c73e7d367 Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Tue, 28 Mar 2023 20:25:55 +0000 Subject: [PATCH] Use os.renames() in remove() to auto-create subdirectories. Bug: 1415507 Change-Id: Ie52123dc0844639116b55bc7f6a2734aaf7df33e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4378417 Reviewed-by: Gavin Mak Commit-Queue: Gavin Mak Auto-Submit: Joanna Wang --- recipes/recipe_modules/bot_update/resources/bot_update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index 3e0766cbb7..b438e658fe 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -366,8 +366,8 @@ def remove(target, cleanup_dir): allfiles = os.listdir(target) for f in allfiles: target_path = os.path.join(target, f) - dst_path = os.path.join(destination, f) - os.rename(target_path, dst_path) + dst_path = os.path.join(dest, f) + os.renames(target_path, dst_path) except Exception as e: print('Error renaming %s to %s: %s' % (target, dest, str(e))) raise