2021-10-26 13:39:50 -05:00
|
|
|
#! /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 updates.
|
|
|
|
This file is not intended to be called by the user. It will be used only by the Gitlab CI runner."""
|
2021-10-28 12:44:50 -05:00
|
|
|
import os
|
2021-10-26 13:39:50 -05:00
|
|
|
from codecs import open
|
|
|
|
|
|
|
|
print("Writing version data for update...")
|
2023-12-31 00:42:47 -06:00
|
|
|
new_version = os.environ.get("GITHUB_REF_NAME")[1:]
|
2021-10-26 13:39:50 -05:00
|
|
|
file = open("application.py", "r", encoding="utf-8")
|
|
|
|
lines = file.readlines()
|
2023-12-30 09:40:19 -06:00
|
|
|
lines[-1] = 'version = "{}"'.format(new_version)
|
2021-10-26 13:39:50 -05:00
|
|
|
file.close()
|
|
|
|
file2 = open("application.py", "w", encoding="utf-8")
|
|
|
|
file2.writelines(lines)
|
|
|
|
file2.close()
|
|
|
|
print("Wrote application.py with the new version info.")
|
|
|
|
|
|
|
|
print("Updating next version on installer setup...")
|
|
|
|
file = open("..\\scripts\\twblue.nsi", "r", encoding="utf-8")
|
|
|
|
contents = file.read()
|
2023-12-30 09:40:19 -06:00
|
|
|
contents = contents.replace("0.95", new_version)
|
2021-10-26 13:39:50 -05:00
|
|
|
file.close()
|
|
|
|
file2 = open("..\\scripts\\twblue.nsi", "w", encoding="utf-8")
|
|
|
|
file2.write(contents)
|
|
|
|
file2.close()
|
|
|
|
print("done")
|