[RESOLVED] Screenpresso 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
elelay
Messages: 27
Registration: Oct 20, 2020 - 12:39

July 6, 2021 - 10:49

Good morning,

I'm trying to develop a package for the Screenpresso software. Thanks to version 2.0, it's much simpler! And yet...

The installation went smoothly, I never had any problems.
However, for uninstallation, if I understand correctly, it is wapt that is responsible for generating the uninstall() function from the uninstallation key.
The one retrieved is the correct one, and testing the package locally on the console makes it work.
However, an error is returned after execution, and therefore the package fails.

Execution in VSCode:

Code: Select all

Removing D:\waptdev\sdis85-screenpresso-wapt ...

L'opération a réussi.
2021-07-06 10:29:05,991 CRITICAL Critical error during uninstall: CalledProcessErrorOutput: Command '"C:\\Program Files\\Learnpulse\\Screenpresso\\Screenpresso.exe" deploy --programfiles --quiet --uninstall' returned non-zero exit status 11.
Output:
No package removed !
=== Error removing packages ===
Installation using the console:

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1961, in run
    self.running_task.run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 649, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1214, in _run
    self.result = self.wapt.remove(self.packagenames,
  File "C:\Program Files (x86)\wapt\common.py", line 5324, in remove
    print((self.run(uninstall_cmd)))
  File "C:\Program Files (x86)\wapt\common.py", line 3705, in run
    return ensure_unicode(setuphelpers.run(*arg, **args))
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 4029, in run
    raise CalledProcessErrorOutput(proc.returncode, cmd, ''.join(output))
waptutils.CalledProcessErrorOutput: Command '"C:\\Program Files\\Learnpulse\\Screenpresso\\Screenpresso.exe" deploy --programfiles --quiet --uninstall' returned non-zero exit status 4294967295.

Wouldn't it be possible to avoid this? Error code 11 During the uninstallation? Since the uninstallation itself goes very well, it's just the package that fails.

THANKS.
Last edited by elelay on 07 Jul 2021 - 09:16, edited 1 time.
WAPT Server version: 2.0 Enterprise
Console installed on a Windows Server 2019
Debian 10 Buster server
elelay
Messages: 27
Registration: Oct 20, 2020 - 12:39

July 7, 2021 - 09:14

My mistake, the uninstallation command returned isn't silent. A pop-up appears, hence the error.
You need to add `--quiet`.
WAPT Server version: 2.0 Enterprise
Console installed on a Windows Server 2019
Debian 10 Buster server
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 7, 2021 - 10:25

Thanks for the feedback, elelay!
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
elelay
Messages: 27
Registration: Oct 20, 2020 - 12:39

July 8, 2021 - 11:06 PM

Hello again,

For your information, the --quiet is indeed returned by the register and the previously mentioned error is still relevant.
To counter this problem, I used an MSI file.

For those who are interested, here is the final code with the update function (update_package).

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from pkg_resources import parse_version
from bs4 import BeautifulSoup

# declaring global variables - warnings: 1) wapt context is only available in package functions; 2) global variables are not persistent between calls
uninstallkey = '{517a11fb-eba6-4afe-b7a1-96a0c8b51e01}'


def install():
    # declaring local variables

    ScreenpressoPath = f'{programfiles64}\\Learnpulse\\Screenpresso'
    package_version = control.get_software_version()

    # installing the package
    print("Installing Screenpresso...")
    install_msi_if_needed('ScreenpressoSetup.msi', min_version=package_version)
    create_desktop_shortcut(r'Screenpresso', f'{ScreenpressoPath}\\Screenpresso.exe')
    print("Added a desktop icon")

def uninstall():
    print("Uninstalling Screenpresso...")
    
    # Get the uninstall key from registry (returned as an array)
    uninstall_exec = ' '.join([values for values in uninstall_cmd(uninstallkey)])
    run(uninstall_exec)
    remove_desktop_shortcut(r'Screenpresso')
    print("Removed desktop shortcut")


def update_package():
    package_version = control.get_software_version()
    filenamex64 = "ScreenpressoSetup.msi"
    proxies = {}
    if isfile(makepath(application_data(), 'waptconsole', 'waptconsole.ini')):
        proxywapt = inifile_readstring(makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini'), 'global', 'http_proxy')
        if proxywapt:
            proxies = {'http': proxywapt, 'https': proxywapt}

    # Url to scrape to get the different versions
    url = "https://www.screenpresso.com/fr/versions/"
    url64 = "https://www.screenpresso.com/binaries/releases/stable/dotnet47/ScreenpressoSetup.msi"

    html_code = wgets(url)
    soup = BeautifulSoup(html_code, features='html.parser')
    versions = []
    
    # Gathering all Screenpresso versions
    for a in soup.find_all('a', {'class': 'header'}):
        versions.append(a.get_text().split(' ')[1].strip())

    # During the request,' Screenpresso' is returned two times so the latest version is the 3rd element of the array: ['Screenpresso', 'Screenpresso', '1.10.1', '...']
    latest_version = versions[2]

    if parse_version(package_version) < parse_version(latest_version):
        print(f'Found a more recent versions {latest_version} > {package_version}')

        # Delete old binary
        print('Delete ' + filenamex64)
        remove_file(filenamex64)
    
    else:
    	print('You have the latest version :)')
    
    # Download new binary
    if not isfile(filenamex64):
        print('Download ' + url64)
        wget(url64, filenamex64, proxies=proxies)

    # Modifying version in control file
    from waptpackage import PackageEntry
    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())
    pe.version = latest_version + '-0'
    pe.save_control_to_wapt(os.getcwd())


if __name__ == '__main__':
    update_package()
Please feel free to send me your feedback.

Sincerely,

Étienne.
WAPT Server version: 2.0 Enterprise
Console installed on a Windows Server 2019
Debian 10 Buster server
Locked