As part of a larger program, I am using git to check the program itself for updates. Of course, the user will need git installed to do so. I've created a small bit of python3 code to check if the user has git installed, but it does not seem to work:
import linecache
import time
import os
git = linecache.getline('info.txt', 2)
if git == 'no':
git-ask=input('Is Git Installed? <y/n>\n')
if git-ask == 'n':
print('Installing Git.')
os.system('apt-get install git-core')
elif git-ask == 'y':
print("Checking For Updates...")
elif git == "yes":
print("Checking For Updates...")
else:
print("Error: 'GitInfoError'")
print("Please Contact Eden About This Error: EdenC@dev-hq.net")
time.sleep(5)
print("Skipping Updates...")
The program always reverts to else clause, which should NEVER happen! Here is the contents of info.txt:
GIT:
no
REBOOT:
no
Thanks For Any Advice You Can Offer!