Simple *.exe package

Note

Variation compared to MSI

WAPT prefers MSI installers because most *.exe are not standardized and silent arguments can be different from one piece of software to to another.

Hint

Since WAPT version 1.3.12, a new method for quickly building WAPT packages from the WAPT console has been made available.

This part of the documentation os still actual, we recommend however that you use the WAPT console to instanciate your package templates, see Creating a package template from the WAPT console.

Créer un template de base de paquet à partir de l’EXE

capture d'écran du lancement de l'invite de commande Windows en tant qu'Administrateur Local

Launching the Windows Command Line utility as Local Administrator

  • create a WAPT package Template;

    wapt-get make-template <chemin_exe> <nom_du_paquet>
    

    Example with Mozilla Firefox ESR:

    wapt-get make-template "Firefox Setup 52.6.0esr.exe" "tis-firefox-esr"
    
    Template created. You can build the WAPT package by launching
      C:\Program Files (x86)\wapt\wapt-get.exe build-package C:\waptdev\tis-firefox-esr-wapt
    You can build and upload the WAPT package by launching
      C:\Program Files (x86)\wapt\wapt-get.exe build-upload C:\waptdev\tis-firefox-esr-wapt
    

    PyScripter loads up and opens open the *.exe package project.

    capture d'écran de Pyscripter affichant le fichier "control"

    Pyscripter opening with focus on the control file

Vérifier le fichier control

Mozilla Firefox-ESR doesn’t comply to industry standards and returns an erroneous version number (it appears to be the installer packaging software version number).

Original control file

package           : tis-firefox-esr
version           : 4.42.0.0-0
architecture      : all
section           : base
priority          : optional
maintainer        : user
description       : automatic package for firefox setup 52.6.0esr

Modified control file

package           : tis-firefox-esr
version           : 52.6.0-1
architecture      : all
section           : base
priority          : optional
maintainer        : Tranquil-IT Systems
description       : Mozilla Firefox 52.6.0 ESR

Note

It is to be noted that a sub-version -1 has been added. It is the packaging version of WAPT package.

It allows the Package Developer to release several WAPT package versions of the same software.

Vérifier le fichier setup.py

WAPT has added a generic silent /VERYSILENT flag that may or may not work with Mozilla Firefox ESR.

In that case, we will replace the suggested silent flag with the one that we found in the Mozilla documentation:

  • make changes to the code in the setup.py file accordingly;

    :emphasize-lines: 8
    # -*- coding: utf-8 -*-
    from setuphelpers import *
    
    uninstallkey = []
    
    def install():
        print('installing tis-firefox-esr')
        run(r'"Firefox Setup 52.6.0esr.exe" -ms')
    
  • save the package;

Managing the uninstallation

With an exe installer, the uninstall key is not available until the software has been installed once.

The uninstall key is available in the Windows registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  • open a Windows Command Line cmd.exe prompt;
  • retrieve the software uninstall key;
wapt-get list-registry firefox
UninstallKey                          Software                               Version            Uninstallstring
------------------------------------- -------------------------------------- ------------------ ------------------------------------------------------
Mozilla Firefox 52.6.0 ESR (x64 fr)   Mozilla Firefox 52.6.0 ESR (x64 fr)    52.6.0             "C:\Program Files\Mozilla Firefox\uninstall\helper.exe
  • copier la clé de désinstallation UninstallKey : Mozilla Firefox 52.6.0 ESR (x64 fr) ;
  • make changes to the setup.py file with the correct uninstall key;
:emphasize-lines: 4

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

uninstallkey = ['Mozilla Firefox 52.6.0 ESR (x64 fr)']

def install():
    print('installing tis-firefox-esr')
    run(r'"Firefox Setup 52.6.0esr.exe" -ms')

Note

La clef UninstallKey doit être reportée à l’identique de celle qui est affichée par la commande list-registry. Cette string peut être un GUID comme par exemple 95160000-0052-040C-0000-0000000FF1CE, un GUID avec accolade, {95160000-0052-040C-0000-0000000FF1CE}, ou tout simplement une chaîne de caractères, comme Git_is1 ou Mozilla Firefox 52.6.0 ESR (x64 fr).

  • relaunch the package setup to set the correct uninstall key in the local WAPT database;

  • test uninstalling the package;

  • launch a remove from PyScripter Run Configurations;

    capture d'écran montrant la commande de désinstallation

    After uninstallation, the software is correctly uninstalled.

    We can notice the correct uninstallation by launching again the wapt-get list-registry command.

    UninstallKey          Software          Version            Uninstallstring
    --------------------- ----------------- ------------------ ---------------
    --------------------- ----------------- ------------------ ---------------
    

Specific case of a non-silent uninstaller

It sometimes occurs that the software installs silently, but does not uninstall silently.

In that precise case it is necessary to override the uninstall()`` function.

Example with Mozilla Firefox:

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

uninstallkey = ['Mozilla Firefox 52.6.0 ESR (x64 fr)']

def install():
    print('installing tis-firefox-esr')
    run(r'"Firefox Setup 52.6.0esr.exe" -ms')

def uninstall():
    print('uninstalling tis-firefox-esr')
    run(r'"C:\Program Files\Mozilla Firefox\uninstall\helper.exe" -ms')

Hint

In the uninstall() function, it is not possible to call for files included inside the WAPT package. To call files from the package, it is necessary to copy / paste the files in a temporary directory during package installation.

Build and upload the package

Once the installation and the de-installation are configured and tested and the package is customized to your satisfaction, vous may build and upload your new WAPT package onto your WAPT repository.