tis-canoprof icon

Canoprof

Silent install package for Canoprof

2.2.0-1

  • package: tis-canoprof
  • name: Canoprof
  • version: 2.2.0-1
  • categories: education
  • maintainer: Jordan ARNAUD
  • licence: MPL 2.0 GPL 3.0 LGPL 3.0 CeCILL 2.1
  • locale: fr
  • target_os: linux
  • architecture: x64
  • signature_date:
  • size: 204.84 Mo
  • homepage : https://doc.scenari.software/Canoprof/fr/

package           : tis-canoprof
version           : 2.2.0-1
architecture      : x64
section           : base
priority          : optional
name              : Canoprof
categories        : education
maintainer        : Jordan ARNAUD
description       : Designing, publishing and sharing teaching resources for primary and secondary schools
depends           : 
conflicts         : 
maturity          : PROD
locale            : fr
target_os         : linux
min_wapt_version  : 
sources           : https://download.scenari.software/Canoprof/
installed_size    : 
impacted_process  : 
description_fr    : Conception, publication et partage de ressources pédagogiques pour le primaire et le secondaire
description_pl    : Projektowanie, publikowanie i udostępnianie materiałów dydaktycznych dla szkół podstawowych i średnich
description_de    : Konzeption, Veröffentlichung und Austausch von Bildungsressourcen für die Primar- und Sekundarstufe
description_es    : Diseñar, publicar y compartir recursos didácticos para primaria y secundaria
description_pt    : Conceber, publicar e partilhar recursos didácticos para escolas primárias e secundárias
description_it    : Progettare, pubblicare e condividere risorse didattiche per le scuole primarie e secondarie
description_nl    : Lesmateriaal voor basisscholen en middelbare scholen ontwerpen, publiceren en delen
description_ru    : Разработка, публикация и обмен учебными ресурсами для начальной и средней школы
audit_schedule    : 
editor            : 
keywords          : 
licence           : MPL 2.0 GPL 3.0 LGPL 3.0 CeCILL 2.1
homepage          : https://doc.scenari.software/Canoprof/fr/
package_uuid      : 4a69ace3-8520-4649-8d81-8198afa9604f
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : ef797ba7d1f86d9a2c9407f83214f30dd35a9ac09e5a8d2fd5003f2625f4e959
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : Lp307NCZPqhaEl6Ymql2AYPBlnERTNdhLHx/MT98msuNMWXQjZ1N1nOupE7qis70IMgZ54lCbfJgFmyh8J2SEX+01U9rdaxgvGDrkgXj7JawwAoIhDZUDwh9TS1w2x1qExXHsewpBr8MkHi0tkET2F3LTZdRwFmdUJcFXIaBwHTWWn9u3NZqFvpAxZl/0bcTU+8lkHyj27keUExaoVf4zXYlzFf0FiYvDxeyET0pU1tMlg/saHoKwhZjmGzTvmXx/kOc/2d5Du2J+b3xYvjL/SaW4FVWFvD2KnCdkKOjyKtpt6uVho/MOCBNQuMhdnQyYJDx4h0UFehU1o3N0ydtiQ==
signature_date    : 2024-09-03T10:00:35.813200
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

# -*- coding: utf-8 -*-
from setuphelpers import *
from iniparse import ConfigParser
import os


def install():
    install_dir = makepath('/','opt',control.package.split('-',1)[1])
    appimage = glob.glob("*.AppImage")[0]
    install_appimage(appimage,install_dir)

def uninstall():
    install_dir = makepath('/','opt',control.package.split('-',1)[1])
    uninstall_appimage(install_dir)

def install_appimage(appimage,install_dir,binaliasname=None):
    run('chmod a+x ./' + appimage)

    if isdir(install_dir):
        uninstall_appimage(install_dir)

    mkdirs(install_dir)

    name_appimage = appimage.split('/')[-1]
    filecopyto(appimage, makepath(install_dir, name_appimage))
    run('"./%s" --appimage-extract' % appimage)
    

    for desktop in glob.glob(makepath('squashfs-root','*.desktop')):
 
        desktop_cp = ConfigParser()
        desktop_cp.optionxform = str
        desktop_file = open(desktop, encoding="utf-8")
        desktop_cp.readfp(desktop_file)
        bin_path = desktop_cp.get('Desktop Entry',"Exec")

        newbin_path = install_dir + '/' + name_appimage
        if ' %' in bin_path:
            newbin_path = newbin_path + ' %' + bin_path.split(' %',1)[1]

        icon_path = desktop_cp.get('Desktop Entry',"Icon")

        srcicon = makepath('squashfs-root',icon_path +'.svg')
        if not isfile(srcicon):
            srcicon = makepath('squashfs-root',icon_path +'.png')

        if not isfile(srcicon):
            lstglob = glob.glob(makepath('squashfs-root','*.svg'))
            if lstglob :
                srcicon=lstglob[0]

        if not isfile(srcicon):
            lstglob = glob.glob(makepath('squashfs-root','*.png'))
            if lstglob :
                srcicon=lstglob[0]
            else:
                srcicon = None

        if srcicon:            
            new_icon = install_dir + '/' + srcicon.split('/')[-1]
            filecopyto(srcicon,new_icon)
            desktop_cp.set('Desktop Entry',"Icon",new_icon) 

        desktop_cp.set('Desktop Entry',"Exec",newbin_path)
       
        with open(desktop, 'w', encoding="utf-8") as f:
            desktop_cp.write(f)

        pathdesk = makepath(install_dir,desktop.split('/')[-1])
        filecopyto(desktop, pathdesk)
        run('chown root:root "%s" ' % pathdesk)

    for f in glob.glob(makepath(install_dir,'*.desktop')):
        run('ln -sf "%s" "/usr/share/applications/%s"' % (f,f.split('/')[-1]))

    if binaliasname :
        run(f"ln -sf {install_dir}/{name_appimage} /usr/bin/{binaliasname}")

    remove_tree('squashfs-root')

def uninstall_appimage(install_dir):

    if not glob.glob(makepath(install_dir,'*.desktop')):
        error('.desktop not found')

    for f in glob.glob(makepath(install_dir,'*.desktop')):
        deskfile = f.split('/')[-1]
        system_desktop = makepath("/","usr","share","applications",deskfile)
        if isfile(system_desktop):
            remove_file(system_desktop)
    remove_tree(install_dir)

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


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    
    lang_dict = {'fr':'fr-FR'}
    lang = control.locale
    url_base = "https://download.scenari.software/Canoprof/?productInfos"
    response = requests.get(url_base, proxies=proxies, allow_redirects=True)
    response.raise_for_status()

    # Supposons que la réponse soit un JSON contenant les informations du produit
    product_info = response.json()
    
    # Trouve la version la plus récente dans la liste 'hist'
    version = product_info.get('v', [])
    # Compose l'URL dynamique avec la dernière version
    url_latest_version = f"https://download.scenari.software/Canoprof@{version}/?productInfos"    
    response = requests.get(url_latest_version, proxies=proxies, allow_redirects=True)
    response.raise_for_status()
    # Supposons que la réponse soit un JSON contenant les informations des fichiers
    product_files_info = response.json()
    # Rechercher le fichier .exe pour Windows correspondant à la langue de control.locale
    exe_file = None
    if 'ch' in product_files_info:
        for file in product_files_info['ch']:
            if isinstance(file, dict) and file['n'].endswith('.AppImage') and file['metas']['os'] == 'linux' and file['metas']['lang'] == lang_dict[control.locale]:
                exe_file = file['metas']['path']
                break
    

    url_download = f"https://download.scenari.software{exe_file}"
    filename = exe_file.split('/')[-1]
    if not isfile(filename):
        package_updated = True
        wget(url_download, filename, proxies=proxies)
        print("Download:", filename)


    for f in glob.glob("*.AppImage"):
        if f != filename:
            remove_file(f)

    control.set_software_version(version)
    control.save_control_to_wapt()

dbf398aa16ae478e7ba1611a1dabf45906e8bbbaecacd36e33dc0d197ac9ab92 : setup.py
beb6bf0aa80b496cd33ec6030dbbf37a7c967609d61e3b821e3c28bd42c808be : Canoprof2_fr-FR.AppImage
a0a3ef7acaf14d9b360c99738468ab27a92d25be705eadc25ab2b094ee1ab455 : update_package.py
ef797ba7d1f86d9a2c9407f83214f30dd35a9ac09e5a8d2fd5003f2625f4e959 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
4967ac76be75be92e7f2fafa7591e0389dee41574288172aa2db3541792551b1 : luti.json
0735818206b3901821efc1cda7d60c84b7bc7a772ab43afb6594530308f4b6d6 : WAPT/control