fix old git compatibility issue

This commit is contained in:
Hristo
2024-01-28 15:20:27 +02:00
committed by Masoko
parent 3ac098de69
commit 2fe744e644

View File

@@ -145,8 +145,12 @@ def get_manufacturer():
def check_git_update():
script_dir = os.path.dirname(os.path.realpath(__file__))
full_cmd = "git -C {} remote update && git -C {} status -uno".format(script_dir, script_dir)
git_update = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode("utf-8")
if 'Your branch is up to date' in git_update:
try:
git_update = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode("utf-8")
except subprocess.CalledProcessError as e:
print("Error updating git repository:", e.output)
if any(s in git_update for s in ('Your branch is up to date', 'Your branch is up-to-date')):
git_update = 'off'
else:
git_update = 'on'