[RESOLVED] Zulip Desktop Client Package

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
vnatton
Messages: 6
Registration: January 9, 2024 - 1:53 PM

February 26, 2024 - 2:56 PM

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
    
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 29, 2024 - 09:46

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
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
italbot
Messages: 61
Registration: Sep 26, 2023 - 3:50 p.m.

March 7, 2024 - 10:55

Hello,

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

Sincerely,

Ingrid
Tranquil IT
Locked