tis-typst-portable icon

typst

Silent install package for typst

0.11.1-1

  • package: tis-typst-portable
  • name: typst
  • version: 0.11.1-1
  • maintainer: Amel FRADJ
  • licence: Apache-2.0 license
  • target_os: windows
  • architecture: x64
  • signature_date:
  • size: 14.56 Mo
  • homepage : https://typst.app/

package           : tis-typst-portable
version           : 0.11.1-1
architecture      : x64
section           : base
priority          : optional
name              : typst
categories        : 
maintainer        : Amel FRADJ
description       : A new, powerful and easy-to-learn markup-based composition system
depends           : 
conflicts         : 
maturity          : PROD
locale            : 
target_os         : windows
min_wapt_version  : 
sources           : https://github.com/typst/typst
installed_size    : 
impacted_process  : 
description_fr    : Un nouveau système de composition basé sur le balisage, puissant et facile à apprendre
description_pl    : Nowy system kompozycji oparty na znacznikach, który jest potężny i łatwy do nauczenia
description_de    : Ein neues, auf Markup basierendes Satzsystem, das leistungsstark und leicht zu erlernen ist
description_es    : Un nuevo sistema de composición basado en marcas, potente y fácil de aprender
description_pt    : Um novo sistema de composição baseado em marcação que é poderoso e fácil de aprender
description_it    : Un nuovo sistema di composizione basato su markup, potente e facile da imparare
description_nl    : Een nieuw op markup gebaseerd compositiesysteem dat krachtig en gemakkelijk te leren is
description_ru    : Новая система композиции на основе разметки, мощная и простая в освоении
audit_schedule    : 
editor            : 
keywords          : 
licence           : Apache-2.0 license
homepage          : https://typst.app/
package_uuid      : 0c56dfd4-8b20-4fdf-90d1-eee79a0b1482
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 299c97f82b4e1737475fb5102447fd09d23d2cbda13765e673ef9701a5a01d64
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : V9e9R1bfQ7fGFAURohiAJCVzjB0ZsWzsMr1MVepSkbp4nidjczjBaSJuXWwZFLf/txPPQh+JvQ9BFGDYPnePZI/YXg2PxnWw/oBG7q7m2to4R1Xis58HvaFYo83YPSJ46LfHAKjNkGsmYcZNWQaSgkpVqDrOeyCLvKoG+afT3glNTCu7ikUlzaOLdV4DjV13UPh18GTGqeg1LzNhOtFsRe4smsjIdTFE80/A/YdwMwSAqZ3ZEY79eAByVBVTPrmpqKouaa2FvBudhOfNObwNQd1pLHnn8agtX4hjQU1B4QGqDc3OZiFXX2OgzCEf/xs0QhxIIGBETaHSheEr/s77hA==
signature_date    : 2024-06-22T10:00:56.803795
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 *
import glob
import os

app_name = "typst"
app_dir = makepath(programfiles, app_name)
app_path = makepath(app_dir, "typst.exe")
audit_version = False

def get_installed_version(app_path):
    return get_file_properties(app_path).get("FileVersion", "")

def install():
    # Find the zip file
    zip_name = glob.glob(f"{app_name}*.zip")[0]
    unzip_dest = makepath(".", "temp_dezip")
    
    # Remove the temporary directory if it already exists
    if isdir(unzip_dest):
        remove_tree(unzip_dest)
    
    # Extract the zip file
    print(f"Extracting: {zip_name} to: {unzip_dest}")
    unzip(zip_name, unzip_dest)
    
    # List the contents of the temporary directory
    extracted_files = os.listdir(unzip_dest)
    print(f"Contents of the temporary directory after extraction: {extracted_files}")
    
    # Find the name of the extracted directory or the extracted files
    if not extracted_files:
        raise Exception("No extracted files or directories found")
    
    # If the first extracted item is a directory, use that directory, otherwise use unzip_dest
    first_extracted_item = makepath(unzip_dest, extracted_files[0])
    if isdir(first_extracted_item):
        unzipped_dir = first_extracted_item
    else:
        unzipped_dir = unzip_dest
    
    # Verify that the extracted directory exists
    if not isdir(unzipped_dir):
        raise Exception(f"Invalid source directory for copytree2: {unzipped_dir}")
    
    # Remove the old application directory if it exists
    if isdir(app_dir):
        remove_tree(app_dir)
    
    # Move the new extracted directory or files to the final installation directory
    copytree2(unzipped_dir, app_dir, onreplace=default_overwrite)
    
    # Remove the temporary directory
    remove_tree(unzip_dest)
    
    # Create custom shortcuts
    create_programs_menu_shortcut(app_name, target=app_path)
    
    # Get the desktop path
    desktop_path = os.path.expanduser("~\\Desktop")
    desktop_shortcut_path = makepath(desktop_path, f"{app_name}.lnk")
    
    # Create the desktop shortcut
    print(f"Creating desktop shortcut: {desktop_shortcut_path}")
    create_shortcut(desktop_shortcut_path, target=app_path)
    
    print(f"Desktop shortcut created successfully: {desktop_shortcut_path}")

def create_shortcut(shortcut_path, target):
    try:
        create_desktop_shortcut(shortcut_path, target=target)
        return True
    except Exception as e:
        print(f"Error creating shortcut: {e}")
        return False

def audit():
    # Auditing software
    audit_status = "OK"
    installed_version = get_installed_version(app_path)
    if Version(installed_version) < Version(control.get_software_version()) and audit_version:
        print("%s is installed in version (%s) instead of (%s)" % (app_name, installed_version, control.get_software_version()))
        audit_status = "WARNING"
    elif isdir(app_dir) and not dir_is_empty(app_dir):
        print("%s (%s) is installed" % (app_name, installed_version))
        audit_status = "OK"
    else:
        print("%s is not installed" % app_name)
        audit_status = "ERROR"
    return audit_status

def uninstall():
    # Uninstalling software
    killalltasks(ensure_list(control.impacted_process))
    if isdir(app_dir):
        remove_tree(app_dir)

    # Removing shortcuts
    desktop_path = os.path.expanduser("~\\Desktop")
    desktop_shortcut_path = makepath(desktop_path, f"{app_name}.lnk")
    
    if os.path.exists(desktop_shortcut_path):
        print(f"Removing desktop shortcut: {desktop_shortcut_path}")
        os.remove(desktop_shortcut_path)
    
    remove_programs_menu_shortcut(app_name)

    # Additional check
    if os.path.exists(desktop_shortcut_path):
        print(f"Failed to remove desktop shortcut: {desktop_shortcut_path}")
    else:
        print(f"Desktop shortcut removed successfully: {desktop_shortcut_path}")

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

# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls


def update_package():
    result = False
    proxies = get_proxies()
    
    if not proxies:
        proxies = get_proxies_from_wapt_console()
   
    git_repo = "typst/typst"
    url_api = "https://api.github.com/repos/%s/releases/latest" % git_repo   
    # Getting latest version information from official sources
    print("API used is: %s" % url_api)
    json_load = json.loads(wgets(url_api, proxies=proxies))

    for download in json_load["assets"]:
        if download["browser_download_url"].endswith('.zip') :
            url_dl = download["browser_download_url"]
            version = json_load["tag_name"].replace("v","")
            filename = download["name"]
            break

    if not isfile(filename):
        package_updated = True
        wget(url_dl,filename,proxies=proxies)

    #nettoyer les fichiers temporaires
    for f in glob.glob('*.zip'):
        if f != filename:
            remove_file(f)
    
    control.set_software_version(version)
    control.save_control_to_wapt()

ca0b797810fa414ea150a8534a6fe3e85afa5090dac8d5f6508c6485297af00e : setup.py
6f6896f199649717f0e1ff4aff0d5f62531e140796c1891304168fd546be2516 : typst-x86_64-pc-windows-msvc.zip
a7c3ce2ebc79eab34224d442609f54e9391d3d0f2234b6fb7f1490a11e5825cb : update_package.py
299c97f82b4e1737475fb5102447fd09d23d2cbda13765e673ef9701a5a01d64 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
1f866be8656a0a9edadaba93258d16438bfdcadd587999d2151940bb592a18b3 : luti.json
f1df07f836c74aab6d86b306a97e18807150b3843ce95bf5dc60359f581483c3 : WAPT/control