fix(update message): multiple fixes
- added GitPython as a dependency - use git describe to find the branch version - prevent version popup for prereleases - check for update weekly instead of daily - fixed bug in check for update which used to compare minor version even if there was a mismatch in comparing major versions Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
parent
b848c9dfc7
commit
be8f37dc5b
3 changed files with 13 additions and 4 deletions
|
|
@ -154,7 +154,6 @@ scheduler_events = {
|
|||
"frappe.email.doctype.auto_email_report.auto_email_report.send_daily",
|
||||
"frappe.core.doctype.feedback_request.feedback_request.delete_feedback_request",
|
||||
"frappe.core.doctype.activity_log.activity_log.clear_authentication_logs",
|
||||
"frappe.utils.change_log.check_for_update"
|
||||
],
|
||||
"daily_long": [
|
||||
"frappe.integrations.doctype.dropbox_settings.dropbox_settings.take_backups_daily",
|
||||
|
|
@ -162,7 +161,8 @@ scheduler_events = {
|
|||
],
|
||||
"weekly_long": [
|
||||
"frappe.integrations.doctype.dropbox_settings.dropbox_settings.take_backups_weekly",
|
||||
"frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_weekly"
|
||||
"frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_weekly",
|
||||
"frappe.utils.change_log.check_for_update"
|
||||
],
|
||||
"monthly": [
|
||||
"frappe.email.doctype.auto_email_report.auto_email_report.send_monthly"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import frappe
|
|||
from frappe.utils import cstr
|
||||
import requests
|
||||
from frappe import _
|
||||
import git
|
||||
|
||||
def get_change_log(user=None):
|
||||
if not user: user = frappe.session.user
|
||||
|
|
@ -101,7 +102,12 @@ def get_versions():
|
|||
}
|
||||
|
||||
if versions[app]['branch'] != 'master':
|
||||
branch_version = app_hooks.get('{0}_version'.format(versions[app]['branch']))
|
||||
try:
|
||||
app_repo = git.Repo(os.path.join('..', 'apps', '{}'.format(app)))
|
||||
branch_version = '-'.join(app_repo.git.describe().split('-')[:2])
|
||||
branch_version = [branch_version.strip('v')]
|
||||
except:
|
||||
branch_version = app_hooks.get('{0}_version'.format(versions[app]['branch']))
|
||||
if branch_version:
|
||||
versions[app]['branch_version'] = branch_version[0] + ' ({0})'.format(get_app_last_commit_ref(app))
|
||||
|
||||
|
|
@ -137,7 +143,7 @@ def check_for_update():
|
|||
|
||||
github_version, org_name = app_details
|
||||
# Get local instance's current version or the app
|
||||
instance_version = Version(apps[app]['version'])
|
||||
instance_version = Version(apps[app]['branch_version'].split(' ')[0])
|
||||
# Compare and popup update message
|
||||
for update_type in updates:
|
||||
if github_version.__dict__[update_type] > instance_version.__dict__[update_type]:
|
||||
|
|
@ -149,6 +155,7 @@ def check_for_update():
|
|||
title = apps[app]['title'],
|
||||
))
|
||||
break
|
||||
if github_version.__dict__[update_type] < instance_version.__dict__[update_type]: break
|
||||
|
||||
add_message_to_redis(updates)
|
||||
|
||||
|
|
@ -196,6 +203,7 @@ def show_update_popup():
|
|||
return
|
||||
|
||||
updates = json.loads(update_info)
|
||||
current_versions = get_versions()
|
||||
|
||||
# Check if user is int the set of users to send update message to
|
||||
update_message = ""
|
||||
|
|
|
|||
|
|
@ -50,3 +50,4 @@ premailer
|
|||
croniter
|
||||
googlemaps
|
||||
urllib3==1.23
|
||||
GitPython==2.1.11
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue