Generate version at build time
This commit is contained in:
parent
a1b29005bb
commit
b286e526cc
@ -13,4 +13,3 @@ bts_access_token = "fe3j2ijirvevv9"
|
|||||||
bts_url = "https://issues.manuelcortez.net"
|
bts_url = "https://issues.manuelcortez.net"
|
||||||
update_url = "https://files.mcvsoftware.com/music_dl/update/latest.json"
|
update_url = "https://files.mcvsoftware.com/music_dl/update/latest.json"
|
||||||
version = "2020.07.23"
|
version = "2020.07.23"
|
||||||
update_next_version = "14775226"
|
|
||||||
|
@ -13,7 +13,7 @@ def do_update(update_type="alpha"):
|
|||||||
if hasattr(sys, "frozen") == False:
|
if hasattr(sys, "frozen") == False:
|
||||||
return
|
return
|
||||||
endpoint = application.update_url
|
endpoint = application.update_url
|
||||||
version = application.update_next_version
|
version = application.version
|
||||||
try:
|
try:
|
||||||
return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_type=update_type, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_type=update_type, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/env python# -*- coding: iso-8859-1 -*-
|
#! /usr/bin/env python# -*- coding: iso-8859-1 -*-
|
||||||
""" Write version info (taken from the last commit) to application.py. This method has been implemented this way for running the alpha channel updates.
|
""" Write version info (taken from the last commit) to application.py. This method has been implemented this way for running the alpha channel updates.
|
||||||
This file is not intended to be called by the user. It will be used only by the Gitlab CI runner."""
|
This file is not intended to be called by the user. It will be used only by the Gitlab CI runner."""
|
||||||
|
import datetime
|
||||||
import requests
|
import requests
|
||||||
from codecs import open
|
from codecs import open
|
||||||
|
|
||||||
@ -11,8 +12,8 @@ commit = commit_info["short_id"]
|
|||||||
print("Got new version info: {commit}".format(commit=commit,))
|
print("Got new version info: {commit}".format(commit=commit,))
|
||||||
file = open("application.py", "r", encoding="utf-8")
|
file = open("application.py", "r", encoding="utf-8")
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
lines[-2] = 'version = "{}"\n'.format(commit_info["created_at"][:10].replace("-", "."))
|
version = datetime.datetime.now().strftime("%Y.%m.%d")
|
||||||
lines[-1] = 'update_next_version = "{commit}"'.format(commit=commit,)
|
lines[-1] = 'version = "{}"\n'.format(version)
|
||||||
file.close()
|
file.close()
|
||||||
file2 = open("application.py", "w", encoding="utf-8")
|
file2 = open("application.py", "w", encoding="utf-8")
|
||||||
file2.writelines(lines)
|
file2.writelines(lines)
|
||||||
@ -22,7 +23,7 @@ print("Wrote application.py with the new version info.")
|
|||||||
print("Updating next version on installer setup...")
|
print("Updating next version on installer setup...")
|
||||||
file = open("installer.nsi", "r", encoding="utf-8")
|
file = open("installer.nsi", "r", encoding="utf-8")
|
||||||
contents = file.read()
|
contents = file.read()
|
||||||
contents = contents.replace("0.7", commit_info["created_at"][:10].replace("-", "."))
|
contents = contents.replace("0.7", version)
|
||||||
file.close()
|
file.close()
|
||||||
file2 = open("installer.nsi", "w", encoding="utf-8")
|
file2 = open("installer.nsi", "w", encoding="utf-8")
|
||||||
file2.write(contents)
|
file2.write(contents)
|
||||||
|
Loading…
Reference in New Issue
Block a user