diff --git a/EDMC.py b/EDMC.py
index d4aaf37d..a1b32a47 100755
--- a/EDMC.py
+++ b/EDMC.py
@@ -145,9 +145,9 @@ def main():
updater = Updater(provider='internal')
newversion: Optional[EDMCVersion] = updater.check_appcast()
if newversion:
- print(f'{appversion} ({newversion.title!r} is available)')
+ print(f'{appversion()} ({newversion.title!r} is available)')
else:
- print(appversion)
+ print(appversion())
return
@@ -160,7 +160,7 @@ def main():
sys.exit(EXIT_ARGS)
edmclogger.set_channels_loglevel(args.loglevel)
- logger.debug(f'Startup v{appversion} : Running on Python v{sys.version}')
+ logger.debug(f'Startup v{appversion()} : Running on Python v{sys.version}')
logger.debug(f'''Platform: {sys.platform}
argv[0]: {sys.argv[0]}
exec_prefix: {sys.exec_prefix}
diff --git a/EDMarketConnector.py b/EDMarketConnector.py
index 8c595ba0..5161f574 100755
--- a/EDMarketConnector.py
+++ b/EDMarketConnector.py
@@ -1147,11 +1147,11 @@ class AppWindow(object):
# version
ttk.Label(frame).grid(row=row, column=0) # spacer
row += 1
- self.appversion_label = tk.Label(frame, text=appversion)
+ self.appversion_label = tk.Label(frame, text=appversion())
self.appversion_label.grid(row=row, column=0, sticky=tk.E)
self.appversion = HyperlinkLabel(frame, compound=tk.RIGHT, text=_('Release Notes'),
url='https://github.com/EDCD/EDMarketConnector/releases/tag/Release/'
- f'{appversion_nobuild}',
+ f'{appversion_nobuild()}',
underline=True)
self.appversion.grid(row=row, column=2, sticky=tk.W)
row += 1
@@ -1180,7 +1180,7 @@ class AppWindow(object):
self.protocol("WM_DELETE_WINDOW", self._destroy)
############################################################
- logger.info(f'Current version is {appversion}')
+ logger.info(f'Current version is {appversion()}')
def apply(self) -> None:
"""Close the window."""
@@ -1395,7 +1395,7 @@ def show_killswitch_poppup(root=None):
# Run the app
if __name__ == "__main__": # noqa: C901
- logger.info(f'Startup v{appversion} : Running on Python v{sys.version}')
+ logger.info(f'Startup v{appversion()} : Running on Python v{sys.version}')
logger.debug(f'''Platform: {sys.platform} {sys.platform == "win32" and sys.getwindowsversion()}
argv[0]: {sys.argv[0]}
exec_prefix: {sys.exec_prefix}
@@ -1493,7 +1493,7 @@ sys.path: {sys.path}'''
# abinit = A.B()
# Plain, not via `logger`
- print(f'{applongname} {appversion}')
+ print(f'{applongname} {appversion()}')
Translations.install(config.get_str('language')) # Can generate errors so wait til log set up
diff --git a/companion.py b/companion.py
index beb0b69e..d9972743 100644
--- a/companion.py
+++ b/companion.py
@@ -55,7 +55,7 @@ SERVER_AUTH = 'https://auth.frontierstore.net'
URL_AUTH = '/auth'
URL_TOKEN = '/token'
-USER_AGENT = f'EDCD-{appname}-{appversion}'
+USER_AGENT = f'EDCD-{appname}-{appversion()}'
SERVER_LIVE = 'https://companion.orerve.net'
SERVER_BETA = 'https://pts-companion.orerve.net'
diff --git a/killswitch.py b/killswitch.py
index 84dfd048..cb75c2cf 100644
--- a/killswitch.py
+++ b/killswitch.py
@@ -11,7 +11,7 @@ logger = EDMCLogging.get_main_logger()
DEFAULT_KILLSWITCH_URL = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/killswitches.json'
-_current_version: semantic_version.Version = semantic_version.Version(config.appversion)
+_current_version: semantic_version.Version = semantic_version.Version(config.appversion_nobuild())
class KillSwitch(NamedTuple):
diff --git a/plugins/eddn.py b/plugins/eddn.py
index 6806355c..14dd407e 100644
--- a/plugins/eddn.py
+++ b/plugins/eddn.py
@@ -20,7 +20,7 @@ import killswitch
import myNotebook as nb # noqa: N813
import plug
from companion import CAPIData, category_map
-from config import applongname, appversion, config
+from config import applongname, appversion_nobuild, config
from EDMCLogging import get_main_logger
from myNotebook import Frame
from prefs import prefsVersion
@@ -141,7 +141,7 @@ class EDDN:
('$schemaRef', msg['$schemaRef']),
('header', OrderedDict([
('softwareName', f'{applongname} [{system() if sys.platform != "darwin" else "Mac OS"}]'),
- ('softwareVersion', appversion),
+ ('softwareVersion', appversion_nobuild()),
('uploaderID', uploader_id),
])),
('message', msg['message']),
diff --git a/plugins/edsm.py b/plugins/edsm.py
index fc46a5a3..e61fa5ab 100644
--- a/plugins/edsm.py
+++ b/plugins/edsm.py
@@ -573,7 +573,7 @@ def worker() -> None:
'commanderName': username.encode('utf-8'),
'apiKey': apikey,
'fromSoftware': applongname,
- 'fromSoftwareVersion': appversion,
+ 'fromSoftwareVersion': appversion(),
'message': json.dumps(pending, ensure_ascii=False).encode('utf-8'),
}
diff --git a/plugins/inara.py b/plugins/inara.py
index 292d59b3..c7333b0a 100644
--- a/plugins/inara.py
+++ b/plugins/inara.py
@@ -1222,7 +1222,7 @@ def new_worker():
data = {
'header': {
'appName': applongname,
- 'appVersion': appversion,
+ 'appVersion': appversion(),
'APIkey': creds.api_key,
'commanderName': creds.cmdr,
'commanderFrontierID': creds.fid
diff --git a/prefs.py b/prefs.py
index 99d441ab..81c850c8 100644
--- a/prefs.py
+++ b/prefs.py
@@ -14,7 +14,7 @@ from typing import TYPE_CHECKING, Any, Callable, Optional, Type, Union
import myNotebook as nb # noqa: N813
import plug
-from config import applongname, appversion, config
+from config import applongname, appversion_nobuild, config
from EDMCLogging import edmclogger, get_main_logger
from hotkey import hotkeymgr
from l10n import Translations
@@ -1122,7 +1122,7 @@ class PreferencesDialog(tk.Toplevel):
def apply(self) -> None:
"""Update the config with the options set on the dialog."""
- config.set('PrefsVersion', prefsVersion.stringToSerial(appversion))
+ config.set('PrefsVersion', prefsVersion.stringToSerial(appversion_nobuild()))
config.set(
'output',
(self.out_td.get() and config.OUT_MKT_TD) +
diff --git a/setup.py b/setup.py
index c5066624..9cd8721d 100755
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,8 @@ from typing import Any, Generator, Set
import semantic_version
from config import (
- appcmdname, applongname, appname, appversion, copyright, git_shorthash_from_head, update_feed, update_interval
+ appcmdname, applongname, appname, appversion, appversion_nobuild, copyright, git_shorthash_from_head, update_feed,
+ update_interval
)
from constants import GITVERSION_FILE
@@ -52,7 +53,7 @@ else:
assert False, f'Unsupported platform {sys.platform}'
# Split version, as py2exe wants the 'base' for version
-semver = semantic_version.Version.coerce(appversion)
+semver = semantic_version.Version.coerce(appversion())
base_appversion = str(semver.truncate('patch'))
if dist_dir and len(dist_dir) > 1 and isdir(dist_dir):
@@ -89,7 +90,6 @@ if sys.platform == 'darwin':
APP = 'EDMarketConnector.py'
APPCMD = 'EDMC.py'
-SHORTappversion = ''.join(appversion.split('.')[:3])
PLUGINS = [
'plugins/coriolis.py',
'plugins/eddb.py',
@@ -154,8 +154,8 @@ if sys.platform == 'darwin':
'CFBundleName': applongname,
'CFBundleIdentifier': f'uk.org.marginal.{appname.lower()}',
'CFBundleLocalizations': get_cfbundle_localizations(),
- 'CFBundleShortVersionString': appversion,
- 'CFBundleVersion': appversion,
+ 'CFBundleShortVersionString': appversion(),
+ 'CFBundleVersion': appversion(),
'CFBundleURLTypes': [
{
'CFBundleTypeRole': 'Viewer',
@@ -228,7 +228,7 @@ elif sys.platform == 'win32':
setup(
name=applongname,
- version=appversion,
+ version=appversion(),
windows=[
{
'dest_base': appname,
@@ -237,7 +237,7 @@ setup(
'company_name': 'EDCD', # Used by WinSparkle
'product_name': appname, # Used by WinSparkle
'version': base_appversion,
- 'product_version': appversion,
+ 'product_version': appversion(),
'copyright': copyright,
'other_resources': [(24, 1, open(f'{appname}.manifest').read())],
}
@@ -249,7 +249,7 @@ setup(
'company_name': 'EDCD',
'product_name': appname,
'version': base_appversion,
- 'product_version': appversion,
+ 'product_version': appversion(),
'copyright': copyright,
'other_resources': [(24, 1, open(f'{appcmdname}.manifest').read())],
}
@@ -279,7 +279,7 @@ if sys.platform == 'darwin':
os.system(f'codesign --deep -v -s "Developer ID Application: {macdeveloperid}" {dist_dir}/{appname}.app')
# Make zip for distribution, preserving signature
- package_filename = f'{appname}_mac_{appversion}.zip'
+ package_filename = f'{appname}_mac_{appversion_nobuild()}.zip'
os.system(f'cd {dist_dir}; ditto -ck --keepParent --sequesterRsrc {appname}.app ../{package_filename}; cd ..')
elif sys.platform == 'win32':
@@ -288,7 +288,7 @@ elif sys.platform == 'win32':
if not exists(f'{dist_dir}/{appname}.wixobj'):
raise AssertionError(f'No {dist_dir}/{appname}.wixobj: candle.exe failed?')
- package_filename = f'{appname}_win_{appversion}.msi'
+ package_filename = f'{appname}_win_{appversion_nobuild()}.msi'
os.system(rf'"{WIXPATH}\light.exe" -sacl -spdb -sw1076 {dist_dir}\{appname}.wixobj -out {package_filename}')
if not exists(package_filename):
diff --git a/td.py b/td.py
index 799d68ec..f38a828f 100644
--- a/td.py
+++ b/td.py
@@ -34,7 +34,7 @@ def export(data):
'#\n# - \n\n'
'@ {system}/{starport}\n'.format(
appname=applongname,
- appversion=appversion,
+ appversion=appversion(),
platform=platform == 'darwin' and "Mac OS" or system(),
cmdr=data['commander']['name'].strip(),
system=data['lastSystem']['name'].strip(),
diff --git a/update.py b/update.py
index de7eb8cd..e71f39b9 100644
--- a/update.py
+++ b/update.py
@@ -9,7 +9,8 @@ if TYPE_CHECKING:
import tkinter as tk
# ensure registry is set up on Windows before we start
-from config import appname, appversion, appversion_nobuild, config, update_feed
+from config import appname, appversion_nobuild, config, update_feed
+
class EDMCVersion(object):
"""
@@ -29,6 +30,7 @@ class EDMCVersion(object):
self.title: str = title
self.sv: semantic_version.base.Version = sv
+
class Updater(object):
"""
Updater class to handle checking for updates, whether using internal code
@@ -79,7 +81,7 @@ class Updater(object):
# NB: It 'accidentally' supports pre-release due to how it
# splits and compares strings:
#
- self.updater.win_sparkle_set_app_build_version(appversion_nobuild)
+ self.updater.win_sparkle_set_app_build_version(appversion_nobuild())
# set up shutdown callback
global root
@@ -175,7 +177,7 @@ class Updater(object):
)
# Look for any remaining version greater than appversion
- simple_spec = semantic_version.SimpleSpec('>' + appversion)
+ simple_spec = semantic_version.SimpleSpec('>' + appversion_nobuild())
newversion = simple_spec.select(items.keys())
if newversion: