fix(datasheet): use shuttle name from config

also, dynamically figure out the repo URL (instead of using an hardcoded value)
This commit is contained in:
Uri Shaked
2023-07-30 09:40:16 +03:00
parent e56503e9c3
commit 6034820170
4 changed files with 20 additions and 11 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ if __name__ == '__main__':
else: else:
modules_yaml_name = "modules.yaml" modules_yaml_name = "modules.yaml"
docs = Docs(projects.projects, args=args) docs = Docs(config, projects.projects, args=args)
caravel = CaravelConfig(config, projects.projects, modules_yaml_name) caravel = CaravelConfig(config, projects.projects, modules_yaml_name)
rom = ROMFile(config, projects.projects) rom = ROMFile(config, projects.projects)
+7 -7
View File
@@ -1,17 +1,17 @@
--- ---
title: | title: |
![](pics/ttlogo.png){width=15cm} ![](pics/ttlogo.png){{width=15cm}}
Tiny Tapeout 03 Datasheet {name} Datasheet
subtitle: Project Repository [https://github.com/TinyTapeout/tinytapeout-03](https://github.com/TinyTapeout/tinytapeout-03) subtitle: Project Repository [{repo}]({repo})
documentclass: scrartcl documentclass: scrartcl
date: \today{} date: \today{{}}
geometry: "left=2cm,right=2cm,top=2cm,bottom=2.5cm" geometry: "left=2cm,right=2cm,top=2cm,bottom=2.5cm"
fontsize: 14pt fontsize: 14pt
mainfont: Latin Modern Sans mainfont: Latin Modern Sans
header-includes: header-includes:
- \hypersetup{colorlinks=false, - \hypersetup{{colorlinks=false,
allbordercolors={0 0 0}, allbordercolors={{0 0 0}},
pdfborderstyle={/S/U/W 1}} pdfborderstyle={{/S/U/W 1}}}}
--- ---
\pagebreak \pagebreak
+6 -2
View File
@@ -3,11 +3,14 @@ import logging
import subprocess import subprocess
import shutil import shutil
import json import json
from git_utils import get_first_remote
import git
class Docs(): class Docs():
def __init__(self, projects, args): def __init__(self, config, projects, args):
self.config = config
self.projects = projects self.projects = projects
self.args = args self.args = args
self.script_dir = os.path.dirname(os.path.realpath(__file__)) self.script_dir = os.path.dirname(os.path.realpath(__file__))
@@ -64,7 +67,8 @@ class Docs():
doc_credits = fh.read() doc_credits = fh.read()
with open(self.args.dump_markdown, 'w') as fh: with open(self.args.dump_markdown, 'w') as fh:
fh.write(doc_header) repo = git.Repo(".")
fh.write(doc_header.format(name=self.config['name'], repo=get_first_remote(repo)))
self.projects.sort(key=lambda x: x.mux_address) self.projects.sort(key=lambda x: x.mux_address)
+6 -1
View File
@@ -2,6 +2,7 @@ import base64
from urllib.parse import urlparse from urllib.parse import urlparse
import logging import logging
import requests import requests
import git
import os import os
import errno import errno
@@ -70,7 +71,7 @@ def split_git_url(url):
def get_latest_action_url(url, directory): def get_latest_action_url(url):
logging.debug(url) logging.debug(url)
user_name, repo = split_git_url(url) user_name, repo = split_git_url(url)
@@ -99,3 +100,7 @@ def get_latest_action_url(url, directory):
page_url = get_most_recent_action_page(commits, runs['workflow_runs']) page_url = get_most_recent_action_page(commits, runs['workflow_runs'])
return page_url return page_url
def get_first_remote(repo: git.Repo) -> str:
return list(repo.remotes[0].urls)[0]