mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-04 00:02:01 -04:00
some refactoring
Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>
This commit is contained in:
parent
c52e0f42c3
commit
606ef108c6
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from collections import namedtuple
|
||||
import os
|
||||
|
||||
import tabulate
|
||||
@ -15,6 +14,7 @@ ALG_SUPPORT_HEADER = [
|
||||
]
|
||||
COMMIT_HASH_LEN = 7
|
||||
|
||||
|
||||
def format_upstream_source(source: str) -> str:
|
||||
"""For each YAML data sheet, the primary-upstream.source field contains some
|
||||
URL to the implementation. At this moment all URLs are links to GitHub, so
|
||||
@ -30,7 +30,7 @@ def format_upstream_source(source: str) -> str:
|
||||
url_start = source.find(prefix)
|
||||
url = source[url_start:].split(" ")[0]
|
||||
# example: ["PQClean", "PQClean", "commit", "1eacfdaf..."]
|
||||
tokens = url[len(prefix):].split("/")
|
||||
tokens = url[len(prefix) :].split("/")
|
||||
handle, repo = tokens[0], tokens[1]
|
||||
output = f"{handle}/{repo}"
|
||||
if "commit/" in url:
|
||||
@ -38,6 +38,7 @@ def format_upstream_source(source: str) -> str:
|
||||
output += f"@{commit}"
|
||||
return f"[{output}]({url})"
|
||||
|
||||
|
||||
def render_alg_support_tbl(doc_dir: str) -> str:
|
||||
"""Render a markdown table summarizing the algorithms described by YAML data
|
||||
sheets stored in the specified doc directory
|
||||
@ -62,11 +63,13 @@ def render_alg_support_tbl(doc_dir: str) -> str:
|
||||
std_status = algdata["standardization-status"]
|
||||
# TODO: unsure what to do with spec-url for now
|
||||
primary_impl = format_upstream_source(algdata["primary-upstream"]["source"])
|
||||
rows.append([
|
||||
f"[{alg_name}]({md_url})",
|
||||
std_status,
|
||||
primary_impl,
|
||||
])
|
||||
rows.append(
|
||||
[
|
||||
f"[{alg_name}]({md_url})",
|
||||
std_status,
|
||||
primary_impl,
|
||||
]
|
||||
)
|
||||
tbl = tabulate.tabulate(rows, tablefmt="pipe", headers="firstrow")
|
||||
return tbl
|
||||
|
||||
|
@ -342,8 +342,6 @@ def do_it(liboqs_root):
|
||||
out_md.write(tabulate.tabulate(table, tablefmt="pipe", headers="firstrow", colalign=("center",)))
|
||||
out_md.write('\n')
|
||||
|
||||
# TODO:construct the algorithm support table, replace the appropriate
|
||||
# section in README.md (OQS_TEMPLATE_FRAGMENT_ALG_SUPPORT_START)
|
||||
update_readme(liboqs_root)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user