mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-07-26 11:52:04 +08:00
2f60026c22
* Add tinygrad ref testing * BaseDir and give a fake ref id to test * one more before the real thing * Add the correct ref * test * Update test_tinygrad_ref.py * Update tinygrad_ref * Update test_tinygrad_ref.py * Update tinygrad_ref * This SHOULD FAIL * Revert "This SHOULD FAIL" This reverts commit 58862f8a730c34c1407386f729067b0c564e910b. * bit of red * Move ref to models so compiled branches can read it * step one * step 2 * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update tinygrad_ref.py * Update build-all-tinygrad-models.yaml * bump to fail test * Revert "bump to fail test" This reverts commit 4f58991f32036ac55564470f1fdaa50492578f15. * pytest should take care of it * lint --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
37 lines
835 B
Python
37 lines
835 B
Python
import os
|
|
|
|
from openpilot.common.basedir import BASEDIR
|
|
|
|
|
|
def get_tinygrad_ref():
|
|
repo_path = os.path.join(BASEDIR, "tinygrad_repo")
|
|
git_path = os.path.join(repo_path, ".git")
|
|
try:
|
|
if os.path.isdir(git_path):
|
|
git_dir = git_path
|
|
else:
|
|
with open(git_path) as f:
|
|
line = f.read().strip()
|
|
git_dir = os.path.join(repo_path, line[8:])
|
|
with open(os.path.join(git_dir, "HEAD")) as f:
|
|
ref = f.read().strip()
|
|
if ref.startswith("ref:"):
|
|
with open(os.path.join(git_dir, ref.split(" ", 1)[1])) as f:
|
|
return f.read().strip()
|
|
return ref
|
|
except Exception as e:
|
|
print(f"Error getting tinygrad_repo ref: {e}")
|
|
return None
|
|
|
|
|
|
def main():
|
|
current_ref = get_tinygrad_ref()
|
|
if current_ref:
|
|
print(current_ref)
|
|
else:
|
|
print("")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|