show launcher ver. & git ver.

This commit is contained in:
hi80482 2020-07-11 15:53:24 +08:00 committed by GitHub
parent 0ecdfe608c
commit a7cca05c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,14 @@ import config
LauncherLoc = "/home/cpi/launcher" LauncherLoc = "/home/cpi/launcher"
# get git short hash
cur_dir = os.getcwd()
os.chdir(LauncherLoc)
current_git_version = get_git_revision_short_hash()
current_git_version = current_git_version.strip("\n")
current_git_version = current_git_version.strip("\t")
os.chdir(cur_dir)
class UpdateDownloadPage(DownloadProcessPage): class UpdateDownloadPage(DownloadProcessPage):
_MD5 = "" _MD5 = ""
@ -206,6 +214,12 @@ class UpdatePage(Page):
it["value"] = config.VERSION it["value"] = config.VERSION
self._AList["version"] = it self._AList["version"] = it
git = {}
git["key"] = "githash"
git["label"] = "Git Hash"
git["value"] = current_git_version
self._AList["githash"] = git
self.GenList() self.GenList()
def CheckUpdate(self): def CheckUpdate(self):
@ -238,12 +252,12 @@ class UpdatePage(Page):
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
elif "gitversion" in json_: ### just use git to run update elif "gitversion" in json_: ### just use git to run update
cur_dir = os.getcwd() # cur_dir = os.getcwd()
os.chdir(LauncherLoc) # os.chdir(LauncherLoc)
current_git_version = get_git_revision_short_hash() # current_git_version = get_git_revision_short_hash()
current_git_version = current_git_version.strip("\n") # current_git_version = current_git_version.strip("\n")
current_git_version = current_git_version.strip("\t") # current_git_version = current_git_version.strip("\t")
os.chdir(cur_dir) # os.chdir(cur_dir)
if current_git_version != json_["gitversion"]: if current_git_version != json_["gitversion"]:
self._ConfirmPage._URL = None self._ConfirmPage._URL = None
self._ConfirmPage._MD5 = None self._ConfirmPage._MD5 = None
@ -255,7 +269,7 @@ class UpdatePage(Page):
self._Screen.Draw() self._Screen.Draw()
if "version" in json_: if "version" in json_:
self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % json_["version"] ) self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % (json_["version"] + "#" + json_["gitversion"]) )
else: else:
self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] ) self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] )
self._Screen.SwapAndShow() self._Screen.SwapAndShow()