Single source the package version

Define one place to store the Manuskript version so that it can be
used in multiple locations.

Reference:

Single-sourcing the package version
https://packaging.python.org/guides/single-sourcing-package-version/
This commit is contained in:
Curtis Gedak 2017-09-28 13:26:04 -06:00
parent e971d7e167
commit 5d462d6a47
2 changed files with 12 additions and 4 deletions

View file

@ -9,8 +9,7 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, qApp
from manuskript.functions import appPath, writablePath
_version = "0.4.0"
from manuskript.version import getVersion
faulthandler.enable()
@ -20,9 +19,9 @@ def run():
app.setOrganizationName("manuskript")
app.setOrganizationDomain("www.theologeek.ch")
app.setApplicationName("manuskript")
app.setApplicationVersion(_version)
app.setApplicationVersion(getVersion())
print("Running manuskript version {}.".format(_version))
print("Running manuskript version {}.".format(getVersion()))
icon = QIcon()
for i in [16, 32, 64, 128, 256, 512]:
icon.addFile(appPath("icons/Manuskript/icon-{}px.png".format(i)))

9
manuskript/version.py Normal file
View file

@ -0,0 +1,9 @@
# --!-- coding: utf8 --!--
# Single source the package version
# https://packaging.python.org/guides/single-sourcing-package-version/
__version__ = "0.4.0"
def getVersion():
return __version__