summaryrefslogtreecommitdiff
path: root/scripts/html_bsp.py
blob: 321706e429619416d1aacd738842e0bddea732e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /usr/bin/env python3
#===============================
#
# html_bsp
#
# 2021/02/09 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
#===============================
import sys
import os

import view
import html_base
from html_base import html
#====================================
#
# periject_html
#
#====================================
class periject_html(html_base.myhtml):

    #--------------------
    # print
    #--------------------
    def print(self, argv):
        # remove this script
        argv.pop(0)

        a = html("a", {"target":"subbody"})
        cnt_bsp = 0
        cnt_up  = 0
        cnt_upd = 0
        cnt_all = 0
        cnt_done= 0
        tmp = 0
        bsp = argv.pop(0)

        self.print_css("html")
        with html("body"):
            html("h2").print(bsp)

            with html("table", {"border":"1"}):
                with html("tr"):
                    html("th").print("file")
                    html("th").print("BSP")
                    html("th").print("upstream")

                for file in argv:
                    v = view.viewer([file])
                    v.set_data(file)

                    bsp_list = v.get_data(bsp)
                    if (not bsp_list):
                        continue

                    cnt_all += 1
                    with html("tr"):
                        a.option({"href":
                                  self.relpath_y2h(file, "{}/html".format(self.top()))})
                        html("th").print("{}<br>({})".format(
                            a.text(os.path.basename(file).replace(".yaml", "")),
                            v.get_data("status")))

                        with html("td"):
                            tmp = self.print_commit_bsp(bsp_list)
                            cnt_bsp += tmp

                        with html("td"):
                            (done, cnt) = self.task_commit_upstream(v)
                            if (cnt):
                                cnt_up += tmp
                            if (done):
                                cnt_done += 1
                                cnt_upd  += tmp

                html("p").print("bsp:{}/upstream:{} = {:.1f}%".format(cnt_bsp, cnt_up, cnt_up * 100 /cnt_bsp))
                html("p").print("task:{}/done:{} = {:.1f}%  (bsp:{}/upstream:{} = {:.1f}%)".format(cnt_all, cnt_done, cnt_done * 100 /cnt_all,
                                                                                                   cnt_bsp, cnt_upd, cnt_upd * 100 /cnt_bsp))

#====================================
#
# As command
#
#====================================
if __name__=='__main__':
    # ./script/find.py -is -b bsp39x | xargs ./script/html_bsp.py bsp39x
    periject_html().print(sys.argv)