include git hash in version info

This commit is contained in:
Damien Elmes 2018-12-13 20:59:06 +10:00
parent 30f19c07be
commit 053b286398
4 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@
aqt/forms
locale
tools/runanki.system
aqt/buildhash.py

View file

@ -4,7 +4,7 @@
from aqt.qt import *
import aqt.forms
from aqt import appVersion
from aqt.utils import versionWithBuild
class ClosableQDialog(QDialog):
def reject(self):
@ -29,7 +29,7 @@ def show(mw):
system. It's free and open source.")
abouttext += "<p>"+_("Anki is licensed under the AGPL3 license. Please see "
"the license file in the source distribution for more information.")
abouttext += '<p>' + _("Version %s") % appVersion + '<br>'
abouttext += '<p>' + _("Version %s") % versionWithBuild() + '<br>'
abouttext += ("Qt %s PyQt %s<br>") % (QT_VERSION_STR, PYQT_VERSION_STR)
abouttext += (_("<a href='%s'>Visit website</a>") % aqt.appWebsite) + \
"</span>"

View file

@ -134,7 +134,7 @@ add-ons section</a> of our support site.
def _supportText(self):
import platform
from aqt import appVersion
from aqt.utils import versionWithBuild
if isWin:
platname = "Windows " + platform.win32_ver()[0]
@ -153,5 +153,5 @@ add-ons section</a> of our support site.
Anki {} Python {} Qt {} PyQt {}
Platform: {}
Flags: frz={} ao={} sv={}
""".format(appVersion, platform.python_version(), QT_VERSION_STR, PYQT_VERSION_STR, platname,
""".format(versionWithBuild(), platform.python_version(), QT_VERSION_STR, PYQT_VERSION_STR, platname,
getattr(sys, "frozen", False), self.mw.addonManager.dirty, schedVer())

View file

@ -523,3 +523,12 @@ class MenuItem:
a = qmenu.addAction(self.title)
a.triggered.connect(self.func)
######################################################################
def versionWithBuild():
from aqt import appVersion
try:
from aqt.buildhash import build
except:
build = "dev"
return "%s (%s)" % (appVersion, build)