From c904e934e1cafdfccc305ff52502f25d13c3046b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Nov 2021 13:45:39 +0530 Subject: [PATCH] Use a safer bypy artifact transition scheme --- setup/git_post_checkout_hook.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup/git_post_checkout_hook.py b/setup/git_post_checkout_hook.py index 04c5047a5b..ccacb2e00f 100755 --- a/setup/git_post_checkout_hook.py +++ b/setup/git_post_checkout_hook.py @@ -20,9 +20,14 @@ if flags == '1': # A branch checkout prev_branch, cur_branch = list(map(get_branch_name, (prev_rev, current_rev))) if {prev_branch, cur_branch} == {'master', 'qt6'}: - os.rename('bypy/b/other-b', 'bypy/c') - os.rename('bypy/b', 'bypy/c/other-b') - os.rename('bypy/c', 'bypy/b') + b = 'qt6' if cur_branch == 'qt6' else 'qt5' + for x in os.listdir(f'bypy/b/{b}'): + link = f'bypy/b/{x}' + try: + os.remove(link) + except FileNotFoundError: + pass + os.symlink(f'{b}/{x}', link) subprocess.check_call('./setup.py build --clean'.split()) subprocess.check_call('./setup.py gui --clean'.split()) subprocess.check_call('./setup.py build'.split())