Skip to content

Commit 6591865

Browse files
committed
Generate HTML
1 parent 39b658c commit 6591865

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*_openpilot/
22
*_openpilot_*/
3+
index.html

generate.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
logging.basicConfig(level=logging.INFO, format="%(message)s")
99

10-
base_branches = ["master-ci", "release3"]
11-
1210

1311
def parse_cars(branch):
1412
"""
@@ -107,11 +105,48 @@ def generate_branch(base, car):
107105
)
108106
return branch_name
109107

108+
def generate_html(base_cars_base_branches):
109+
header = """
110+
<html>
111+
<head>
112+
<title>Hardcoded Fingerprint comma.ai openpilot Continuous Micro-Fork Generator branches</title>
113+
<style>
114+
body {
115+
font-family: sans-serif;
116+
}
117+
</style>
118+
</head>
119+
<body>
120+
<h1>Hardcoded Fingerprint comma.ai openpilot Continuous Micro-Fork Generator branches</h1>
121+
<p>
122+
This is a list of all the branches with hardcoded fingerprints generated by the <a href="https://github.com/hardcoded-fp/openpilot/"> Hardcoded Fingerprint comma.ai openpilot Continuous Micro-Fork Generator. </a>
123+
</p>
124+
"""
125+
# Make it a nested list
126+
body = ""
127+
for base in base_cars_base_branches:
128+
body += f"<h2>{base}</h2>"
129+
body += "<ul>"
130+
for car in base_cars_base_branches[base]:
131+
body += f"<li><code>{car}</code>"
132+
body += f"<ul>"
133+
body += f"<li>Custom Software URL: <code>https://installer.comma.ai/hardcoded-fp/{base_cars_base_branches[base][car]}</code></li>"
134+
body += f"</ul>"
135+
body += f"</li>"
136+
137+
body += "</ul>"
138+
footer = """
139+
</body>
140+
</html>
141+
"""
142+
with open("index.html", "w") as f:
143+
f.write(header + body + footer)
110144

111145
def main(push=True):
112146
prepare_op_repo()
113147

114148
base_cars = {}
149+
base_branches = ["master-ci", "release3"]
115150
for base in base_branches:
116151
base_cars[base] = parse_cars(base)
117152

@@ -127,6 +162,9 @@ def main(push=True):
127162
logging.info("base_cars_base_branches:")
128163
logging.info(pprint.pformat(base_cars_base_branches))
129164

165+
# Generate HTML output
166+
generate_html(base_cars_base_branches)
167+
130168
if push:
131169
# Run the command to push to origin all the branches
132170
# Copy .git/config from this git repo to comma_openpilot repo
@@ -139,7 +177,7 @@ def main(push=True):
139177
# Check if args has dry run, if so, don't push
140178
import sys
141179

142-
if len(sys.argv) > 1 and sys.argv[1] == "--dry-run":
143-
main(push=False)
144-
else:
180+
if len(sys.argv) > 1 and sys.argv[1] == "--no-dry-run":
145181
main()
182+
else:
183+
main(push=False)

0 commit comments

Comments
 (0)