(input_file, output_file, header_comment)
| 34 | } |
| 35 | # 产生toolchain.yml文件 |
| 36 | def generate_toolchain_yaml(input_file, output_file, header_comment): |
| 37 | with open(input_file, 'r', encoding='utf-8') as file: |
| 38 | data = yaml.safe_load(file) |
| 39 | |
| 40 | toolchain_data = {} |
| 41 | for folder, details in data.items(): |
| 42 | gcc = details.get('gcc') |
| 43 | if gcc: |
| 44 | if gcc not in toolchain_data: |
| 45 | toolchain_data[gcc] = {'bsp': []} |
| 46 | toolchain_data[gcc]['bsp'].append(folder) |
| 47 | |
| 48 | |
| 49 | # 添加每个工具链的个数 |
| 50 | for gcc, details in toolchain_data.items(): |
| 51 | details['count'] = len(details['bsp']) |
| 52 | download_url = download_urls.get(gcc) |
| 53 | if download_url: |
| 54 | details['download_url'] = download_url |
| 55 | |
| 56 | with open(output_file, 'w', encoding='utf-8') as file: |
| 57 | file.write(f"# {header_comment}\n") |
| 58 | yaml.dump(toolchain_data, file, default_flow_style=False, allow_unicode=True) |
| 59 | |
| 60 | |
| 61 | # 这个函数通过检查文件是否存在来检查bsp的支持情况 |
no test coverage detected