Page 1 of 1

create pronote package

Published: July 3, 2022 - 4:55 PM
by adgm11
Good morning
I want to create a package to install the Pronote client (Index Education)
I therefore have an .exe file and an .iss file for installation and another for uninstallation. The batch command to launch the silent installation on all machines is as follows:

Code: Select all

\\serveur\pronote\Install_PRNclient_FR_win64.exe -s -f1\\serveur\pronote\ClientPRONOTE.iss
For uninstallation, here are the commands

Code: Select all

"%ProgramFiles(x86)%\InstallShield Installation Information\{E20E5011-C887-40D8-8C26-99460A24F860}\setup.exe -s -uninst -f1\\serveur\pronote\uninstPRONOTE.iss
How can I convert these commands into Python language in PyScripter in order to create a package that allows installation and uninstallation?
THANKS

Re: Creating a Pronote package

Published: July 3, 2022 - 6:28 PM
by adgm11
Well, finally after several attempts I ended up finding the commands I wanted, and it works from pyscripter.
  • For installation, command 1 installs the executable using the previously created .iss answer file (see the indexeducation website). Command 2 copies the proxy settings. Command 3 copies the client settings, including the TCP port, the indexeduc server address, and the client name.
  • For uninstallation, command 1 uninstalls using the uninstallation answer file .iss, command 2 deletes the indexeducation folder which seems to remain and may cause problems for a reinstallation.

Code: Select all

def install():
    run(r'"Install_PRNclient_FR_2021.0.2.8_win64.exe" -s -f1A:\waptdev\pkg-pronoteclient-wapt\ClientPRONOTE.iss')
    run(r'xcopy "A:\waptdev\pkg-pronoteclient-wapt\ConfigClientsHttp.xcfg" "C:\ProgramData\IndexEducation\Commun\" /y')
    run(r'xcopy "A:\waptdev\pkg-pronoteclient-wapt\Client PRONOTE.xcfg" "C:\ProgramData\IndexEducation\PRONOTE\CLIENT\VERSION 2021-0\FR\Installations\{90AAC525-F174-C243-EA1F-DCD1FD499401}\" /y')

def uninstall():
    run(r'"%ProgramFiles(x86)%\InstallShield Installation Information\{E20E5011-C887-40D8-8C26-99460A24F860}\setup.exe" -s -uninst -f1A:\waptdev\pkg-pronoteclient-wapt\uninstPRONOTE.iss')
    run(r'rd "C:\ProgramData\IndexEducation" /s /q')
The problem is that when I deploy the app on a PC, Wapt returns this error:

Code: Select all

CalledProcessErrorOutput: Command '"Install_PRNclient_FR_2021.0.2.8_win64.exe" -s -f1"ClientPRONOTE.iss"' returned non-zero exit status -2147213312.

Re: Creating a Pronote package

Published: July 4, 2022 - 1:29 PM
by sfonteneau
Hello,


have you looked at the existing Pronote topic on this forum with a working code?

viewtopic.php?p=10396#p10396

Re: Creating a Pronote package

Published: July 9, 2022 - 3:36 PM
by adgm11
Indeed, this topic is very useful. However, the global version doesn't work; the one from the first post, with the download URL and the creation of the .iss files...

Therefore, the only viable option is to place the .iss files in the package folder, along with the .xcfg configuration files for the proxy and the Index Education server

In my case, I was able to get the installation working with this command:

Code: Select all

def install():
    run(r'"Install_PRNclient_FR_2021.0.2.8_win64.exe" -s -f1%s\installPRONOTE.iss' % basedir)
    import os
    os.system('taskkill /f /im "Client PRONOTE.exe"')
    shutil.copyfile('ConfigClientsHttp.xcfg','C:\ProgramData\IndexEducation\Commun\ConfigClientsHttp.xcfg')
    shutil.copyfile('Client PRONOTE.xcfg','C:\ProgramData\IndexEducation\PRONOTE\CLIENT\VERSION 2021-0\FR\Installations\{90AAC525-F174-C243-EA1F-DCD1FD499401}\Client PRONOTE.xcfg')
You have to launch the program the first time (and then stop it if necessary) in order to copy the config files, otherwise the directories are unavailable.

The only problem is the uninstallation; I can't get it to work. I used this command:

Code: Select all

def uninstall():
    run(r'"C:\Program Files (x86)\InstallShield Installation Information\{E20E5011-C887-40D8-8C26-99460A24F860}\setup.exe" -s -uninst -f1%s\uninstPRONOTE.iss' % basedir)
I don't understand the difference between `remove` and `uninstall` in PyScripter. `remove` works fine in packages where an uninstallation key is injected. But for Pronote, it's different, and you have to use an `.iss` response file. How can I make the uninstallation command in `def uninstall` work? Because in WAPT, when I try to uninstall the package on a machine, Pronote doesn't uninstall.
THANKS

Re: Creating a Pronote package

Published: August 26, 2022 - 3:05 PM
by adgm11
Good morning
I created the new package with version 2022, taking care to modify the values ​​of the uninstallkey in the .xcfg files and the directories, which are being renamed
The problem remains that the uninstallation command doesn't work. I don't know if the new version installation creates a new directory or overwrites the old one.

And another recurring problem I don't understand. When I run the installation from PyScripter to test, it works perfectly on the PC hosting the Wapt console. But if I deploy it to other PCs, I get this error:

File "C:\Program Files (x86)\wapt\waptutils.py", line 2126, in run
raise CalledProcessErrorOutput(proc.returncode, cmd, ''.join(output))
waptutils.CalledProcessErrorOutput: Command '"Install_PRNclient_FR_2022.0.2.1_win64.exe" -s -f1C:\\WINDOWS\\TEMP\\wapt4g0p39cy\\installPRONOTE.iss' returned non-zero exit status 1.
Output: '"Install_PRNclient_FR_2022.0.2.1_win64.exe"' is not recognized as an internal command
or external, an executable program or a batch file.


Why is it pointing to the wrong folder: -f1C:\\WINDOWS\\TEMP\\wapt4g0p39cy\\installPRONOTE.iss? Ideally, the installPRONOTE.iss file should be retrieved from the package folder in waptdev, since I placed it there. How do I specify this folder? What do the %s variable mean? And what about %basedir?

Here is the package:

Code: Select all

uninstallkey = ['{D1124ED8-514E-40BF-9021-D3B3CA941A53}']

def install():
    run(r'"Install_PRNclient_FR_2022.0.2.1_win64.exe" -s -f1%s\installPRONOTE.iss' % basedir)
    import time
    time.sleep(3)
    import os
    os.system('taskkill /f /im "Client PRONOTE.exe"')
    shutil.copyfile('ConfigClientsHttp.xcfg','C:\ProgramData\IndexEducation\Commun\ConfigClientsHttp.xcfg')
    shutil.copyfile('Client PRONOTE.xcfg','C:\ProgramData\IndexEducation\PRONOTE\CLIENT\VERSION 2022-0\FR\Installations\{EE26865C-1E0D-D13E-3DC3-DC89333D079B}\Client PRONOTE.xcfg')

def uninstall():
    run(r'"C:\Program Files (x86)\InstallShield Installation Information\{D1124ED8-514E-40BF-9021-D3B3CA941A53}\setup.exe" -s -uninst -f1%s\uninstPRONOTE.iss' % basedir)
    shutil.rmtree('C:\ProgramData\IndexEducation','ignore_errors=True')

Re: Creating a Pronote package

Published: August 29, 2022 - 10:28
by sfonteneau
`basedir` should not be used in uninstall.

In fact, when `remove/uninstall` is executed, the package is no longer present on the machine. (It was removed during installation, so the files in the package are no longer available.)

Therefore, you must copy your `uninstPRONOTE.iss` file to another location on the machine during installation to use it during uninstallation, or create the file when `def uninstall` is executed.

The `msoffice` package does this. You can look at the package for an example; it creates the file only during uninstallation.

https://store.wapt.fr/store/details-tis ... 99489.wapt

Re: Creating a Pronote package

Published: August 29, 2022 - 11:56
by adgm11
Okay, thank you. Indeed, on the Pronote website they also recommend copying the files to the local hard drive
Now the installation works fine by copying the .iss file to C::

Code: Select all

def install():
    shutil.copyfile('installPRONOTE.iss','C:\installPRONOTE.iss')
    run(r'Install_PRNclient_FR_2022.0.2.1_win64.exe -s -f1C:\installPRONOTE.iss')
    import time
    time.sleep(3)
    import os
    os.system('taskkill /f /im "Client PRONOTE.exe"')
    shutil.copyfile('ConfigClientsHttp.xcfg','C:\ProgramData\IndexEducation\Commun\ConfigClientsHttp.xcfg')
    shutil.copyfile('Client PRONOTE.xcfg','C:\ProgramData\IndexEducation\PRONOTE\CLIENT\VERSION 2022-0\FR\Installations\{EE26865C-1E0D-D13E-3DC3-DC89333D079B}\Client PRONOTE.xcfg')
To uninstall, I presume you just need to remove the %basedir directory and also copy the .iss file to the local disk. It would look like this:

Code: Select all

def uninstall():
    shutil.copyfile('uninstPRONOTE.iss','C:\uninstPRONOTE.iss')
    run(r'"C:\Program Files (x86)\InstallShield Installation Information\{D1124ED8-514E-40BF-9021-D3B3CA941A53}\setup.exe" -s -uninst -f1C:\uninstPRONOTE.iss')
    shutil.rmtree('C:\ProgramData\IndexEducation','ignore_errors=True')
    

Re: Creating a Pronote package

Published: August 29, 2022 - 2:49 PM
by sfonteneau
baseir can be used during installation without any problem

Simply using `basedir` in uninstall will not give access to the file that is in the package

Code: Select all

import time
uninstallkey = []

def install():
   run(r'"Install_PRNclient_FR_2022.0.2.1_win64.exe" -s -f1%s\installPRONOTE.iss' % basedir)
   time.sleep(3)
   killalltasks('Client PRONOTE.exe')
    
   filecopyto('ConfigClientsHttp.xcfg',r'C:\ProgramData\IndexEducation\Commun\ConfigClientsHttp.xcfg')
   filecopyto('Client PRONOTE.xcfg',r'C:\ProgramData\IndexEducation\PRONOTE\CLIENT\VERSION 2022-0\FR\Installations\{EE26865C-1E0D-D13E-3DC3-DC89333D079B}\Client PRONOTE.xcfg')
   filecopyto("uninstPRONOTE.iss",r"c:\uninstPRONOTE.iss")

def uninstall():
    run(r'"C:\Program Files (x86)\InstallShield Installation Information\{D1124ED8-514E-40BF-9021-D3B3CA941A53}\setup.exe" -s -uninst -f1rc:\uninstPRONOTE.iss' )
    remove_tree(r'C:\ProgramData\IndexEducation')

Re: Creating a Pronote package

Published: August 29, 2022 - 4:17 PM
by adgm11
Okay, everything works perfectly with this package, thank you.
Just one small typo to correct in the uninstall command:
-f1c:\uninstPRONOTE.iss.

Do filecopyto and shutil.copyfile do the same thing? Except that you need to import shutil for the second one.

Re: Creating a Pronote package

Published: August 30, 2022 - 09:41
by sfonteneau
`filecopyto` comes directly from Wapt's setuphelpers (CTRL-CLICK on the function in your IDE to see the underlying code directly);

it's an improved `shutil.copyfile`.