Tools: cope with build_binaries.py being copied out

the build server uses a copy of build_binaries.py, so __file__ isn't
the right directory
This commit is contained in:
Andrew Tridgell 2021-08-01 08:39:48 +10:00
parent b037507c48
commit 19a9e1a416
1 changed files with 7 additions and 1 deletions

View File

@ -34,8 +34,14 @@ else:
def is_chibios_build(board):
'''see if a board is using HAL_ChibiOS'''
# cope with both running from Tools/scripts or running from cwd
hwdef_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "libraries", "AP_HAL_ChibiOS", "hwdef")
return os.path.exists(os.path.join(hwdef_dir, board, "hwdef.dat"))
if os.path.exists(os.path.join(hwdef_dir, board, "hwdef.dat")):
return True
hwdef_dir = os.path.join("libraries", "AP_HAL_ChibiOS", "hwdef")
if os.path.exists(os.path.join(hwdef_dir, board, "hwdef.dat")):
return True
return False
def get_required_compiler(tag, board):