diff --git a/.github/workflows/table.yaml b/.github/workflows/table.yaml index 975e475..cbb9755 100644 --- a/.github/workflows/table.yaml +++ b/.github/workflows/table.yaml @@ -42,6 +42,7 @@ jobs: pip install -r assets/requirements.txt mkdir assets/output python assets/generate_svgimage.py -p . -o assets/output --html https://${{ github.repository_owner }}.github.io/support-matrix | tee build.log + python assets/generate_svgimage.py -p . -o assets/output --html https://${{ github.repository_owner }}.github.io/support-matrix -l zh | tee -a build.log - name: Check Commit ID id: truecommit run: | diff --git a/README.md b/README.md index 912c6d5..ebbd1bf 100644 --- a/README.md +++ b/README.md @@ -45,57 +45,3 @@ Currently [assets](assets) contains tools and scripts to support the project ope * WIP: Official announcements say there will be/is support for this OS/board, but no image or other resources (e.g. source code) avaliable yet * -: No support for this OS/board combo, either from official or other sources -[Pioneer]: ./Pioneer/README.md -[Duo]: ./Duo/README.md -[Duo256m]: ./Duo256m/README.md -[LPi4A]: ./LicheePi4A/README.md -[VF1]: ./VisionFive/README.md -[VF2]: ./VisionFive2/README.md -[K230]: ./K230/README.md -[C906]: ./D1_LicheeRV/README.md -[Unmatched]: ./Unmatched/README.md -[DuoS]: ./Duo_S/README.md -[Mars]: ./Mars/README.md -[Vega]: ./Vega/README.md -[Meles]: ./Meles/README.md -[MaixBit]: ./Maix-I_K210/README.md -[Cluster4A]: ./LicheeCluster4A/README.md -[Console4A]: ./LicheeConsole4A/README.md -[LicheeRVNano]: ./LicheeRV_Nano/README.md -[TangMega138K]: ./Tang_Mega_138K/README.md -[K510]: ./K510/README.md -[SipeedM1s]: ./M1s/README.md -[M0sense]: ./M0sense/README.md -[M0P]: ./M0P_Dock/README.md -[M0s]: ./M0s/README.md -[CH32V103]: ./CH32V103/README.md -[CH32V203]: ./CH32V203/README.md -[CH32V208]: ./CH32V208/README.md -[CH32V303]: ./CH32V303/README.md -[CH32V305]: ./CH32V305/README.md -[CH32V307]: ./CH32V307/README.md -[CH582F]: ./CH582F/README.md -[CH592X]: ./CH592X/README.md -[Longan_Nano]: ./Longan_Nano/README.md -[RV_STAR]: ./RV_STAR/README.md -[DDR200T]: ./DDR200T/README.md -[V853]: ./V853/README.md -[100ASK]: ./100ASK/README.md -[YouMuPI]: ./YouMuPI/README.md -[TinyVision]: ./TinyVision/README.md -[CH573F]: ./CH573F/README.md -[DongshanPI-STU]: ./DongshanPI-STU/README.md -[mangopi_mq_pro]: ./mangopi_mq_pro/README.md -[DongShanPI-D1s]: ./DongShanPI-D1s/README.md -[mangopi_mq]: ./mangopi_mq/README.md -[NeZha-D1s]: ./NeZha-D1s/README.md -[BPI-F3]: ./BPI-F3/README.md -[Jupiter]: ./Jupiter/README.md -[BeagleV-Ahead]: ./BeagleV-Ahead/README.md -[BeagleV-Fire]: ./BeagleV-Fire/README.md -[STAR64]: ./STAR64/README.md -[Icicle]: ./Icicle/README.md -[PIC64GX]: ./PIC64GX/README.md -[CM32M433R]: ./CM32M433R/README_zh.md -[R128-EVT]: ./R128-EVT/README_zh.md -[Huashan_Pi]: ./Huashan_Pi/README.md diff --git a/README_zh.md b/README_zh.md index 99494f9..e779791 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,30 +1,30 @@ # RISC-V 开发板与操作系统支持矩阵 -[English](./README_zh.md) | [中文](./README_zh.md) +[English](./README.md) | [中文](./README_zh.md) ## 支持矩阵表 ### Linux 发行版 -![Linux](https://ruyisdk.github.io/support-matrix/linux.svg) +![Linux](https://ruyisdk.github.io/support-matrix/linux_zh.svg) --- ### *BSD -![BSD](https://ruyisdk.github.io/support-matrix/bsd.svg) +![BSD](https://ruyisdk.github.io/support-matrix/bsd_zh.svg) --- ### RTOS / 实时操作系统 -![RTOS](https://ruyisdk.github.io/support-matrix/rtos.svg) +![RTOS](https://ruyisdk.github.io/support-matrix/rtos_zh.svg) --- ### 其它 -![Others](https://ruyisdk.github.io/support-matrix/others.svg) +![Others](https://ruyisdk.github.io/support-matrix/others_zh.svg) --- @@ -44,58 +44,3 @@ * CFI (Call for more information):官方资料宣称有,但是找不到镜像文件等实际可用的资料 * WIP:官方宣发操作系统即将/正在对开发板进行支持,但暂未获取到可用的镜像 * -:暂未从官方或者其它渠道获取到开发板的支持信息 - -[Pioneer]: ./Pioneer/README_zh.md -[Duo]: ./Duo/README_zh.md -[Duo256m]: ./Duo256m/README_zh.md -[LPi4A]: ./LicheePi4A/README_zh.md -[VF1]: ./VisionFive/README_zh.md -[VF2]: ./VisionFive2/README_zh.md -[K230]: ./K230/README_zh.md -[C906]: ./D1_LicheeRV/README_zh.md -[Unmatched]: ./Unmatched/README_zh.md -[DuoS]: ./Duo_S/README_zh.md -[Mars]: ./Mars/README_zh.md -[Vega]: ./Vega/README_zh.md -[Meles]: ./Meles/README_zh.md -[MaixBit]: ./Maix-I_K210/README_zh.md -[Cluster4A]: ./LicheeCluster4A/README_zh.md -[Console4A]: ./LicheeConsole4A/README_zh.md -[LicheeRVNano]: ./LicheeRV_Nano/README_zh.md -[TangMega138K]: ./Tang_Mega_138K/README_zh.md -[K510]: ./K510/README_zh.md -[SipeedM1s]: ./M1s/README_zh.md -[M0sense]: ./M0sense/README_zh.md -[M0P]: ./M0P_Dock/README_zh.md -[M0s]: ./M0s/README_zh.md -[CH32V103]: ./CH32V103/README_zh.md -[CH32V203]: ./CH32V203/README_zh.md -[CH32V208]: ./CH32V208/README_zh.md -[CH32V303]: ./CH32V303/README_zh.md -[CH32V305]: ./CH32V305/README_zh.md -[CH32V307]: ./CH32V307/README_zh.md -[CH582F]: ./CH582F/README_zh.md -[CH592X]: ./CH592X/README_zh.md -[Longan_Nano]: ./Longan_Nano/README_zh.md -[RV_STAR]: ./RV_STAR/README_zh.md -[DDR200T]: ./DDR200T/README_zh.md -[V853]: ./V853/README_zh.md -[100ASK]: ./100ASK/README_zh.md -[YouMuPI]: ./YouMuPI/README_zh.md -[TinyVision]: ./TinyVision/README_zh.md -[CH573F]: ./CH573F/README_zh.md -[DongshanPI-STU]: ./DongshanPI-STU/README_zh.md -[mangopi_mq_pro]: ./mangopi_mq_pro/README_zh.md -[DongShanPI-D1s]: ./DongShanPI-D1s/README_zh.md -[mangopi_mq]: ./mangopi_mq/README_zh.md -[NeZha-D1s]: ./NeZha-D1s/README_zh.md -[BPI-F3]: ./BPI-F3/README_zh.md -[Jupiter]: ./Jupiter/README_zh.md -[BeagleV-Ahead]: ./BeagleV-Ahead/README_zh.md -[BeagleV-Fire]: ./BeagleV-Fire/README_zh.md -[STAR64]: ./STAR64/README_zh.md -[Icicle]: ./Icicle/README_zh.md -[PIC64GX]: ./PIC64GX/README_zh.md -[CM32M433R]: ./CM32M433R/README_zh.md -[R128-EVT]: ./R128-EVT/README_zh.md -[Huashan_Pi]: ./Huashan_Pi/README_zh.md diff --git a/assets/generate_svgimage.py b/assets/generate_svgimage.py index 425c0bb..d21a705 100755 --- a/assets/generate_svgimage.py +++ b/assets/generate_svgimage.py @@ -4,6 +4,7 @@ import argparse import os +from typing import Callable, Any from urllib.parse import urljoin from src.svg_gen import SvgConf, SvgNode, SvgXml, gen_html, putconf, SvgRectContainer from src.svg_gen import SvgText, SvgTextCenter, SvgMoveTo, SvgCR, SvgLF, SvgGroup @@ -11,39 +12,9 @@ from src.matrix_parser import Systems, status_map -def gen_color(_, col, content): - """ - gen svg color - """ - white = 'rgb(255, 255, 255)' - gray = 'rgb(220, 220, 220)' - green = 'rgb(203, 255, 203)' - yellow = 'rgb(255, 255, 203)' - red = 'rgb(255, 203, 203)' - if col < 3: - return white - if "Good" in content or "Basic" in content: - return green - if "CFT" in content: - return yellow - if "WIP" in content or "CFH" in content: - return red - return gray - - -def gen_link(_, __, content): - """ - gen link - """ - if hasattr(content, 'link') and content.link is not None: - url = "https://github.com/ruyisdk/support-matrix/tree/main/" - for i in content.link: - url = urljoin(url + '/', i) - return url - return None - - -def gen_svg_table(conf: SvgConf, systems: Systems, need_systems: dict[str]) -> SvgNode: +def gen_svg_table(conf: SvgConf, systems: Systems, need_systems: dict[str], + link_func: Callable[[Any, Any, object], str], + color_func: Callable[[Any, Any, object], str]) -> SvgNode: """ Generate a svg table with the given systems """ @@ -182,13 +153,13 @@ def gen_svg_table(conf: SvgConf, systems: Systems, need_systems: dict[str]) -> S for jdx, j in enumerate(i): - link = gen_link(None, None, j) + link = link_func(None, None, j) if link is not None: t_lk = SvgLink(link) else: t_lk = SvgGroup() - t_bg = SvgRectContainer(gen_color(None, idx, j.text)) + t_bg = SvgRectContainer(color_func(None, idx, j.text)) t = SvgTextCenter(j.text, col_width[idx], 0, False) t_bg.add_child(t) @@ -212,14 +183,14 @@ def gen_svg_table(conf: SvgConf, systems: Systems, need_systems: dict[str]) -> S g.add_child(var_g) else: - link = gen_link(None, None, i) + link = link_func(None, None, i) if link is not None: t_lk = SvgLink(link) else: t_lk = SvgGroup() - color = gen_color(None, idx, i.text) + color = color_func(None, idx, i.text) t_bg = SvgRectContainer(color) t = SvgTextCenter( i.text, col_width[idx], row_height[rdx + 1], False) @@ -254,18 +225,58 @@ def gen_svg_table(conf: SvgConf, systems: Systems, need_systems: dict[str]) -> S return doc -def proc_onesys(system_arr: dict[str], system: Systems): +def proc_onesys(system_arr: dict[str], system: Systems, + link_func: Callable[[Any, Any, object], str], + color_func: Callable[[Any, Any, object], str]): """ process one type of system """ conf = SvgConf() - res = gen_svg_table(conf, system, system_arr) + res = gen_svg_table(conf, system, system_arr, link_func, color_func) return res +def gen_color(_, col, content): + """ + gen svg color + """ + white = 'rgb(255, 255, 255)' + gray = 'rgb(220, 220, 220)' + green = 'rgb(203, 255, 203)' + yellow = 'rgb(255, 255, 203)' + red = 'rgb(255, 203, 203)' + if col < 3: + return white + if "Good" in content or "Basic" in content: + return green + if "CFT" in content: + return yellow + if "WIP" in content or "CFH" in content: + return red + return gray + + +def gen_gen_link(lang: str): + """ + gen gen_link + """ + lang_end = ".md" if lang == "en" else f"_{lang}.md" + + def gen_link(_, __, content): + if hasattr(content, 'link') and content.link is not None: + url = "https://github.com/ruyisdk/support-matrix/tree/main/" + for i in content.link: + if i.endswith('.md'): + i = i[:-3] + lang_end + url = urljoin(url + '/', i) + return url + return None + return gen_link + + def main(): """ main @@ -275,6 +286,8 @@ def main(): help="support matrix path", type=str, default='.') parser.add_argument('-o', '--output', dest="output", help="output path", type=str, default='.') + parser.add_argument('-l', '--lang', dest="lang", + help="language", type=str, default='en') parser.add_argument('--html', dest="html", help="output html, with svg assets at arg", type=str, default=None) @@ -283,31 +296,47 @@ def main(): p = args.path systems = Systems(p) + color_func = gen_color + link_func = gen_gen_link(args.lang) + + file_suffix = "" if args.lang == "en" else f"_{args.lang}" + html_path = args.html - svg = proc_onesys(systems.linux, systems) - with open(os.path.join(args.output, 'linux.svg'), 'w', encoding="utf-8") as f: + svg = proc_onesys(systems.linux, systems, link_func, color_func) + with open(os.path.join(args.output, f'linux{file_suffix}.svg'), 'w', encoding="utf-8") as f: f.write(str(svg)) if html_path: - with open(os.path.join(args.output, 'linux.html'), 'w', encoding="utf-8") as f: - f.write(gen_html(svg, os.path.join(html_path, 'linux.svg'))) - svg = proc_onesys(systems.bsd, systems) - with open(os.path.join(args.output, 'bsd.svg'), 'w', encoding="utf-8") as f: + with open(os.path.join(args.output, + f'linux{file_suffix}.html'), 'w', encoding="utf-8") as f: + f.write(gen_html(svg, os.path.join( + html_path, f'linux{file_suffix}.svg'))) + + svg = proc_onesys(systems.bsd, systems, link_func, color_func) + with open(os.path.join(args.output, f'bsd{file_suffix}.svg'), 'w', encoding="utf-8") as f: f.write(str(svg)) if html_path: - with open(os.path.join(args.output, 'bsd.html'), 'w', encoding="utf-8") as f: - f.write(gen_html(svg, os.path.join(html_path, 'bsd.svg'))) - svg = proc_onesys(systems.rtos, systems) - with open(os.path.join(args.output, 'rtos.svg'), 'w', encoding="utf-8") as f: + with open(os.path.join(args.output, + f'bsd{file_suffix}.html'), 'w', encoding="utf-8") as f: + f.write(gen_html(svg, os.path.join( + html_path, f'bsd{file_suffix}.svg'))) + + svg = proc_onesys(systems.rtos, systems, link_func, color_func) + with open(os.path.join(args.output, f'rtos{file_suffix}.svg'), 'w', encoding="utf-8") as f: f.write(str(svg)) if html_path: - with open(os.path.join(args.output, 'rtos.html'), 'w', encoding="utf-8") as f: - f.write(gen_html(svg, os.path.join(html_path, 'rtos.svg'))) - svg = proc_onesys(systems.others, systems) - with open(os.path.join(args.output, 'others.svg'), 'w', encoding="utf-8") as f: + with open(os.path.join(args.output, + f'rtos{file_suffix}.html'), 'w', encoding="utf-8") as f: + f.write(gen_html(svg, os.path.join( + html_path, f'rtos{file_suffix}.svg'))) + + svg = proc_onesys(systems.others, systems, link_func, color_func) + with open(os.path.join(args.output, f'others{file_suffix}.svg'), 'w', encoding="utf-8") as f: f.write(str(svg)) if html_path: - with open(os.path.join(args.output, 'others.html'), 'w', encoding="utf-8") as f: - f.write(gen_html(svg, os.path.join(html_path, 'others.svg'))) + with open(os.path.join(args.output, + f'others{file_suffix}.html'), 'w', encoding="utf-8") as f: + f.write(gen_html(svg, os.path.join( + html_path, f'others{file_suffix}.svg'))) if __name__ == "__main__": @@ -315,4 +344,5 @@ def main(): main() except Exception as e: print("Raise:", e) - exit(1) + import sys as __sys + __sys.exit(1)