Class to abstract access to daplink's build directory as a bundle
| 103 | |
| 104 | |
| 105 | class ProjectFirmwareBundle(FirmwareBundle): |
| 106 | """Class to abstract access to daplink's build directory as a bundle""" |
| 107 | |
| 108 | def __init__(self, project_dir, build_folder): |
| 109 | |
| 110 | if not os.path.exists(project_dir): |
| 111 | print("Error: DAPLink project folder %s missing" % project_dir) |
| 112 | exit(-1) |
| 113 | |
| 114 | project_dir_list = os.listdir(project_dir) |
| 115 | if not project_dir_list: |
| 116 | print("Error: DAPLink projects not build yet at %s" % project_dir) |
| 117 | exit(-1) |
| 118 | |
| 119 | firmware_list = [] |
| 120 | for name in project_dir_list: |
| 121 | build_dir = os.path.join(project_dir, name, build_folder) |
| 122 | if os.path.isdir(build_dir): |
| 123 | daplink_firmware = DAPLinkFirmware(name.lower(), self, build_dir) |
| 124 | if daplink_firmware.valid: |
| 125 | firmware_list.append(daplink_firmware) |
| 126 | self._firmware_list = firmware_list |
| 127 | |
| 128 | def get_firmware_list(self): |
| 129 | return self._firmware_list |
| 130 | |
| 131 | @property |
| 132 | def build_sha(self): |
| 133 | raise NotImplementedError() |
| 134 | |
| 135 | @property |
| 136 | def build_local_mods(self): |
| 137 | raise NotImplementedError() |
no outgoing calls
no test coverage detected