1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 03:14:38 +00:00

Various README updates (#671)

* Update README

* Add shields.io badges in the README

* Add a mention about shiftability in README

* Fix shield json command in JenkinsFile

* Improve progress badge formatting

Now it should show the percentage as 51.2% instead of 51.17%, and 100% instead of 100.00%
This commit is contained in:
Roman971 2021-02-11 13:10:05 +01:00 committed by GitHub
parent ec31611c0e
commit f95a5aec68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 36 deletions

View file

@ -1,16 +1,16 @@
#!/usr/bin/env python3
import argparse
import json
import csv
import git
import os
import re
parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.")
parser.add_argument("format", nargs="?", default="text", choices=["text", "csv", "shield-json"])
parser.add_argument("-m", "--matching", dest='matching', action='store_true',
help="Output matching progress instead of decompilation progress")
parser.add_argument("-c", "--csv", dest="csv", action="store_true",
help="Output results in CSV format")
args = parser.parse_args()
NON_MATCHING_PATTERN = r"#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif"
@ -114,14 +114,22 @@ ovlPct = 100 * ovl / ovlSize
compiled_bytes = total
bytesPerHeartPiece = compiled_bytes / 80
if args.csv:
if args.format == 'csv':
version = 1
git_object = git.Repo().head.object
timestamp = str(git_object.committed_date)
git_hash = git_object.hexsha
csv_list = [str(version), timestamp, git_hash, str(code), str(codeSize), str(boot), str(bootSize), str(ovl), str(ovlSize), str(src), str(asm), str(len(nonMatchingFunctions))]
print(",".join(csv_list))
else:
elif args.format == 'shield-json':
# https://shields.io/endpoint
print(json.dumps({
"schemaVersion": 1,
"label": "progress",
"message": f"{srcPct:.3g}%",
"color": 'yellow',
}))
elif args.format == 'text':
adjective = "decompiled" if not args.matching else "matched"
print(str(total) + " total bytes of decompilable code\n")
@ -138,3 +146,5 @@ else:
print("You have " + str(heartPieces) + "/80 heart pieces and " + str(rupees) + " rupee(s).\n")
else:
print("You have " + str(heartPieces) + "/80 heart pieces.\n")
else:
print("Unknown format argument: " + args.format)