def get_builds(proj): if not os.path.isfile(getProjPath(proj) + "/.ci.json"): return "Not found", 404 if os.path.exists(getBuildPath(proj)): dirs = [ entry for entry in os.listdir(getBuildPath(proj)) if entry != "latest" and os.path.isdir(getBuildPath(proj, entry)) ] data = [] for ref in dirs: toAdd = { "commit": git.getCommitDetails(proj, ref), "build": compile.getStatus(proj, ref) } if ((proj, ref) in compile.q): toAdd["build"]["status"] = "queued" data.append(toAdd) return json.dumps({ "list": data, "language": getConfig(proj).get("language", None), "id": git.repos[proj]["github"], "latest": parseRef(proj, "latest") }), { "Content-Type": "application/json" } else: return json.dumps({ "list": [], "language": None, "latest": "" }), { "Content-Type": "application/json" }
def get_latest_svg(proj): return mySendFile(getBuildPath(proj, parseRef(proj, "latest")) + "/.status.svg", mimetype="image/svg+xml")
def get_build_zip(proj, ref): return mySendFile(getBuildPath(proj, parseRef(proj, ref)) + "/output.zip", mimetype="application/zip")
def get_build_pdf(proj, ref): return mySendFile(getBuildPath(proj, parseRef(proj, ref)) + "/main.pdf", mimetype="application/pdf", content_disposition='inline; filename=' + proj + '.pdf')
def get_build_svg(proj, ref): return mySendFile(getBuildPath(proj, parseRef(proj, ref)) + "/.status.svg", mimetype="image/svg+xml")
def get_build_log(proj, ref): return mySendFile(getBuildPath(proj, parseRef(proj, ref)) + "/.log", mimetype="text/plain")
def get_build_details(proj, ref): return send_file(compile.getStatus(proj, parseRef(proj, ref), True), mimetype="application/json")