acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
build.py (1938B)
1 #!/usr/bin/env python3 2 3 import sys 4 import os 5 import subprocess 6 import re 7 import example_list as ex 8 9 langs = ['en'] 10 11 # Change to script directory for consistency 12 abspath = os.path.abspath(__file__) 13 dname = os.path.dirname(abspath) 14 os.chdir(dname) 15 16 def cmd(s): 17 print("") 18 print(s) 19 print("-------------------------------------") 20 r = os.system(s) 21 if r != 0: 22 print("Exit build due to previous error") 23 exit(-1) 24 25 # Get the current branch name 26 status, br = subprocess.getstatusoutput("git branch | grep '*'") 27 _, gitcommit = subprocess.getstatusoutput("git rev-parse HEAD") 28 br = re.sub('\* ', '', br) 29 30 # Generate the list of examples 31 ex.exec() 32 33 urlpath = re.sub('release/', '', br) 34 35 # Be sure the GitHub links point to the right branch 36 f = open("header.rst", "w") 37 f.write(".. |github_link_base| replace:: https://github.com/lvgl/lvgl/blob/" + gitcommit + "/docs") 38 f.close() 39 40 base_html = "html_baseurl = 'https://docs.lvgl.io/" + urlpath + "/en/html/'" 41 42 os.system("sed -i \"s|html_baseurl = .*|" + base_html +"|\" conf.py") 43 44 clean = 0 45 trans = 0 46 skip_latex = False 47 args = sys.argv[1:] 48 if len(args) >= 1: 49 if "clean" in args: clean = 1 50 if "skip_latex" in args: skip_latex = True 51 52 lang = "en" 53 print("") 54 print("****************") 55 print("Building") 56 print("****************") 57 if clean: 58 cmd("rm -rf " + lang) 59 cmd("mkdir " + lang) 60 61 62 print("Running doxygen") 63 cmd("cd ../scripts && doxygen Doxyfile") 64 # BUILD PDF 65 66 if not skip_latex: 67 # Silly workaround to include the more or less correct PDF download link in the PDF 68 #cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true") 69 cmd("sphinx-build -b latex . out_latex") 70 71 # Generate PDF 72 cmd("cd out_latex && latexmk -pdf 'LVGL.tex'") 73 # Copy the result PDF to the main directory to make it available for the HTML build 74 cmd("cd out_latex && cp -f LVGL.pdf ../LVGL.pdf") 75 else: 76 print("skipping latex build as requested") 77 78 # BUILD HTML 79 cmd("sphinx-build -b html . ../out_html") 80