diff options
| author | Cary Coutant <ccoutant@gmail.com> | 2023-03-27 13:03:00 -0700 |
|---|---|---|
| committer | Cary Coutant <ccoutant@gmail.com> | 2023-03-27 13:03:00 -0700 |
| commit | 59a61f644e566952ef1bb22c0299f8592f87f8ba (patch) | |
| tree | e9cdc429cd10e255d19da11a5ff111cfc411e100 /tools | |
| parent | Standardize issue status terms. (diff) | |
Generate separate lists of open and closed issues.
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/build.sh | 5 | ||||
| -rwxr-xr-x | tools/gen-index.py | 32 |
2 files changed, 29 insertions, 8 deletions
diff --git a/tools/build.sh b/tools/build.sh index 16eb8a2..84511b5 100755 --- a/tools/build.sh +++ b/tools/build.sh | |||
| @@ -54,8 +54,11 @@ do | |||
| 54 | $TOOLSDIR/gen-index.py -v "$v" -r "$DESTDIR" -t "$INDEX_TEMPLATE" "$SRCDIR/issues" "$dest" | 54 | $TOOLSDIR/gen-index.py -v "$v" -r "$DESTDIR" -t "$INDEX_TEMPLATE" "$SRCDIR/issues" "$dest" |
| 55 | done | 55 | done |
| 56 | 56 | ||
| 57 | dest="$DESTDIR/issues-closed.html" | ||
| 58 | $TOOLSDIR/gen-index.py -c -v "$DWARF_VERSION" -r "$DESTDIR" -t "$INDEX_TEMPLATE" "$SRCDIR/issues" "$dest" | ||
| 59 | |||
| 57 | dest="$DESTDIR/issues.html" | 60 | dest="$DESTDIR/issues.html" |
| 58 | $TOOLSDIR/gen-index.py -v "$DWARF_VERSION" -r "$DESTDIR" -t "$INDEX_TEMPLATE" "$SRCDIR/issues" "$dest" | 61 | $TOOLSDIR/gen-index.py -o -v "$DWARF_VERSION" -r "$DESTDIR" -t "$INDEX_TEMPLATE" "$SRCDIR/issues" "$dest" |
| 59 | 62 | ||
| 60 | # Hardlink the static files into the build tree | 63 | # Hardlink the static files into the build tree |
| 61 | echo "Hard-linking static files..." | 64 | echo "Hard-linking static files..." |
diff --git a/tools/gen-index.py b/tools/gen-index.py index a1127df..fda3477 100755 --- a/tools/gen-index.py +++ b/tools/gen-index.py | |||
| @@ -37,9 +37,10 @@ issue_column_fields = [ | |||
| 37 | root_dir = "" | 37 | root_dir = "" |
| 38 | version = "" | 38 | version = "" |
| 39 | template_file = "" | 39 | template_file = "" |
| 40 | issue_filter = "" | ||
| 40 | 41 | ||
| 41 | try: | 42 | try: |
| 42 | opts, args = getopt.getopt(sys.argv[1:], "hr:v:t:") | 43 | opts, args = getopt.getopt(sys.argv[1:], "hcor:v:t:") |
| 43 | except getopt.GetoptError as err: | 44 | except getopt.GetoptError as err: |
| 44 | sys.stderr.write(str(err) + "\n") | 45 | sys.stderr.write(str(err) + "\n") |
| 45 | usage() | 46 | usage() |
| @@ -48,6 +49,10 @@ for o, a in opts: | |||
| 48 | if o == "-h": | 49 | if o == "-h": |
| 49 | usage() | 50 | usage() |
| 50 | sys.exit(0) | 51 | sys.exit(0) |
| 52 | elif o == "-c": | ||
| 53 | issue_filter = "c" | ||
| 54 | elif o == "-o": | ||
| 55 | issue_filter = "o" | ||
| 51 | elif o == "-r": | 56 | elif o == "-r": |
| 52 | root_dir = a | 57 | root_dir = a |
| 53 | elif o == "-v": | 58 | elif o == "-v": |
| @@ -69,6 +74,10 @@ root_path = os.path.relpath(root_dir, dest_dir) | |||
| 69 | title = "DWARF Issues" | 74 | title = "DWARF Issues" |
| 70 | if version: | 75 | if version: |
| 71 | title = "Issues for DWARF Version " + version | 76 | title = "Issues for DWARF Version " + version |
| 77 | if issue_filter == "c": | ||
| 78 | title = "Closed " + title | ||
| 79 | elif issue_filter == "o": | ||
| 80 | title = "Open " + title | ||
| 72 | 81 | ||
| 73 | for f in [source_dir, dest_dir, template_file]: | 82 | for f in [source_dir, dest_dir, template_file]: |
| 74 | if f and not os.path.exists(f): | 83 | if f and not os.path.exists(f): |
| @@ -90,12 +99,21 @@ for source_file in issue_files: | |||
| 90 | m = re.match(r"([^:]+):\s*(.*)", l) | 99 | m = re.match(r"([^:]+):\s*(.*)", l) |
| 91 | if m: | 100 | if m: |
| 92 | per_file_meta[m.group(1).lower()] = m.group(2) | 101 | per_file_meta[m.group(1).lower()] = m.group(2) |
| 93 | if not version or ("version" in per_file_meta and version == per_file_meta["version"]): | 102 | if version and "version" in per_file_meta and version != per_file_meta["version"]: |
| 94 | href = os.path.join(root_path, "issues", os.path.basename(source_file.replace(".md", ".html"))) | 103 | continue |
| 95 | issue_table += " <tr>\n" | 104 | if issue_filter: |
| 96 | issue_table += " <td><a href=\"%s\">%s</a></td>\n" % (href, per_file_meta["propid"]) | 105 | is_closed = False |
| 97 | issue_table += "".join(" <td>%s</td>\n" % html.escape(per_file_meta[s]) for s in issue_column_fields[1:]) | 106 | if "status" in per_file_meta: |
| 98 | issue_table += " </tr>\n" | 107 | is_closed = re.match(r"accepted|approved|closed|duplicate|deferred|rejected|withdrawn|lang", per_file_meta["status"], re.I) |
| 108 | if issue_filter == "c" and not is_closed: | ||
| 109 | continue | ||
| 110 | if issue_filter == "o" and is_closed: | ||
| 111 | continue | ||
| 112 | href = os.path.join(root_path, "issues", os.path.basename(source_file.replace(".md", ".html"))) | ||
| 113 | issue_table += " <tr>\n" | ||
| 114 | issue_table += " <td><a href=\"%s\">%s</a></td>\n" % (href, per_file_meta["propid"]) | ||
| 115 | issue_table += "".join(" <td>%s</td>\n" % html.escape(per_file_meta[s]) for s in issue_column_fields[1:]) | ||
| 116 | issue_table += " </tr>\n" | ||
| 99 | issue_table += "</tbody>\n</table>\n" | 117 | issue_table += "</tbody>\n</table>\n" |
| 100 | 118 | ||
| 101 | with open(template_file, 'r', encoding="utf-8") as f: | 119 | with open(template_file, 'r', encoding="utf-8") as f: |
