From b23be9c896abb60599f9f731acd5bc42d3a8f8d3 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 12:40:57 -0500 Subject: [PATCH 1/9] Started to remove stable and snapshot update information files --- updates/stable.json | 6 ------ updates/{snapshots.json => updates.json} | 0 2 files changed, 6 deletions(-) delete mode 100644 updates/stable.json rename updates/{snapshots.json => updates.json} (100%) diff --git a/updates/stable.json b/updates/stable.json deleted file mode 100644 index ef63523b..00000000 --- a/updates/stable.json +++ /dev/null @@ -1,6 +0,0 @@ -{"current_version": "0.95", -"description": "The first version for the new generation of TWBlue.", -"date": "day_name_abr month day_numb, 2016", -"downloads": -{"Windows32": "http://twblue.es/pubs/twblue_ngen_0.80_x86.zip", -"Windows64": "http://twblue.es/pubs/twblue_ngen_0.80_x64.zip"}} \ No newline at end of file diff --git a/updates/snapshots.json b/updates/updates.json similarity index 100% rename from updates/snapshots.json rename to updates/updates.json From daac312658378cd1bc0e1b2a4b3bb6ded88cdbe3 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 12:43:03 -0500 Subject: [PATCH 2/9] Removes snapshot information from app info --- src/application.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/application.py b/src/application.py index 64d123da..f2f3b370 100644 --- a/src/application.py +++ b/src/application.py @@ -3,15 +3,9 @@ import datetime name = 'TWBlue' short_name='twblue' -snapshot = True -if snapshot == False: - version = "0.95" - update_url = 'https://twblue.es/updates/stable.php' - mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/stable.json' -else: - version = "11" - update_url = 'https://twblue.es/updates/snapshot.php' - mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/snapshots.json' +version = "11" +update_url = 'https://twblue.es/updates/updates.php' +mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/updates.json' authors = ["Manuel Cortéz", "José Manuel Delicado"] authorEmail = "manuel@manuelcortez.net" copyright = "Copyright (C) 2013-2021, Manuel cortéz." From 2b059ee42e7a7ea8b9f7d724c23652bb1cbd1ef6 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:02:24 -0500 Subject: [PATCH 3/9] Modified Nsis scripts to remove references to old snapshots code --- scripts/twblue.nsi | 14 +++--- scripts/twblue_snapshot.nsi | 95 ------------------------------------- 2 files changed, 7 insertions(+), 102 deletions(-) delete mode 100644 scripts/twblue_snapshot.nsi diff --git a/scripts/twblue.nsi b/scripts/twblue.nsi index f83fe05b..b1d35335 100644 --- a/scripts/twblue.nsi +++ b/scripts/twblue.nsi @@ -15,10 +15,10 @@ SetCompressor /solid lzma SetDatablockOptimize on VIAddVersionKey ProductName "TWBlue" VIAddVersionKey LegalCopyright "Copyright 2014-2021 Manuel Cortéz." -VIAddVersionKey ProductVersion "0.95" -VIAddVersionKey FileVersion "0.95" -VIProductVersion "0.95.0.0" -VIFileVersion "0.95.0.0" +VIAddVersionKey ProductVersion "11" +VIAddVersionKey FileVersion "11" +VIProductVersion "11.0.0.0" +VIFileVersion "11.0.0.0" !insertmacro MUI_PAGE_WELCOME !define MUI_LICENSEPAGE_RADIOBUTTONS !insertmacro MUI_PAGE_LICENSE "license.txt" @@ -72,10 +72,10 @@ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "D WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortéz" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "0.95" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "URLInfoAbout" "http://twblue.es" +WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "11" +WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "URLInfoAbout" "https://twblue.es" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMajor" 0 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMinor" 95 +WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMinor" 0 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "NoRepair" 1 SectionEnd diff --git a/scripts/twblue_snapshot.nsi b/scripts/twblue_snapshot.nsi deleted file mode 100644 index f7d20764..00000000 --- a/scripts/twblue_snapshot.nsi +++ /dev/null @@ -1,95 +0,0 @@ -!include "MUI2.nsh" -!include "LogicLib.nsh" -!include "x64.nsh" -Unicode true -CRCCheck on -ManifestSupportedOS all -XPStyle on -Name "TWBlue" -OutFile "TWBlue_snapshot_setup.exe" -InstallDir "$PROGRAMFILES\twblue" -InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "InstallLocation" -RequestExecutionLevel admin -SetCompress auto -SetCompressor /solid lzma -SetDatablockOptimize on -VIAddVersionKey ProductName "TWBlue Snapshot version" -VIAddVersionKey LegalCopyright "Copyright 2014-2021 Manuel Cortéz." -VIAddVersionKey ProductVersion "11" -VIAddVersionKey FileVersion "11" -VIProductVersion "11.0.0.0" -VIFileVersion "11.0.0.0" -!insertmacro MUI_PAGE_WELCOME -!define MUI_LICENSEPAGE_RADIOBUTTONS -!insertmacro MUI_PAGE_LICENSE "license.txt" -!insertmacro MUI_PAGE_DIRECTORY -var StartMenuFolder -!insertmacro MUI_PAGE_STARTMENU startmenu $StartMenuFolder -!insertmacro MUI_PAGE_INSTFILES -!define MUI_FINISHPAGE_LINK "Visit TWBlue website" -!define MUI_FINISHPAGE_LINK_LOCATION "https://twblue.es" -!define MUI_FINISHPAGE_RUN "$INSTDIR\TWBlue.exe" -!insertmacro MUI_PAGE_FINISH -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES - !insertmacro MUI_LANGUAGE "English" -!insertmacro MUI_LANGUAGE "French" -!insertmacro MUI_LANGUAGE "Spanish" -!insertmacro MUI_LANGUAGE "Italian" -!insertmacro MUI_LANGUAGE "Finnish" -!insertmacro MUI_LANGUAGE "Russian" -!insertmacro MUI_LANGUAGE "PortugueseBR" -!insertmacro MUI_LANGUAGE "Polish" -!insertmacro MUI_LANGUAGE "German" -!insertmacro MUI_LANGUAGE "Hungarian" -!insertmacro MUI_LANGUAGE "Turkish" -!insertmacro MUI_LANGUAGE "Arabic" -!insertmacro MUI_LANGUAGE "Galician" -!insertmacro MUI_LANGUAGE "Catalan" -!insertmacro MUI_LANGUAGE "Basque" -!insertmacro MUI_LANGUAGE "Croatian" -!insertmacro MUI_LANGUAGE "Japanese" -!insertmacro MUI_LANGUAGE "SerbianLatin" -!insertmacro MUI_LANGUAGE "Romanian" -!insertmacro MUI_RESERVEFILE_LANGDLL -Section -SetShellVarContext All -SetOutPath "$INSTDIR" -${If} ${RunningX64} -File /r TWBlue64\* -${Else} -File /r TWBlue\* -${EndIf} -CreateShortCut "$DESKTOP\TWBlue.lnk" "$INSTDIR\TWBlue.exe" -!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu -CreateDirectory "$SMPROGRAMS\$StartMenuFolder" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\TWBlue.lnk" "$INSTDIR\TWBlue.exe" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\TWBlue on the web.lnk" "http://twblue.es" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" -!insertmacro MUI_STARTMENU_WRITE_END -WriteUninstaller "$INSTDIR\Uninstall.exe" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayName" "TWBlue" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "UninstallString" '"$INSTDIR\uninstall.exe"' -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortéz" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "11" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "URLInfoAbout" "https://twblue.es" -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMajor" 0 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMinor" 0 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "NoModify" 1 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "NoRepair" 1 -SectionEnd -Section "Uninstall" -SetShellVarContext All -DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" -RMDir /r /REBOOTOK $INSTDIR -Delete "$DESKTOP\TWBlue.lnk" -!insertmacro MUI_STARTMENU_GETFOLDER startmenu $StartMenuFolder -RMDir /r "$SMPROGRAMS\$StartMenuFolder" -SectionEnd -Function .onInit -${If} ${RunningX64} -StrCpy $instdir "$programfiles64\twblue" -${EndIf} -!insertmacro MUI_LANGDLL_DISPLAY -FunctionEnd From d222740887a5c69708c3545aed845b2ab259fe6c Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:04:49 -0500 Subject: [PATCH 4/9] Updated gitlab CI --- .gitlab-ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8f377e5a..06567285 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ stages: - make_installer - upload -snapshot32: +twblue32: tags: - shared-windows - windows @@ -21,7 +21,6 @@ snapshot32: - '&$env:PYTHON -V' - '&$env:PYTHON -m pip install --upgrade pip' - '&$env:PYTHON -m pip install --upgrade -r requirements.txt' - - '&$env:PYTHON -m pip uninstall enum34 -y' stage: build interruptible: true script: @@ -37,7 +36,7 @@ snapshot32: - '&$env:PYTHON make_archive.py' - cd .. - mv src/dist artifacts/TWBlue - - move src/twblue.zip artifacts/twblue_snapshot_x86.zip + - move src/twblue.zip artifacts/twblue_x86.zip only: - tags artifacts: @@ -45,7 +44,7 @@ snapshot32: - artifacts expire_in: 1 day -snapshot64: +twblue64: tags: - shared-windows - windows @@ -73,7 +72,7 @@ snapshot64: - '&$env:PYTHON make_archive.py' - cd .. - mv src/dist artifacts/TWBlue64 - - move src/twblue.zip artifacts/twblue_snapshot_x64.zip + - move src/twblue.zip artifacts/twblue_x64.zip only: - tags artifacts: @@ -96,8 +95,8 @@ generate_versions: - move artifacts/TWBlue scripts/ - move artifacts/TWBlue64 scripts/ - cd scripts - - '&$env:NSIS twblue_snapshot.nsi' - - move twblue_snapshot_setup.exe ../artifacts + - '&$env:NSIS twblue.nsi' + - move twblue_setup.exe ../artifacts only: - tags artifacts: From 72e6d030d51d0f3bf10633e03bfcc0e3cae0c21c Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:10:57 -0500 Subject: [PATCH 5/9] Updater no longer will try to compare float numbers for updates --- src/update/update.py | 5 ++--- src/update/updater.py | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/update/update.py b/src/update/update.py index 64bfd7de..7f1b7cf2 100644 --- a/src/update/update.py +++ b/src/update/update.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from logging import getLogger logger = getLogger('update') @@ -24,8 +23,8 @@ def perform_update(endpoint, current_version, app_name='', password=None, update if not available_update: logger.debug("No update available") return False - available_version = float(available_update['current_version']) - if not float(available_version) > float(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']: + available_version = available_update['current_version'] + if available_version == current_version or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']: logger.debug("No update for this architecture") return False available_description = available_update.get('description', None) diff --git a/src/update/updater.py b/src/update/updater.py index 2bef784b..5214c1de 100644 --- a/src/update/updater.py +++ b/src/update/updater.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import unicode_literals import application from . import update import platform From a82efd4dccc25fc2ca445593c3c3de1c0bca2e75 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:16:31 -0500 Subject: [PATCH 6/9] Fixed a typo --- src/update/update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/update/update.py b/src/update/update.py index 7f1b7cf2..d6b47f5c 100644 --- a/src/update/update.py +++ b/src/update/update.py @@ -41,10 +41,10 @@ def perform_update(endpoint, current_version, app_name='', password=None, update downloaded = download_update(update_url, download_path, requests_session=requests_session, progress_callback=progress_callback) extracted = extract_update(downloaded, update_path, password=password) bootstrap_path = move_bootstrap(extracted) - execute_bootstrap(bootstrap_path, extracted) - logger.info("Update prepared for installation.") if callable(update_complete_callback): update_complete_callback() + execute_bootstrap(bootstrap_path, extracted) + logger.info("Update prepared for installation.") def create_requests_session(app_name=None, version=None): user_agent = '' From cb1312d0c935d518132e5b30038251adb7786189 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:38:21 -0500 Subject: [PATCH 7/9] Changed version in installer so it will be easier to replace it later by the authomatic script --- scripts/twblue.nsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/twblue.nsi b/scripts/twblue.nsi index b1d35335..a2789cef 100644 --- a/scripts/twblue.nsi +++ b/scripts/twblue.nsi @@ -15,10 +15,10 @@ SetCompressor /solid lzma SetDatablockOptimize on VIAddVersionKey ProductName "TWBlue" VIAddVersionKey LegalCopyright "Copyright 2014-2021 Manuel Cortéz." -VIAddVersionKey ProductVersion "11" -VIAddVersionKey FileVersion "11" -VIProductVersion "11.0.0.0" -VIFileVersion "11.0.0.0" +VIAddVersionKey ProductVersion "0.95" +VIAddVersionKey FileVersion "0.95" +VIProductVersion "0.95" +VIFileVersion "0.95" !insertmacro MUI_PAGE_WELCOME !define MUI_LICENSEPAGE_RADIOBUTTONS !insertmacro MUI_PAGE_LICENSE "license.txt" @@ -72,7 +72,7 @@ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "D WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortéz" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "11" +WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "0.95" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "URLInfoAbout" "https://twblue.es" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMajor" 0 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMinor" 0 From 9f48784ce453f2673faf55c818eb891bb7634724 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:39:50 -0500 Subject: [PATCH 8/9] Added script to add next version in application.py and installer generation files --- src/write_version_data.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/write_version_data.py diff --git a/src/write_version_data.py b/src/write_version_data.py new file mode 100644 index 00000000..b13675b3 --- /dev/null +++ b/src/write_version_data.py @@ -0,0 +1,29 @@ +#! /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.""" +import requests +from codecs import open + +print("Writing version data for update...") +commit_info = requests.get("https://gitlab.com/api/v4/projects/23482196/repository/commits/next-gen") +commit_info = commit_info.json() +commit = commit_info["short_id"] +print("Got new version info: {commit}".format(commit=commit,)) +file = open("application.py", "r", encoding="utf-8") +lines = file.readlines() +lines[-1] = 'version = "{}"'.format(commit_info["created_at"][:10].replace("-", ".")) +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() +contents = contents.replace("0.95", commit_info["created_at"][:10].replace("-", ".")) +file.close() +file2 = open("..\\scripts\\twblue.nsi", "w", encoding="utf-8") +file2.write(contents) +file2.close() +print("done") From f7f303929ef09a6f29458989e625c89032c22935 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 26 Oct 2021 13:41:22 -0500 Subject: [PATCH 9/9] Updated CI config --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06567285..25061019 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,7 @@ twblue32: - '&$env:PYTHON documentation_importer.py' - cd ..\src - '&$env:PYTHON ..\doc\generator.py' + - '&$env:PYTHON write_version_data.py' - '&$env:PYTHON setup.py build' - cd .. - mkdir artifacts @@ -65,6 +66,7 @@ twblue64: - '&$env:PYTHON documentation_importer.py' - cd ..\src - '&$env:PYTHON ..\doc\generator.py' + - '&$env:PYTHON write_version_data.py' - '&$env:PYTHON setup.py build' - cd .. - mkdir artifacts