def find_keymap_path(result): for directory in [ '.', '..', '../..', '../../..', '../../../..', '../../../../..' ]: basepath = path.normpath('qmk_firmware/keyboards/%s/%s/keymaps' % (result['keyboard'], directory)) if path.exists(basepath): return '/'.join((basepath, result['keymap'])) logging.error('Could not find keymaps directory!') raise NoSuchKeyboardError('Could not find keymaps directory for: %s' % result['keyboard'])
def find_keymap_path(keyboard, keymap): for directory in [ '.', '..', '../..', '../../..', '../../../..', '../../../../..' ]: basepath = os.path.normpath('qmk_firmware/keyboards/%s/%s/keymaps' % (keyboard, directory)) if os.path.exists(basepath): return '/'.join((basepath, keymap)) logging.error('Could not find keymaps directory!') raise NoSuchKeyboardError('Could not find keymaps directory for: %s' % keyboard)