Page 7 of 8
Re: [SOLVED] Creation of Edt v2021 / Pronote v2021 package
Published: February 24, 2022 - 11:51 AM
by Jonattend
Good morning,
For my part, I just did this:
setup.py:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
def install():
#install_exe_if_needed("fake_install.exe",'/VERYSILENT',key='',min_version='0.0.0')
mkdirs("C:\install")
filecopyto("Install_PRNclient_FR_2021.0.2.7_win64.exe","C:\install")
filecopyto("install_pronote.cmd","C:\install")
filecopyto("ClientPRONOTE.iss","C:\install")
run("C:\install\install_pronote.cmd", timeout=1200)
install_pronote.cmd:
Code: Select all
C:\install\Install_PRNclient_FR_2021.0.2.7_win64.exe -s -f1C:\install\ClientPRONOTE.iss -f2C:\Windows\debug\pronote_install.log
I don't handle uninstalling, but in my case, it's not a big deal.
There are certainly cleaner ways, but this one has the merit of working
A+
Re: [SOLVED] Creation of Edt v2021 / Pronote v2021 package
Published: June 2, 2022 - 2:05 PM
by SebAranel
Hello,
I've just arrived at two schools, and there's currently a WAPT server running Debian 11, controlled via the WAPT console on Windows 7.
I'm not very experienced with package creation and need to deploy the latest Pronote update (0.2.9).
I'd appreciate some help finalizing a package for this version of Pronote. A package exists for version 0.2.8, but unfortunately, when I try to install it, I get many error messages from the PyScript.
Would you have a code I could use to customize it for each school?
Thank you in advance
Re: [SOLVED] Creation of Edt v2021 / Pronote v2021 package
Published: June 3, 2022 - 10:51
by dcardon
Hello SebAranel,
could you please confirm your WAPT version is 2.2.1.11949 Enterprise? Because normally, version 1.8.2 is compatible with version 2.2.1.
Did you install PyScripter version 3 or PyScripter 4? Personally, I recommend PyScripter version 3; version 4 uses the "Python Language Server" implementation for autocompletion and syntax analysis in the editor, and it's quite buggy.
Sincerely,
Denis Cardon
Re: [SOLVED] Creation of Edt v2021 / Pronote v2021 package
Published: June 8, 2022 - 08:17
by SebAranel
Hello Denis,
please excuse the rather long reply. I just checked and I'm apparently on a discovery version of wapt, 2.2.1.11949, and for pyscripter I'm on version 3.6. I've attached a screenshot.
I don't know if it makes a difference, but my console shows discovery.
Regards,
SebAranel
Re: [SOLVED] Creation of Edt v2021 / Pronote v2021 package
Published: June 8, 2022 - 11:14
by olaplanche
Hello,
FYI, the Python v3 compatible code for EDT and Pronote version 0.2.10 is in the first post.
It also includes instructions for customizing it as you see fit.
I've also just corrected a few minor typos and checked all the functions myself without any errors.
Normally, all you need to do is copy/paste and change three variables.
Re: [SOLVED] Edt v2021 / Pronote v2021 build 0.2.10 package
Published: June 8, 2022 - 12:09 PM
by SebAranel
Hello Olaplanche
Thank you for your reply and for your code, it worked with pyscripter using the wapt install on my post, however after trying to install it with the created package it returns all these errors.
Code: Select all
Installing gmwapt-client-pronote-2021-0210(=0.2.10-1)
Installing gmwapt-client-pronote-2021-0210(=0.2.10-1)
Installing: Install_PRNclient_FR_2021.0.2.10_win64.exe
Traceback (most recent call last):
File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1892, in run
self.running_task.run()
File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 653, in run
self._run()
File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1126, in _run
self.result.get('errors',[])))
Exception: Erreur lors de l'installation de [u'gmwapt-client-pronote-2021-0210(=0.2.10-1)']: erreurs dans les paquets [[PackageRequest(package=u'gmwapt-client-pronote-2021-0210',version=(Version('0.2.10.0'), 1),architectures=[u'x64'],locales=['fr'],maturities=[u'PROD'],target_os=[u'windows'],min_os_version=Version('10.0.19044'),max_os_version=Version('10.0.19044')), PackageEntry(u'gmwapt-client-pronote-2021-0210',u'0.2.10-1' architecture=u'x64',maturity=u'PROD'), u'Traceback (most recent call last):\n File "C:\\Program Files (x86)\\wapt\\common.py", line 4952, in install\n force=force\n File "C:\\Program Files (x86)\\wapt\\common.py", line 3962, in install_wapt\n raise e\nUnicodeDecodeError: \'ascii\' codec can\'t decode byte 0xc3 in position 623: ordinal not in range(128)\n']]
Exception: Erreur lors de l'installation de [u'gmwapt-client-pronote-2021-0210(=0.2.10-1)']: erreurs dans les paquets [[PackageRequest(package=u'gmwapt-client-pronote-2021-0210',version=(Version('0.2.10.0'), 1),architectures=[u'x64'],locales=['fr'],maturities=[u'PROD'],target_os=[u'windows'],min_os_version=Version('10.0.19044'),max_os_version=Version('10.0.19044')), PackageEntry(u'gmwapt-client-pronote-2021-0210',u'0.2.10-1' architecture=u'x64',maturity=u'PROD'), u'Traceback (most recent call last):\n File "C:\\Program Files (x86)\\wapt\\common.py", line 4952, in install\n force=force\n File "C:\\Program Files (x86)\\wapt\\common.py", line 3962, in install_wapt\n raise e\nUnicodeDecodeError: \'ascii\' codec can\'t decode byte 0xc3 in position 623: ordinal not in range(128)\n']]
Traceback (most recent call last):
File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1892, in run
self.running_task.run()
File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 653, in run
self._run()
File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1126, in _run
self.result.get('errors',[])))
Exception: Erreur lors de l'installation de [u'gmwapt-client-pronote-2021-0210(=0.2.10-1)']: erreurs dans les paquets [[PackageRequest(package=u'gmwapt-client-pronote-2021-0210',version=(Version('0.2.10.0'), 1),architectures=[u'x64'],locales=['fr'],maturities=[u'PROD'],target_os=[u'windows'],min_os_version=Version('10.0.19044'),max_os_version=Version('10.0.19044')), PackageEntry(u'gmwapt-client-pronote-2021-0210',u'0.2.10-1' architecture=u'x64',maturity=u'PROD'), u'Traceback (most recent call last):\n File "C:\\Program Files (x86)\\wapt\\common.py", line 4952, in install\n force=force\n File "C:\\Program Files (x86)\\wapt\\common.py", line 3962, in install_wapt\n raise e\nUnicodeDecodeError: \'ascii\' codec can\'t decode byte 0xc3 in position 623: ordinal not in range(128)\n']]
I've put it in code form so you can see what it is.
I don't know if it's possible either, but I still have a lot of 32-bit posts. Would the code you made work on this type of post?.
I know in advance that the errors do not come from the code you provided me because there are no errors in my post.
Sincerely
SebAranel
Re: [SOLVED] Edt v2021 / Pronote v2021 build 0.2.10 package
Published: June 8, 2022 - 1:50 PM
by olaplanche
Can I see the code in the setup.py and control files?
For the code to work with the 32-bit version, there are a few modifications to be made.
Re: [SOLVED] Edt v2021 / Pronote v2021 build 0.2.10 package
Published: June 9, 2022 - 9:30 AM
by SebAranel
Good morning
Here is the code for setup.py. There are the modifications that were made to the three lines with the college information. I just modified it to show you the code.
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 = '{E20E5011-C887-40D8-8C26-99460A24F860}'
edition = 'v2021.0'
SERVERNAME = 'Adresse du serveur du college' # Le nom DNS du serveur pronote
SERVERPORT = 'Port du serveur' # Le port TCP du serveur pronote
NOMETAB = 'Nom du Collège' # 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)
print('Installing: %s' % bin_name)
import tempfile
import codecs
pathinstallfile = makepath(tempfile.gettempdir(),'Setup.iss')
if installed_softwares ('INDEX EDUCATION - Client PRONOTE 2020 - 64bit'):
data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{E20E5011-C887-40D8-8C26-99460A24F860}-DlgOrder]
Dlg0={E20E5011-C887-40D8-8C26-99460A24F860}-SdLicense2Rtf-0
Count=6
Dlg1={E20E5011-C887-40D8-8C26-99460A24F860}-SdAskDestPath-0
Dlg2={E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-0
Dlg3={E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-1
Dlg4={E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-2
Dlg5={E20E5011-C887-40D8-8C26-99460A24F860}-SdFinish-0
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdLicense2Rtf-0]
Result=1
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdAskDestPath-0]
szDir=C:\Program Files\Index Education\Pronote 2021\Réseau\Client
Result=1
[{E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-0]
Result=1
Sel-0=0
[{E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-1]
Result=1
Sel-0=1
Sel-1=0
Sel-2=0
Sel-3=0
[{E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-2]
Result=1
Sel-0=0
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
"""
else:
data = r"""[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{E20E5011-C887-40D8-8C26-99460A24F860}-DlgOrder]
Dlg0={E20E5011-C887-40D8-8C26-99460A24F860}-SdLicense2Rtf-0
Count=5
Dlg1={E20E5011-C887-40D8-8C26-99460A24F860}-SdAskDestPath-0
Dlg2={E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-0
Dlg3={E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-1
Dlg4={E20E5011-C887-40D8-8C26-99460A24F860}-SdFinish-0
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdLicense2Rtf-0]
Result=1
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdAskDestPath-0]
szDir=C:\Program Files\Index Education\Pronote 2021\Réseau\Client
Result=1
[{E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-0]
Result=1
Sel-0=1
Sel-1=0
Sel-2=0
Sel-3=0
[{E20E5011-C887-40D8-8C26-99460A24F860}-AskOptions-1]
Result=1
Sel-0=0
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdFinish-0]
Result=1
bOpt1=0
bOpt2=0
"""
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 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 PRONOTE 2021' in line :
version = line.split('- ')[-1].split(' <')[0]
break
latest_bin = bin_name_string % (edition[1:5],version)
url_dl = 'https://tele3.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
[{E20E5011-C887-40D8-8C26-99460A24F860}-DlgOrder]
Dlg0={E20E5011-C887-40D8-8C26-99460A24F860}-MessageBox-0
Count=2
Dlg1={E20E5011-C887-40D8-8C26-99460A24F860}-SdFinishReboot-0
[{E20E5011-C887-40D8-8C26-99460A24F860}-MessageBox-0]
Result=6
[{E20E5011-C887-40D8-8C26-99460A24F860}-SdFinishReboot-0]
Result=1
BootOption=0
"""
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
run('"MsiExec.exe" /X{775E087D-A428-428C-A5FD-000010008000} /qn')
And here's what's in control
Code: Select all
package : gmwapt-client-pronote-2021-0210
version : 0.2.10-1
architecture : x64
section : base
priority : optional
name : client-pronote-2021---64bit
categories :
maintainer : winadmin
description : Client PRONOTE 2021 - 64bit (Index Education)
depends :
conflicts :
maturity : PROD
locale :
target_os : windows
min_wapt_version :
sources :
installed_size :
impacted_process :
description_fr :
description_pl :
description_de :
description_es :
description_pt :
description_it :
description_nl :
description_ru :
audit_schedule :
editor :
keywords :
licence :
homepage :
package_uuid : 692f5a90-88e4-4b2d-8cc0-3a5a7b35ed86
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version :
max_os_version :
icon_sha256sum :
signer : wapt
signer_fingerprint: 3d98c6bd75c8444596edecb80c04dda1ac217d841674700541eb14fde7ddaad6
signature : PB0R1D+WGx8L5CFEP4qp0P/Y9ypNZh5HVcV+HtFW1/f6a3Xu+K5X6Fwr62d33S2o2HdtsdOIuZT4n9w5lzz+6PgEA8rIF+aCpMIFoU/yRWQ2n71ecf7R9cehBRIBhCWBKpFgYNug0saL/Zk3Cag2b7ffuQibdHp4nKdmX6wilUpfbHXXtnskMTsvXAhaXZxCFe3yHjmPFML3URTEJX5/7LWKlAQ1u0W1PYx9vd8PH2nw6RaMjcQYgEgu4hZPscqm5RQqIq53jg+EutVPqNyBExKAJM2hOG0TJfNt6TFjxA/b/LnwJjBvHa1/GR0Vdm+fOTXKvhmmEsAwIrEYitbVNg==
signature_date : 2022-06-08T11:54:39.301511
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
I retrieved it from PyScripter; I hope I haven't made a mistake and that this is what you wanted to see
Sincerely
SebAranel
Re: [SOLVED] Edt v2021 / Pronote v2021 build 0.2.10 package
Published: June 9, 2022 - 09:41
by olaplanche
Hello,
that's correct, thank you. Could you please add the source code to your control file as indicated in the first post?
Then, delete the binary from the package's development folder and run the "update-package-sources" function from PyScripter.
If everything is OK, re-download the binary and name it correctly. Then, perform another installation test from PyScripter, and if it's still successful, build the package and upload it to the server to perform another deployment test.
Re: [SOLVED] Edt v2021 / Pronote v2021 build 0.2.10 package
Published: June 9, 2022 - 10:04 AM
by SebAranel
What do you mean by deleting the binary from the package's development folder?