Page 1 of 1

[SOLVED] Overloading the remove() function

Published: June 14, 2024 - 11:37
by sebastien4444
Good morning,

I created a package for installing Office 2019 via the officedeploymenttool and I am providing the uninstallation key in the parameters of the install_exe_if_needed() function.
The installation is OK, but when I run a remove command to uninstall, I get the following error:

Code: Select all

Command Line : remove "C:\waptdev\pilote-regtest_1.0_x64_Windows_PROD-wapt\WAPT\.."
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Removing C:\waptdev\pilote-regtest_1.0_x64_Windows_PROD-wapt\WAPT\.. ...
2024-06-14 11:19:04,815 CRITICAL Critical error during uninstall: CalledProcessErrorOutput: Command ['"C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\OfficeClickToRun.exe" scenario=install scenariosubtype=ARP sourcetype=None productstoremove=Standard2019Volume.16_fr-fr_x-none culture=fr-fr version.16=16.0'] returned non-zero exit status 1.
Output:La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.
My first question is therefore: what exactly does this message mean? :?:

So, as a workaround, I created an uninstall.xml config file which allows the uninstallation of my version of Office, and during the installation, I will copy this file and the necessary setup.exe into an Office directory.
My idea is to override the remove() function to make it execute "setup.exe /configure uninstall.xml".
But here too I encounter a problem: I don't feel that my override is working when I run the config remove since I get the same error as above.

Here is my setup.py:

Code: Select all

from setuphelpers import *

def install():

    uninstall_key = "Standard2019Volume - fr-fr"
    office_path = makepath("C:","Program Files","Microsoft Office")
    office_uninstall_path = makepath("C:","Program Files","Microsoft Office","Uninstall")

    print("Debut")

    install_exe_if_needed("setup.exe", silentflags="/configure Install.xml", key=uninstall_key, timeout=None, min_version='')

    print('Install ok')

    mkdirs(office_uninstall_path)
    filecopyto("setup.exe",office_uninstall_path)
    filecopyto("Uninstall.xml",office_uninstall_path)

    print("Répertoire et fichiers desinstallation OK")

def remove():
    office_uninstall_path_setup = makepath("C:","Program Files","Microsoft Office","Uninstall","setup.exe")
    office_uninstall_path_config = makepath("C:","Program Files","Microsoft Office","Uninstall","Uninstall.xml")

    print('Debut uninstall')
    run(office_uninstall_path_setup + ' /configure ' + office_uninstall_path_config)

    print('uninstall OK')

Re: Overloading the remove() function

Published: June 14, 2024 - 12:45
by sfonteneau
Good morning

Since you left the key, Wapt is trying to uninstall it

Add the following to the end of your `def install()`:

Code: Select all

def install(): 
    ...
    uninstallkey.clear()
to tell Wapt not to try to uninstall automatically.