mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 21:56:07 -04:00
Merge pull request #408 from manuelcortez/calendar_versioning
Switch to Calendar versioning
This commit is contained in:
@@ -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."
|
||||
|
@@ -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)
|
||||
@@ -42,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 = ''
|
||||
|
@@ -1,6 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
import application
|
||||
from . import update
|
||||
import platform
|
||||
|
29
src/write_version_data.py
Normal file
29
src/write_version_data.py
Normal file
@@ -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")
|
Reference in New Issue
Block a user