PSIM Trial 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
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

June 21, 2023 - 10:24

Good morning,
I'm trying to create a package for the PSIM 2021B demo. The uninstallation key is indeed in the registry, but it's located in HKEY_CURRENT_USER:

Code: Select all

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\6305213B-44F4-476B-85A0-EB506EDB8E01_is1
The installation works by leaving "Key" blank in install_exe_if_needed, but for uninstallation I cannot use uninstall_cmd()This indicates
"FATAL ERROR: 2: The key Software\Microsoft\Windows\CurrentVersion\Uninstall\['6305213B-44F4-476B-85A0-EB506EDB8E01_is1'] can not be opened"
Is there another way to use this key to uninstall? Or is it necessary to use the command `run(r'%s /verysilent' % uninstall_string)`?

Here is the code for my setup.py:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
setup_binary_name = glob.glob("PSIM*.exe")[0]
app_name  = "_".join(setup_binary_name.split("_")[:2])
app_dir = makepath('C:\Powersim')
app_dir_binaries = makepath(app_dir,"_".join(setup_binary_name.split("_")[:3]))
binary_name = "PSIM.exe"
kill_list = [binary_name]
shortcutsdir = makepath(common_desktop(),'Logiciels','Elec - Automatisme')
uninstallkey_psim = ['6305213B-44F4-476B-85A0-EB506EDB8E01_is1']
uninstall_string = r'%s\unins000.exe' %app_dir_binaries

def install():
    print(r'Suppression des anciens PSIM')
    run_notfatal(r'C:\Powersim\PSIM11.1.1_Demo\unins000.exe /verysilent')
    run_notfatal(r'MsiExec.exe /qn /X{D46F2B61-FEE0-46AF-B57F-0EF74F0ECC98}')
    if isfile(makepath(shortcutsdir,'PSIM.lnk')):
        remove_file(makepath(shortcutsdir,'PSIM.lnk'))
        
    print(r'Installation de %s' % app_name)
    killalltasks(kill_list)
    install_exe_if_needed(setup_binary_name,
        silentflags='/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',
        key='',
        min_version='2021b'
    )

    print(r'Création du raccourci %s dans %s' %(app_name,shortcutsdir))
    if not isdir(shortcutsdir):
        mkdirs(shortcutsdir)
    create_shortcut(makepath(shortcutsdir,'%s.lnk' %app_name), target=makepath(app_dir_binaries,binary_name))
    remove_desktop_shortcut('PSIM License Monitor')
    remove_desktop_shortcut(app_name)

def uninstall():
    print(r"Desinstallation de %s" %app_name)
    killalltasks(kill_list)
    ##uninstall_cmd(uninstallkey_psim)
    run_notfatal(r'%s /verysilent' % uninstall_string)
    if  isfile(makepath(shortcutsdir,'%s.lnk' %app_name)):
        remove_file(makepath(shortcutsdir,'%s.lnk' %app_name))
    if isdir(app_dir):
        remove_tree(app_dir)

def audit():
    if isfile(makepath(app_dir_binaries,binary_name)):
        return("OK")
    else:
        return("Erreur : %s est introuvable !" %binary_name)
         

And secondly, without the "audit()" function, or with a simple return("OK"), I always get an error: "Audit aborted due to exception: list index out of range"
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

June 26, 2023 - 11:20

Hi Gaël,

the uninstall_key variable allows you to override the uninstallation key the software provides, but it doesn't write it to the registry.

So there aren't many other ways to do it than what you've described for the uninstallation process.

Since the key isn't registered in the correct location in the registry, I think it would be even better not to specify `uninstall_key` at all. Otherwise, the `def audit()` function will try to search for it in the registry (this is the default behavior if no audit function is defined in the package). This must be generating the error message you're getting, which isn't pretty and which we'll fix.

If the software is trying to create the key in HKCU, it's because it thinks it's installing in the user environment. We should check if there's a flag to force a system-wide installation. And if not, contact the developer to see if they can fix the way their software works. Otherwise, you can put this software in the "podoware" category (software developed with their feet :-) ).

Sincerely,

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
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

June 26, 2023 - 7:24 PM

Thanks to Jimmy and Morgan who debugged this package for me this afternoon. This podoware installs and no longer returns errors on the console, that's enough for me ;)

Code: Select all

setup_binary_name = glob.glob("PSIM*.exe")[0]
has been replaced by

Code: Select all

setup_binary_name = 'PSIM_2021b_Demo_64bit_Setup.exe'
The version and timeout have been modified in the install_exe_if_needed command:

Code: Select all

install_exe_if_needed(setup_binary_name,
        silentflags='/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',
        key='',
        min_version='',
        timeout=900
    )

Code: Select all

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

setup_binary_name = 'PSIM_2021b_Demo_64bit_Setup.exe'
app_name  = "_".join(setup_binary_name.split("_")[:2])
app_dir = makepath('C:\Powersim')
app_dir_binaries = makepath(app_dir,"_".join(setup_binary_name.split("_")[:3]))
binary_name = "PSIM.exe"
kill_list = [binary_name]
uninstallkey_psim = ['F8C0340D-A8CE-4B15-96C0-D3F6A564A9DF_is1']
uninstall_string = r'%s\unins000.exe' %app_dir_binaries

def install():
    if isfile(makepath(shortcutsdir,'PSIM.lnk')):
        remove_file(makepath(shortcutsdir,'PSIM.lnk'))
    print(r'Installation de %s' % app_name)
    killalltasks(kill_list)

    install_exe_if_needed(setup_binary_name,
        silentflags='/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',
        key='',
        min_version='',
        timeout=900
    )

def uninstall():
    print(r"Desinstallation de %s" %app_name)
    killalltasks(kill_list)
    run_notfatal(r'%s /verysilent' % uninstall_string)
    if isdir(app_dir):
        remove_tree(app_dir)
User avatar
vcardon
WAPT Expert
Messages: 278
Registration: Oct 06, 2017 - 10:55 p.m.
Location: Nantes, France

June 26, 2023 - 10:44 PM

I like your use of the word "podoware," we invented it :)
Vincent CARDON
Tranquil IT
Locked