Charlemagne Outils
Silent install package for Charlemagne Outils
11.9.0.0-4
- package: tis-charlemagne-outils
- name: Charlemagne Outils
- version: 11.9.0.0-4
- maintainer: WAPT Team,Tranquil IT, Flavien Schelfaut
- editor: Aplim
- locale: all
- target_os: windows
- impacted_process: Outils.exe
- architecture: all
- signature_date:
- size: 21.33 Mo
- homepage : https://www.aplim.fr
- depends:
package : tis-charlemagne-outils
version : 11.9.0.0-4
architecture : all
section : base
priority : optional
name : Charlemagne Outils
categories :
maintainer : WAPT Team,Tranquil IT, Flavien Schelfaut
description : Charlemagne Outils
depends : tis-charlemagne-moteur
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.1
sources : https://api.ecoledirecte.com/v3/c/0/download/majcharlemagne.awp?verbe=get&chemin=MiseAJour\V2\&fichier=wOutils.exe
installed_size :
impacted_process : Outils.exe
description_fr :
description_pl :
description_de :
description_es :
description_pt :
description_it :
description_nl :
description_ru :
audit_schedule :
editor : Aplim
keywords :
licence :
homepage : https://www.aplim.fr
package_uuid : 8b4cab1f-94bc-47e1-92b2-0d289ec247b6
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version : 10.0
max_os_version :
icon_sha256sum : 12be6049114c27b51eade6183664fd272c60246b46d6a2d5429de958264223d1
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date : 2024-11-19T16:00:43.000000
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
signature : dVZeQ6/cuf3qlPTlLHRLd3RVJo2JaneIutMBcltD7Kk6PuKHj/B8EtXAn20XFEtcbqFSt+EoMs+TwF/oB2KQKlMG/R2H7zqVNiANyJ+S0GSDH7J9J98wAJ0FJdj+mGAgVmX5WkKW4lzH82r+ipAchyP15UMSdRclMbjVU9cbgUsl50svmACu2784YC9D0ug73/RtuxMEFwyhL6zTHbQiO5NxPiYBH0KwtbhMHK89bbDKDuBRjwr/uWAckbfwrwluEuRTVuTMqvA2DaO1NyemlVYU0aEQNnT2FxDyR2NKdYELmLjuG/cL/Endbs+2rt+sreMa+W2jfYrbdUR9klGPRA==
# -*- coding: utf-8 -*-
from setuphelpers import *
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_name = "charlemagne_outils.exe"
silent_args = "/S"
path_folder = makepath(programfiles32(),'alcuin')
bin_exe = makepath(path_folder, 'Outils.exe') # Edit here the name of the executable
def install():
# Initializing variables
package_version = control.version.split("-")[0]
# Installing the package
print(f"Installing: {bin_name}")
if force or not isfile(bin_exe) or Version(get_version_from_binary(bin_exe)) < Version(package_version):
killalltasks(control.impacted_process)
run(f"{makepath(basedir, bin_name)} {silent_args}")
if not isfile(bin_exe):
error('error %s not found' % bin_exe)
bin_version = get_version_from_binary(bin_exe)
if Version(bin_version) < Version(package_version):
error('Version file for %s is %s' % (bin_exe,bin_version))
def uninstall():
remove_file(bin_exe)
def audit():
if not isfile(bin_exe):
print(f"The executable can't be found here : {bin_exe}")
return "ERROR"
bin_version = get_version_from_binary(bin_exe)
package_version = control.version.split("-")[0]
if Version(bin_version) < Version(package_version):
print('Version file for %s is %s' % (bin_exe,bin_version))
return "ERROR"
if Version(bin_version) > Version(package_version):
print('Version file for %s is %s' % (bin_exe,bin_version))
return "WARNING"
print("The installation has been done correctly")
return "OK"
# -*- coding: UTF-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import waptlicences
import json
import requests
import re
url = "https://www.aplim.fr/Documentation.aspx/GetDirectoryAndFiles"
target_text = "Outils"
latest_bin = "charlemagne_outils.exe"
def update_package():
def find_charlemagne_download(data, target_text):
downloads = next((item['nodes'] for item in data if item.get('text') == "Téléchargements"), [])
charlemagne_item = next((item for item in downloads if item.get('text') == "Charlemagne"), None)
if charlemagne_item:
return next((item for item in charlemagne_item.get('nodes', []) if target_text in item.get('text', '')), None)
return None
def contains_letters(chaine):
return any(c.isalpha() for c in chaine)
# Declaring local variables
package_updated = False
proxies = get_proxies_from_wapt_console()
if not proxies:
proxies = get_proxies()
app_name = control.name
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "WAPT"
}
try:
response = requests.get(url, headers=headers, proxies=proxies)
response.raise_for_status()
response = response.json()
except Exception as e:
print(f"Request error: {e}")
return package_updated
decoded_data = json.loads(response['d'])
data = find_charlemagne_download(decoded_data, target_text)
version = re.search(rf"{target_text} - (\d+(?:\.\d+)+)", data['text']).group(1)
download_url = data['href']
print(f"Latest {app_name} version is: {version}")
print(f"Download url is: {download_url}")
# Before Aplim set up a bad naming scheme for its applications (Ex: 21.B , 9.2A ...)
# so we check if this is not the case
if contains_letters(version):
print("For the moment, this application cannot be packaged due to incorrect version naming...")
return package_updated
for f in glob.glob('*.exe'):
if Version(get_version_from_binary(f)) < Version(version):
remove_file(f)
if not isfile(latest_bin):
print(f"Downloading: {latest_bin}")
package_updated = True
wget(download_url, latest_bin, proxies=proxies)
else:
print(f"Binary is present: {latest_bin}")
expected_issuer = 'Aplim'
sign_name = waptlicences.check_exe_signing_certificate(latest_bin)[0]
if sign_name != expected_issuer:
error(f'Bad issuer {sign_name} != {expected_issuer} ')
# Changing version of the package
if Version(version) > Version(control.get_software_version()):
print(f"Software version updated (from: {control.get_software_version()} to: {version})")
package_updated = True
else:
print(f"Software version up-to-date ({version})")
control.set_software_version(get_version_from_binary(latest_bin))
control.save_control_to_wapt()
# Validating or not update-package-sources
return package_updated
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
aac7c5a2358121305bfc1f5ee603e9dbad5eba6ee1042d440bb6539c28b6bb7e : WAPT/control
12be6049114c27b51eade6183664fd272c60246b46d6a2d5429de958264223d1 : WAPT/icon.png
d540b56b292548ff46a257a3798e1eab0848e3805cc71d25b25576fa1017a870 : charlemagne_outils.exe
162c2fc4c028e6b56ba2b3a5ec64403fd34f28e3f462fad559e30a5030206efd : luti.json
be1ce4d888f6bb3890843fc578d675314e359ef52efd9080751e053866ea610c : setup.py
d143bdade05bdbcc74883384d78e3453e8d5472a80961054abfbd5b3df1235f7 : update_package.py