From b539046a7a71f3a5f2f7bbb8cfd21ce2abfdf2ab Mon Sep 17 00:00:00 2001 From: Iikka Eklund Date: Thu, 22 Aug 2019 09:29:44 +0000 Subject: Revert "bldinstallercommon.py: use shutil.rmtree instead of native call" This reverts commit 3ffacfb6ae46ed2e5eddac3192921d37aabe957d. Reason for revert: Causes regression on Windows Change-Id: I6b54dce12ddcad3be30406ef58cce6da32e47738 Reviewed-by: Jani Heikkinen --- packaging-tools/bldinstallercommon.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packaging-tools/bldinstallercommon.py b/packaging-tools/bldinstallercommon.py index a3518dfd8..ddad07a89 100644 --- a/packaging-tools/bldinstallercommon.py +++ b/packaging-tools/bldinstallercommon.py @@ -365,7 +365,16 @@ def remove_tree(path): if os.path.isdir(path) and os.path.exists(path): if IS_WIN_PLATFORM: path = win32api.GetShortPathName(path.replace('/', '\\')) - shutil.rmtree(path) + #a funny thing is that rmdir does not set an exitcode it is just using the last set one + try: + runCommand(['rmdir', path, '/S', '/Q'], SCRIPT_ROOT_DIR, onlyErrorCaseOutput=True) + except: + traceback.print_exc() + pass + else: + #shutil.rmtree(path) + runCommand(['rm', '-rf', path], SCRIPT_ROOT_DIR, onlyErrorCaseOutput=True) + return not os.path.exists(path) ############################### -- cgit v1.2.3