Centralize version string getting. Still trying to work out how we should handle automatic version increments so we don't have to modify files all the time. Remove version file from repo (should only be a thing when building binaries)

This commit is contained in:
blitzmann
2018-02-17 11:10:42 -05:00
parent e779bb84e2
commit 82e3db1ffb
6 changed files with 16 additions and 13 deletions

1
.gitignore vendored
View File

@@ -119,3 +119,4 @@ ENV/
eos.iml
gitversion
.version
/.version

View File

@@ -1 +0,0 @@
v1.2.3-221-g50dd74db

View File

@@ -20,8 +20,8 @@ debug = False
saveInRoot = False
# Version data
version = "1.35.0"
tag = "Stable"
version = "2.0.x"
tag = "git"
expansionName = "YC120.2"
expansionVersion = "1.1"
evemonMinVersion = "4081"
@@ -64,10 +64,13 @@ def getPyfaRoot():
return root
def getGitVersion():
with open(os.path.join(pyfaPath, '.version')) as f:
version = f.readline()
return version
def getVersion():
if os.path.isfile(os.path.join(pyfaPath, '.version')):
with open(os.path.join(pyfaPath, '.version')) as f:
gitVersion = f.readline()
return gitVersion
# if no version file exists, then user is running from source or not an official build
return version + " (git)"
def getDefaultSave():

View File

@@ -359,7 +359,7 @@ class MainFrame(wx.Frame):
def ShowAboutBox(self, evt):
info = wx.adv.AboutDialogInfo()
info.Name = "pyfa"
info.Version = config.getGitVersion() # gui.aboutData.versionString
info.Version = config.getVersion() # gui.aboutData.versionString
#
# try:
# import matplotlib

View File

@@ -95,10 +95,6 @@ if __name__ == "__main__":
if options.rootsavedata is True:
config.saveInRoot = True
# set title if it wasn't supplied by argument
if options.title is None:
options.title = "pyfa %s%s - Python Fitting Assistant" % (config.version, "" if config.tag.lower() != 'git' else " (git)")
config.debug = options.debug
config.loggingLevel = config.LOGLEVEL_MAP.get(options.logginglevel.lower(), config.LOGLEVEL_MAP['error'])
config.defPaths(options.savepath)
@@ -131,6 +127,10 @@ if __name__ == "__main__":
from gui.mainFrame import MainFrame
# set title if it wasn't supplied by argument
if options.title is None:
options.title = "pyfa %s - Python Fitting Assistant" % (config.getVersion())
pyfa = wx.App(False)
mf = MainFrame(options.title)
ErrorHandler.SetParent(mf)

View File

@@ -99,7 +99,7 @@ class APIConnection(object):
if additional_headers is None:
additional_headers = {}
if user_agent is None:
user_agent = "pyfa/{0} ({1})".format(config.version, config.tag)
user_agent = "pyfa/{0}".format(config.getVersion)
session.headers.update({
"User-Agent": user_agent,
"Accept": "application/json",