Page 1 of 1

[RESOLVED] Zulip Desktop Client Package

Published: February 26, 2024 - 2:56 PM
by vnatton
Hi everyone
A small piece of code to clean up for the installation and update of the Zulip Desktop Client for Windows 64-bit

Good day
Vianney

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

def install():
    bin = "Zulip-%s-x64.msi" % control.get_software_version()
    install_msi_if_needed(bin)

    pass

def update_package():
    import json

    ancienne_version = control.get_software_version()

    # Declaring local variables
    package_updated = False

    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    api_url = "https://api.github.com/repos/zulip/zulip-desktop/releases/latest"


    # Getting latest version information from official sources
    print("API used is: %s" % api_url)
    json_load = json.loads(wgets(api_url, proxies=proxies))

    for download in json_load["assets"]:
        if "zulip-desktop" in download["browser_download_url"] and "-x64.msi" in download["browser_download_url"]:
            download_url = download["browser_download_url"]
            version = json_load["tag_name"].replace("v", "")
            latest_bin = download["name"]
            break

    # Downloading latest binaries
    print("Latest %s version is: %s" % (control.name, version))
    print("Download URL is: %s" % download_url)

    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)
    else:
        print("Binary is present: %s" % latest_bin)

    # Checking version from filename
    version_from_filename = latest_bin.split("-")[1]

    if Version(version_from_filename) != Version(version) and version_from_filename != "":
        print("Changing version to the version number of the binary")
        os.rename(latest_bin, latest_bin.replace(version, version_from_filename))
        version = version_from_filename
    else:
        print("Binary file version corresponds to online version")

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        package_updated = True
    else:
        print("Software version up-to-date (%s)" % Version(version))

    control.set_software_version(version)
    control.save_control_to_wapt()

    # Suppression de l'ancien binaire
    if isfile("Zulip-%s-x64.msi" % ancienne_version):
        os.remove("Zulip-%s-x64.msi" % ancienne_version)

    # Validating update-package-sources
    return package_updated
    

Re: Zulip Desktop Client Package

Published: February 29, 2024 - 09:46
by dcardon
Hi Vianney,

thanks a lot for the package. Ingrid will take a look at it to see if she can integrate it into the store. It looks like a pretty good tool; we'll test it internally. :-)

Best regards,

Denis

Re: [RESOLVED] Zulip Desktop Client Package

Published: March 7, 2024 - 10:55 AM
by italbot
Hello,

The package is ready, you'll find it in the store in a few days. :)

Sincerely,

Ingrid