Files
onepilot/selfdrive/version.py
Vehicle Researcher e4ba9edefa openpilot v0.4.4 release
old-commit-hash: 9a9ff839a9b70cb2601d7696af743f5652395389
2018-04-14 06:10:58 +00:00

19 lines
670 B
Python

import os
import subprocess
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "common", "version.h")) as _versionf:
version = _versionf.read().split('"')[1]
try:
origin = subprocess.check_output(["git", "config", "--get", "remote.origin.url"])
if origin.startswith('git@github.com:commaai'):
if origin.endswith('/one.git'):
dirty = True
else:
branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).rstrip()
branch = 'origin/' + branch
dirty = subprocess.call(["git", "diff-index", "--quiet", branch, "--"]) != 0
else:
dirty = True
except subprocess.CalledProcessError:
dirty = True