summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-02-09 11:15:19 +0900
committerKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-02-09 11:23:47 +0900
commit0e370113e7af1aea544c832fa5fa23bf255eefcc (patch)
treeb3883321e8805eb541433315b6b460d373198828
parenta176f6999a2d33163365602fb56cae8711875e06 (diff)
scripts: add html_summary.py
Because current PeriJect is using scripts/myhtml.py to creating all HTML files, all files will be re-created if myhtml.py itself was updated. It is very verbose. This patch separates "summary" from it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-rw-r--r--Makefile4
-rw-r--r--scripts/html_base.py85
-rwxr-xr-xscripts/html_summary.py47
3 files changed, 134 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index df47fde..857f8e4 100644
--- a/Makefile
+++ b/Makefile
@@ -62,11 +62,11 @@ myhtml:
make CMD=${CMD} OPTION="${OPTION}" FILES="${FILES}" HTML=${HTML} ${HTML}
file:
make CMD=task FILES=${PARAM} HTML=$(subst yaml,html,$(subst projects,html,${PARAM})) myhtml
+summary:
+ make CMD=summary FILES=projects/${PARAM} HTML=html/${PARAM}/summary.html myhtml
basic:
make HTML_OPTION1="${HTML_OPTION1}" HTML_OPTION2="${HTML_OPTION2}" FILE=${FILE} ${FILE}
-summary:
- make HTML_OPTION1=summary HTML_OPTION2=projects/${PARAM} FILE=html/${PARAM}/summary.html basic
noparam:
make HTML_OPTION1=${PARAM} HTML_OPTION2="${PRODIR}" FILE=html/${PARAM}.html basic
finds:
diff --git a/scripts/html_base.py b/scripts/html_base.py
index 9b265ae..562d90f 100644
--- a/scripts/html_base.py
+++ b/scripts/html_base.py
@@ -8,6 +8,7 @@
import os
import base
+import view
#====================================
#
# html
@@ -209,3 +210,87 @@ class myhtml(base.base):
cnt += self.__task_commit_posted(v, up, "lore")
return (done, cnt)
+
+ #--------------------
+ # summary
+ #--------------------
+ def __summary(self, status, dir, files):
+
+ if (not len(files)):
+ return
+
+ html("h3").print(html("a", {"target":"summary",
+ "href":self.relpath("html/{}.html".format(status), dir)}).text(status))
+
+ with html("table", {"border":"1"}):
+ with html("tr"):
+ html("th").print("file")
+ html("th").print("team")
+ html("th").print("assignee")
+ html("th").print("title")
+ files.sort()
+ for file in files:
+ v = view.viewer([file])
+ v.set_data(file)
+
+ subbody = html("a", {"target":"subbody"})
+ summary = html("a", {"target":"summary"})
+ with html("tr"):
+ subbody.option({"href":self.relpath_y2h(file, dir)})
+ html("td").print(subbody.text(os.path.basename(file).replace(".yaml", "")))
+
+ team = v.get_data("team")
+ summary.option({"href":self.relpath("html/{}.html".format(team), dir)})
+ html("td").print(summary.text(team))
+
+ assignee = v.get_data("assignee")
+ if (not len(assignee)):
+ assignee = "NoAssignee"
+ summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)})
+ html("td").print(summary.text(assignee))
+
+ html("td").print(v.get_data("title"))
+
+ #--------------------
+ # summary
+ #--------------------
+ def summary(self, title, dir, files):
+ # -------
+ # summary
+ # -------
+ #
+ # -------
+ if (title):
+ html("h2").print(title)
+
+ new = []
+ active = []
+ blocked = []
+ paused = []
+ done = []
+ abandoned = []
+
+ for file in files:
+ v = view.viewer([file])
+ v.set_data(file)
+
+ status = v.get_data("status")
+ if (status == "New"):
+ new.append(file)
+ elif (status == "Active"):
+ active.append(file)
+ elif (status == "Blocked"):
+ blocked.append(file)
+ elif (status == "Paused"):
+ paused.append(file)
+ elif (status == "Done"):
+ done.append(file)
+ else:
+ abandoned.append(file)
+
+ self.__summary("New", dir, new)
+ self.__summary("Active", dir, active)
+ self.__summary("Blocked", dir, blocked)
+ self.__summary("Paused", dir, paused)
+ self.__summary("Done", dir, done)
+ self.__summary("Abandoned", dir, abandoned)
diff --git a/scripts/html_summary.py b/scripts/html_summary.py
new file mode 100755
index 0000000..0d92abf
--- /dev/null
+++ b/scripts/html_summary.py
@@ -0,0 +1,47 @@
+#! /usr/bin/env python3
+#===============================
+#
+# html_summary
+#
+# 2021/02/09 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+#===============================
+import sys
+import os
+
+import find
+import view
+import html_base
+from html_base import html
+#====================================
+#
+# periject_html
+#
+#====================================
+class periject_html(html_base.myhtml):
+
+ def __init__(self):
+ super().__init__()
+
+ def print(self, argv):
+ # remove this script
+ argv.pop(0)
+
+ dir = os.path.normpath(argv[0])
+
+ # -------
+ # summary
+ # -------
+ #
+ # -------
+ self.print_css(dir)
+ with html("body"):
+ self.summary(dir, self.top() + "/" + dir, find.find([dir]).get())
+
+#====================================
+#
+# As command
+#
+#====================================
+if __name__=='__main__':
+ # html_summary.py projects/linux/io
+ periject_html().print(sys.argv)