fontgoggles icon indicating copy to clipboard operation
fontgoggles copied to clipboard

Integrate nvupdate as update checker

Open twardoch opened this issue 5 years ago • 2 comments

This package https://github.com/lilydjwg/nvchecker#check-github seems to offer update checking from a variety of services, including Github releases :)

twardoch avatar Mar 31 '20 16:03 twardoch

It seems that https://github.com/sparkle-project/Sparkle is the get-go for auto-updating macOS applications these days, no idea if it works with Python applications, but I’m leaving it here for future reference.

khaledhosny avatar Jun 13 '20 04:06 khaledhosny

A more low-tech solution could be something like this (suggested by @typemytype)

# https://docs.github.com/en/rest/reference/repos#releases

repo = "justvanrossum/fontgoggles"
repo = "typemytype/drawbot"
url = f"https://api.github.com/repos/{repo}/releases"

import AppKit
import urllib.request
import ssl
import json 

context = ssl._create_unverified_context()

releases = []
with urllib.request.urlopen(url, context=context) as url:
    releases = json.loads(url.read().decode())

currentVersion = AppKit.NSBundle.mainBundle().objectForInfoDictionaryKey_("CFBundleShortVersionString")
print(currentVersion)
currentVersion = "3.125"
if releases:
    release = releases[0]
    if release["tag_name"] > currentVersion:
        assetsURL = release["assets_url"]
        assets = []
        with urllib.request.urlopen(assetsURL, context=context) as url:
            assets = json.loads(url.read().decode())

        if assets:
            downloadURL = assets[0].get("browser_download_url")
            print(release.get("body", ""))
            print(downloadURL)

justvanrossum avatar Feb 14 '21 09:02 justvanrossum