Skip to content

Commit

Permalink
updated version updating to work from different path
Browse files Browse the repository at this point in the history
  • Loading branch information
CorwinAnsley committed Sep 5, 2024
1 parent af54d7b commit a625c05
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions artifice/update_version_number.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
import sys

BASE_PATH = 'artifice/'

def update_version_number(version_number, application_name):
print(application_name)
if application_name == 'piranhaGUI':
# Updating version number in consts file, for displaying the correct version number in artifice itself, and checking for updates
replace_line(f'artifice_core/consts.py','PIRANHA_GUI_VERSION =',f"PIRANHA_GUI_VERSION = '{version_number}'",encoding='utf8')
replace_line(f'{BASE_PATH}artifice_core/consts.py','PIRANHA_GUI_VERSION =',f"PIRANHA_GUI_VERSION = '{version_number}'",encoding='utf8')

update_linux_version_number(version_number, application_name)
update_mac_version_number(version_number, application_name)
update_windows_version(version_number,application_name)

def update_linux_version_number(version_number, application_name):
# Updating for the title of the package file
with open('linux_build/version_number', 'w') as f:
with open(f'{BASE_PATH}linux_build/version_number', 'w') as f:
f.write(f'#!/bin/bash \n\nVERSION_NUMBER={version_number}')

# Updating the Debian package control file
replace_line(f'linux_build/linux_dist_files/{application_name}/control','Version:',f'Version: {version_number}')
replace_line(f'{BASE_PATH}linux_build/linux_dist_files/{application_name}/control','Version:',f'Version: {version_number}')

def update_mac_version_number(version_number, application_name):
# Updating the pyinstaller
replace_line(f'mac_build/pyinstaller_build/{application_name}.spec', ' name=',
replace_line(f'{BASE_PATH}mac_build/pyinstaller_build/{application_name}.spec', ' name=',
[f" name='{application_name}v{version_number}',",
" name='artifice',",
f" name='{application_name}v{version_number}.app',"])

def update_windows_version(version_number, application_name):
# Updating the InnoSetup .iss file
replace_line(f'windows_build\dist\{application_name}_installer.iss','AppVersion=',f'AppVersion={version_number}')
replace_line(f'windows_build\dist\{application_name}_installer.iss','OutputBaseFilename=',f'OutputBaseFilename={application_name}v{version_number}_installer_windows')
replace_line(f'{BASE_PATH}windows_build\dist\{application_name}_installer.iss','AppVersion=',f'AppVersion={version_number}')
replace_line(f'{BASE_PATH}windows_build\dist\{application_name}_installer.iss','OutputBaseFilename=',f'OutputBaseFilename={application_name}v{version_number}_installer_windows')

# helper function to replace lines
def replace_line(filepath, search_string, replace_strings, encoding=None):
Expand Down

0 comments on commit a625c05

Please sign in to comment.