[SOLVED] Edt Package v2022 build 0.3.0 / Pronote v2022 build 0.3.0

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
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

January 26, 2017 - 2:36 PM

Good morning,

:!: Remember to replace the SERVERNAME, SERVERPORT and NOMETAB variables with your values
The new code automatically handles the possible presence of the previous version as well as the def update_package() function to simplify the update.
Using the same code, it is therefore possible to install the latest version side-by-side with the previous version seamlessly.
To uninstall the previous version, you must therefore use the uninstall function of the package of the previous version. :!:

EDT 2022 v0.3.0 x64:

Code: Select all

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

uninstallkey = []

# Defining variables
bin_name_string = 'Install_EDTclient_FR_%s.%s_win64.exe'
app_uninstallkey = '{53EC7135-0E8C-419B-A1F3-5FAFB215686C}'
edition = 'v2022.0'
SERVERNAME = 'blabla.index-education.net' # Le nom DNS du serveur pronote
SERVERPORT = '49500' # Le port TCP du serveur pronote
NOMETAB = 'Mon ETAB' # Utilisé pour personnaliser le nom du raccourci sur le bureau

def install():
    # Initializing variables
    package_version = control.version.split('-',1)[0]
    bin_name = bin_name_string % (edition[1:5],package_version)
    edition_old = str(int(edition[1:5]) - 1)

    # Installing the package
    print('Installing: %s' % bin_name)
    import tempfile
    import codecs
    pathinstallfile = makepath(tempfile.gettempdir(),'Setup.iss')
    if installed_softwares ('INDEX EDUCATION - Client EDT %s - 64bit' % edition_old):
        data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[%s-DlgOrder]
Dlg0=%s-SdLicense2Rtf-0
Count=6
Dlg1=%s-SdAskDestPath-0
Dlg2=%s-AskOptions-0
Dlg3=%s-AskOptions-1
Dlg4=%s-AskOptions-2
Dlg5=%s-SdFinish-0
[%s-SdLicense2Rtf-0]
Result=1
[%s-SdAskDestPath-0]
szDir=C:\Program Files\Index Education\EDT %s\Réseau\Client
Result=1
[%s-AskOptions-0]
Result=1
Sel-0=0
[%s-AskOptions-1]
Result=1
Sel-0=1
Sel-1=0
Sel-2=0
Sel-3=0
[%s-AskOptions-2]
Result=1
Sel-0=0
[%s-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
""" % (app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,edition[1:5],app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey)
    else:
        data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[%s-DlgOrder]
Dlg0=%s-SdLicense2Rtf-0
Count=5
Dlg1=%s-SdAskDestPath-0
Dlg2=%s-AskOptions-0
Dlg3=%s-AskOptions-1
Dlg4=%s-SdFinish-0
[%s-SdLicense2Rtf-0]
Result=1
[%s-SdAskDestPath-0]
szDir=C:\Program Files\Index Education\EDT %s\Réseau\Client
Result=1
[%s-AskOptions-0]
Result=1
Sel-0=1
Sel-1=0
Sel-2=0
Sel-3=0
[%s-AskOptions-1]
Result=1
Sel-0=0
[%s-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
""" % (app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,edition[1:5],app_uninstallkey,app_uninstallkey,app_uninstallkey)
    fichier = codecs.open(pathinstallfile, "w", encoding='mbcs')
    fichier.write(data)
    fichier.close()
    install_exe_if_needed(bin_name,silentflags='-s -f1%s' % pathinstallfile,key=app_uninstallkey,min_version=package_version,killbefore='Client EDT.exe')
    uninstallkey.remove(app_uninstallkey)
    # Deleting response file
    remove_file(pathinstallfile)
    # Creating desktop shortcut for all users
    create_desktop_shortcut(r'EDT%s - %s' % (edition[1:5],NOMETAB),target=u'C:\Program Files\Index Education\EDT %s\Réseau\Client\Client EDT.exe' % edition[1:5],arguments=r'-Adresse "%s" -PortTcp "%s"' % (SERVERNAME,SERVERPORT))

def audit():
    if not uninstall_key_exists ('{775E087D-A428-428C-A5FD-000010008000}'):
        print('Module de Mise à jour automatique manquant')
        return "ERROR"
    if not isfile(r'%s\InstallShield Installation Information\{53EC7135-0E8C-419B-A1F3-5FAFB215686C}\setup.exe' % programfiles32):
        print('Binaire de désinstallation manquant')
        return "WARNING"
    else:
        return "OK"

def update_package():
    print('Downloading/Updating package content from upstream binary sources')

    # Initializing variables
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    app_name = control.name
    url = control.sources
    app_arch = control.architecture
    if app_arch == 'x64':
        dl_arch = 'win64'
    else:
        dl_arch = 'win32'

    # Getting latest version from official website
    page = wgets(control.sources,proxies=proxies)
    for line in page.splitlines() :
        if ('CLIENT EDT %s - 0.' % edition[1:5]) in line :
            version = line.split('-')[+1].replace(" ","")
            break
    latest_bin = bin_name_string % (edition[1:5],version)
    url_dl = 'https://tele7.index-education.com/telechargement/edt/%s/exe/Install_EDTclient_FR_%s.%s_%s.exe' % (edition,edition[1:5],version,dl_arch)

    print("Latest %s version is: %s" % (app_name,version))
    print("Download url is: %s" % url_dl)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print('Downloading: %s' % latest_bin)
        wget(url_dl,latest_bin,proxies=proxies)

        # Checking version from file
        version_from_file = get_version_from_binary(latest_bin)
        if version != version_from_file:
            os.rename(latest_bin,bin_name_string % (edition[1:5],version_from_file))
            version = version_from_file

        # Changing version of the package
        control.version = '%s-%s'%(version,int(control.version.split('-')[-1])+1)
        control.save_control_to_wapt()
        print('Changing version to: %s in WAPT\\control' % control.version)

    # Deleting outdated binaries
    remove_outdated_binaries(version)

def get_proxies():
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_version_from_binary(filename):
    if filename.endswith('.msi'):
        return get_msi_properties(filename)['ProductVersion']
    else:
        return get_file_properties(filename)['ProductVersion']


def remove_outdated_binaries(version, list_extensions=['exe','msi','deb','rpm','dmg','pkg'], list_filename_contain=None):
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if list_filename_contain:
        if type(list_filename_contain) != list:
            list_filename_contain = [list_filename_contain]
    list_extensions = ['.' + ext for ext in list_extensions if ext[0] != '.']
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob('*%s' % file_ext):
            if not version in bin_in_dir:
                remove_file(bin_in_dir)
            if list_filename_contain:
                for filename_contain in list_filename_contain:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)

def get_proxies_from_wapt_console():
    proxies = {}
    if platform.system() == 'Windows':
        waptconsole_ini_path = makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini')
    else:
        waptconsole_ini_path = makepath(user_home_directory(), '.config', 'waptconsole', 'waptconsole.ini')
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, 'global', 'http_proxy')
        if proxy_wapt:
            proxies = {'http': proxy_wapt, 'https': proxy_wapt}
    return proxies

def uninstall():
    # Uninstalling the package
    print('Uninstalling: %s' % control.package)
    import tempfile
    pathuninstallfile = makepath(tempfile.gettempdir(),'Uninstall.iss')
    data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[%s-DlgOrder]
Dlg0=%s-MessageBox-0
Count=2
Dlg1=%s-SdFinishReboot-0
[%s-MessageBox-0]
Result=6
[%s-SdFinishReboot-0]
Result=1
BootOption=0
""" % (app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey)
    fichier = open(pathuninstallfile, "w")
    fichier.write(data)
    fichier.close()
    run(r'"%s\InstallShield Installation Information\%s\setup.exe" -s -uninst -f1%s' % (programfiles32,app_uninstallkey,pathuninstallfile))
    # Deleting response file
    remove_file(pathuninstallfile)
    # Removing desktop shortcut for all users
    remove_desktop_shortcut('EDT%s - %s.lnk' % (edition[1:5],NOMETAB))
    # Uninstalling Auto Update Agent
    if uninstall_key_exists('{775E087D-A428-428C-A5FD-000010008000}'):
        run('"MsiExec.exe" /X{775E087D-A428-428C-A5FD-000010008000} /qn')
:!: This information must be entered in the EDT control file: :!:

Code: Select all

architecture      : x64
sources           : https://www.index-education.com/fr/telecharger-edt.php
Pronote 2022 v0.3.0 x64:

Code: Select all

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

uninstallkey = []

# Defining variables
bin_name_string = 'Install_PRNclient_FR_%s.%s_win64.exe'
app_uninstallkey = '{D1124ED8-514E-40BF-9021-D3B3CA941A53}'
edition = 'v2022.0'
SERVERNAME = 'blabla.index-education.net' # Le nom DNS du serveur pronote
SERVERPORT = '49500' # Le port TCP du serveur pronote
NOMETAB = 'Mon ETAB' # Utilisé pour personnaliser le nom du raccourci sur le bureau

def install():
    # Initializing variables
    package_version = control.version.split('-',1)[0]
    bin_name = bin_name_string % (edition[1:5],package_version)
    edition_old = str(int(edition[1:5]) - 1)

    print('Installing: %s' % bin_name)
    import tempfile
    import codecs
    pathinstallfile = makepath(tempfile.gettempdir(),'Setup.iss')
    if installed_softwares ('INDEX EDUCATION - Client PRONOTE %s - 64bit' % edition_old):
        data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[%s-DlgOrder]
Dlg0=%s-SdLicense2Rtf-0
Count=6
Dlg1=%s-SdAskDestPath-0
Dlg2=%s-AskOptions-0
Dlg3=%s-AskOptions-1
Dlg4=%s-AskOptions-2
Dlg5=%s-SdFinish-0
[%s-SdLicense2Rtf-0]
Result=1
[%s-SdAskDestPath-0]
szDir=C:\Program Files\Index Education\Pronote %s\Réseau\Client
Result=1
[%s-AskOptions-0]
Result=1
Sel-0=0
[%s-AskOptions-1]
Result=1
Sel-0=1
Sel-1=0
Sel-2=0
Sel-3=0
[%s-AskOptions-2]
Result=1
Sel-0=0
[%s-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
""" % (app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,edition[1:5],app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey)
    else:
        data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[%s-DlgOrder]
Dlg0=%s-SdLicense2Rtf-0
Count=5
Dlg1=%s-SdAskDestPath-0
Dlg2=%s-AskOptions-0
Dlg3=%s-AskOptions-1
Dlg4=%s-SdFinish-0
[%s-SdLicense2Rtf-0]
Result=1
[%s-SdAskDestPath-0]
szDir=C:\Program Files\Index Education\Pronote %s\Réseau\Client
Result=1
[%s-AskOptions-0]
Result=1
Sel-0=1
Sel-1=0
Sel-2=0
Sel-3=0
[%s-AskOptions-1]
Result=1
Sel-0=0
[%s-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
""" % (app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,edition[1:5],app_uninstallkey,app_uninstallkey,app_uninstallkey)
    fichier = codecs.open(pathinstallfile, "w", encoding='mbcs')
    fichier.write(data)
    fichier.close()
    install_exe_if_needed(bin_name,silentflags='-s -f1%s' % pathinstallfile,key=app_uninstallkey,min_version=package_version,killbefore='Client PRONOTE.exe')
    uninstallkey.remove(app_uninstallkey)
    # Deleting response file
    remove_file(pathinstallfile)
    # Creating desktop shortcut for all users
    create_desktop_shortcut(r'Pronote%s - %s' % (edition[1:5],NOMETAB),target=u'C:\Program Files\Index Education\Pronote %s\Réseau\Client\Client PRONOTE.exe' % edition[1:5],arguments=r'-Adresse "%s" -PortTcp "%s"' % (SERVERNAME,SERVERPORT))

def audit():
    if not uninstall_key_exists ('{775E087D-A428-428C-A5FD-000010008000}'):
        print('Module de Mise à jour automatique manquant')
        return "ERROR"
    if not isfile(r'%s\InstallShield Installation Information\{D1124ED8-514E-40BF-9021-D3B3CA941A53}\setup.exe' % programfiles32):
        print('Binaire de désinstallation manquant')
        return "WARNING"
    else:
        return "OK"

def update_package():
    print('Downloading/Updating package content from upstream binary sources')

    # Initializing variables
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    app_name = control.name
    url = control.sources
    app_arch = control.architecture
    if app_arch == 'x64':
        dl_arch = 'win64'
    else:
        dl_arch = 'win32'

    # Getting latest version from official website
    page = wgets(control.sources,proxies=proxies)
    for line in page.splitlines() :
        if ('CLIENT EDT %s - 0.' % edition[1:5]) in line :
            version = line.split('-')[+1].replace(" ","")
            break
    latest_bin = bin_name_string % (edition[1:5],version)
    url_dl = 'https://tele7.index-education.com/telechargement/pn/%s/exe/Install_PRNclient_FR_%s.%s_%s.exe' % (edition,edition[1:5],version,dl_arch)

    print("Latest %s version is: %s" % (app_name,version))
    print("Download url is: %s" % url_dl)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print('Downloading: %s' % latest_bin)
        wget(url_dl,latest_bin,proxies=proxies)

        # Checking version from file
        version_from_file = get_version_from_binary(latest_bin)
        if version != version_from_file:
            os.rename(latest_bin,bin_name_string % (edition[1:5],version_from_file))
            version = version_from_file

        # Changing version of the package
        control.version = '%s-%s'%(version,int(control.version.split('-')[-1])+1)
        control.save_control_to_wapt()
        print('Changing version to: %s in WAPT\\control' % control.version)

    # Deleting outdated binaries
    remove_outdated_binaries(version)

def get_proxies():
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_version_from_binary(filename):
    if filename.endswith('.msi'):
        return get_msi_properties(filename)['ProductVersion']
    else:
        return get_file_properties(filename)['ProductVersion']


def remove_outdated_binaries(version, list_extensions=['exe','msi','deb','rpm','dmg','pkg'], list_filename_contain=None):
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if list_filename_contain:
        if type(list_filename_contain) != list:
            list_filename_contain = [list_filename_contain]
    list_extensions = ['.' + ext for ext in list_extensions if ext[0] != '.']
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob('*%s' % file_ext):
            if not version in bin_in_dir:
                remove_file(bin_in_dir)
            if list_filename_contain:
                for filename_contain in list_filename_contain:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)

def get_proxies_from_wapt_console():
    proxies = {}
    if platform.system() == 'Windows':
        waptconsole_ini_path = makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini')
    else:
        waptconsole_ini_path = makepath(user_home_directory(), '.config', 'waptconsole', 'waptconsole.ini')
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, 'global', 'http_proxy')
        if proxy_wapt:
            proxies = {'http': proxy_wapt, 'https': proxy_wapt}
    return proxies

def uninstall():
    print('uninstalling: %s' % control.package)
    import tempfile
    pathuninstallfile = makepath(tempfile.gettempdir(),'Uninstall.iss')
    data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[%s-DlgOrder]
Dlg0=%s-MessageBox-0
Count=2
Dlg1=%s-SdFinishReboot-0
[%s-MessageBox-0]
Result=6
[%s-SdFinishReboot-0]
Result=1
BootOption=0
""" % (app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey,app_uninstallkey)
    fichier = open(pathuninstallfile, "w")
    fichier.write(data)
    fichier.close()
    run(r'"%s\InstallShield Installation Information\%s\setup.exe" -s -uninst -f1%s' % (programfiles32,app_uninstallkey,pathuninstallfile))
    # Deleting response file
    remove_file(pathuninstallfile)
    # Removing desktop shortcut for all users
    remove_desktop_shortcut('Pronote%s - %s.lnk' % (edition[1:5],NOMETAB))
    # Uninstalling Auto Update Agent
    if uninstall_key_exists('{775E087D-A428-428C-A5FD-000010008000}'):
        run('"MsiExec.exe" /X{775E087D-A428-428C-A5FD-000010008000} /qn')
:!: This information must be entered in the Pronote control file: :!:

Code: Select all

architecture      : x64
sources           : https://www.index-education.com/fr/telecharger-edt.php
Changelog of 05/12/2022:
- Added an Audit function for edt and pronote to check the correct presence of the automatic update module and the binary used for the uninstall function which tends to disappear.

Changelog from 01/12/2022:
- Updated the edt download link in the update-package function.

Changelog of 22/08/2022:
- Fix in the update_package function of edt.

Changelog of 18/08/2022:
- Code update for Pronote 2022 with a fix for automatic update of answer files. Simply update the `edition` and `app_uninstallkey` variables to switch to version 2022 ;)
- Change the source URL in the control file to use the same one as edt, because the Pronote URL changes every summer between the pre-release and final versions, which isn't the case for edt. This should eliminate the need to switch between the two!

Changelog of 21/06/2022:
- Code updated for EDT 2022 with a fix for automatic update of answer files. Simply update the `edition` and `app_uninstallkey` variables to switch to version 2022 ;)

Changelog of 09/06/2022:
- Updated source URL in the control file of the pronote package.

Changelog of 08/06/2022:
- Correction of a non-blocking typo on the minimum version control at installation and update of the uninstallkey of the update agent.

Changelog of 02/06/2022:
- Updated the update package function following the release of version 0.2.10 (the function will now correctly support all versions regardless of the length of the version number)

Changelog of 22/03/2022:
- Update of the url_dl variable (tele7 replaced by tele3) following the change of download url.

Changelog of 11/02/2022:
- Modification of the def update_package() functions following a change in the source code of the web page.

Changelog of 21/01/2022:
- Python 3 compatibility
Last edited by olaplanche on Dec 5, 2022 - 2:04 PM, edited 31 times.
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

January 26, 2017 - 3:21 PM

Hello,

the variable basedir allows the use of the absolute path:

run(r'"toto.exe" %s\setup.iss' % basedir )
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

January 26, 2017 - 3:44 PM

Thanks so much for the answer! But where are the files located during package installation?
I can see the package being copied to the c:\wapt\cache folder, but it must be extracted somewhere, right? So what is the value of the basedir variable at the time of deployment?

Thanks!
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

January 26, 2017 - 3:47 PM

The package is unzipped into the system's temporary directory.
To see the value...

Code: Select all

def install(): 
    print(basedir)
Tranquil IT
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

January 27, 2017 - 09:36

Excellent! I was able to complete my package :)

For your information, the exact command for the silent installation of edt:

Code: Select all

run(r'"Install_EDTclient.exe" -s -f1%s\Setup.iss' % basedir)
Thank you
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

January 27, 2017 - 2:06 PM

Final version with creation of the custom shortcut to connect to the server:

edt:

Code: Select all

def install():
  print"installing EDT2016"
  run(r'"Install_EDTclient.exe" -s -f1%s\Setup.iss' % basedir)
  create_desktop_shortcut(r'EDT - Lycée',target=u'C:\Program Files (x86)\Index Education\EDT 2016\Réseau\Client EDT.exe',arguments=r'-Adresse "dns_du_serveur" -PortTcp "49300"')
pronote:

Code: Select all

def install():
  print"installing Pronote2016"
  run(r'"Install_PRNclient.exe" -s -f1%s\Setup.iss' % basedir)
  create_desktop_shortcut(r'PRONOTE - Lycée',target=u'C:\Program Files (x86)\Index Education\Pronote 2016\Réseau\Client PRONOTE.exe',arguments=r'-Adresse "dns_du_serveur" -PortTcp "49300"')
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

August 9, 2017 - 4:03 PM

Good morning,

I'm getting back to you with the development of the new packages (EDT and Pronote 2017 versions). I would like to go further than with the previous packages by using the install_exe_if_needed function instead of a simple "run".

The installation goes smoothly, but I'm stuck on uninstalling the packages. Here's my code:

Code: Select all

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

uninstallkey = []

def install():
    print('installing wapt-pronote2017')
    install_exe_if_needed("Install_PRNclient_FR_2017.0.1.2_win64.exe",silentflags='-s -f1%s\Setup.iss' % basedir,key='{82A4C6B8-0E8E-428E-8566-5045C833AA6B}',min_version='0.1.1.0',killbefore='Client PRONOTE.exe')
    uninstallkey.remove('{82A4C6B8-0E8E-428E-8566-5045C833AA6B}')
    filecopyto('Uninstall.iss','C:\Program Files (x86)\InstallShield Installation Information\{82A4C6B8-0E8E-428E-8566-5045C833AA6B}')

def uninstall():
    print('uninstalling wapt-pronote2017')
    run(r'"C:\Program Files (x86)\InstallShield Installation Information\{82A4C6B8-0E8E-428E-8566-5045C833AA6B}\setup.exe" -runfromtemp -l0x040c  -uninst -removeonly -s -f1%s\Uninstall.iss' % basedir)
The "filecopyto" command doesn't work; the "Uninstall.iss" file contained in the package must be accessible during uninstallation. I was therefore thinking of copying it to the installer folder so I could use it in the uninstallation command...

The uninstallation command executed locally with an absolute path to the Uninstall.iss file works correctly!
I deduce that all that remains is to place the Uninstall.iss file correctly and call it with the correct syntax (I have a doubt about the use of the basedir variable in this case).

THANKS
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

August 10, 2017 - 2:17 PM

Attention!

You didn't pass the r in front of the chain

Code: Select all

"'C:\Program Files (x86)\InstallShield Installation Information\{82A4C6B8-0E8E-428E-8566-5045C833AA6B}"
So Python sees the string like this:

Code: Select all

"'C:Program Files (x86)InstallShield Installation Information{82A4C6B8-0E8E-428E-8566-5045C833AA6B}"
;)

The best approach is to generate the file on the fly in the temp directory and also call the programfiles variable

Code: Select all

def uninstall():
    import tempfile
    pathuninstallfile = makepath(tempfile.gettempdir(),'Uninstall.iss')
    data = ur"""gretyreyh
yhrthrthrt
h
trhrthrthrt
htrhrthrthrt"""
    fichier = open(pathuninstallfile, "w")
    fichier.write(data)
    fichier.close()
    run(r'"%s\InstallShield Installation Information\{82A4C6B8-0E8E-428E-8566-5045C833AA6B}\setup.exe" -runfromtemp -l0x040c  -uninst -removeonly -s -f1%s' % (programfiles32,pathuninstallfile))
    remove_file(pathuninstallfile)
    
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

August 11, 2017 - 08:36

Thanks!

I just modified my package, everything seems to be working fine (no errors), but the software won't uninstall.
The file is correctly created in the user's temp folder, its contents are okay (I tested the file manually), and the uninstallation command is correct (no issues with variables).

Since I'm not getting any error messages, I'm not sure where to look. Any ideas?
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

August 11, 2017 - 11:13 PM

How did you test it?

Did you test it by running `uninstall()` in PyScripter?
Locked