From a625c056cd0fbbb209c22ef16d092c9f3ecc3474 Mon Sep 17 00:00:00 2001 From: CorwinAnsley Date: Thu, 5 Sep 2024 12:34:59 +0100 Subject: [PATCH] updated version updating to work from different path --- artifice/update_version_number.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/artifice/update_version_number.py b/artifice/update_version_number.py index e4cf27a..847ee42 100644 --- a/artifice/update_version_number.py +++ b/artifice/update_version_number.py @@ -1,10 +1,12 @@ 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) @@ -12,23 +14,23 @@ def update_version_number(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):