tis-deepl icon

DeepL

Paquet d’installation silencieuse pour DeepL

3.5.25837-0

  • package: tis-deepl
  • name: DeepL
  • version: 3.5.25837-0
  • categories: Office,Utilities
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • locale: all
  • target_os: windows
  • impacted_process: DeepL
  • architecture: all
  • signature_date:
  • size: 151.97 Mo
  • homepage : https://www.deepl.com/

package           : tis-deepl
version           : 3.5.25837-0
architecture      : all
section           : base
priority          : optional
name              : DeepL
categories        : Office,Utilities
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : DeepL Translator is a neural machine translation service
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.0
sources           : https://www.deepl.com/app/
installed_size    : 
impacted_process  : DeepL
description_fr    : DeepL est un service de traduction automatique
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : https://www.deepl.com/
package_uuid      : 3b7f633d-033b-402a-a9de-f5f46bbba8c4
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 2cc45845a553e6f3939b26037578f62a894c89b3b5d33c12a172aaa1dd83accf
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : etLdo+65QA/obHKVTqqGU6+6tpeMRLWX8KuO31hx5CEmTQPFjwf9/5483CwDh+kN0auTXp96OaUFIQGyfZP4he/DrB9vAlu3soj+c8rPwEcFapAOPKaSTq8Rbbn01AiiD8NJ608jiSrku3UlQ5UnsajUT3WE0pamjNDbCfCznli+lJnVzONAK8NEoub7r7+n4jUewVe475T1wbiC/AkWazPeoh0REiKqGEJb37rpJ+Wg2X8QLuwxziZubGb+Q9rtzXDK4C5kW3sqVd5nUEJqdlqyftc9QEUDdYAiS7euA+qeATlC9Qlkkid8NMkd9ebaJMYv/pP5sifSk79Ui5xPBQ==
signature_date    : 2022-06-16T04:07:28.456555
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 platform
import win32con
import time

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_name = "DeepLSetup.exe"
app_name = "DeepL"
app_dir = makepath(programfiles, app_name)
bin_path = makepath(app_dir, bin_name)


def install():
    # Installing the package
    mkdirs(app_dir)
    print("Copying: %s to: %s" % (bin_name, app_dir))
    filecopyto(bin_name, app_dir)


def uninstall():
    # Uninstalling the package
    killalltasks('DeepL.exe')
    time.sleep(5)
    if isdir(app_dir):
        remove_tree(app_dir)
    for f in glob.glob(r'C:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\DeepL.lnk'):
        remove_file(f)
    for f in glob.glob(r'C:\Users\*\Desktop\DeepL.lnk'):
        remove_file(f)
    for d in glob.glob(r'C:\Users\*\AppData\Local\DeepL*'):
        remove_tree(d)


def session_setup():
    # Declaring local variables
    package_version = control.version.split("-")[0]
    user_reg_version = ".".join(
        registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DeepL", "DisplayVersion").split(".")[:4]
    )
    user_app_dir = makepath(user_local_appdata(), app_name)
    user_app_path = makepath(user_app_dir, "DeepL.exe")
    user_app_updater_path = makepath(user_app_dir, "Update.exe")

    # Determining to install the software or not based on user agreement
    if not registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "Install") or force:
        if params.get("install_with_luti", False):
            ask_to_install = 6
        else:
            ask_to_install = messagebox(
                "Configuring %s" % app_name, "Do you want to install %s on this user account?" % app_name, style=win32con.MB_YESNOCANCEL
            )
        if ask_to_install == 6:
            registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "Install", "Yes")
        elif ask_to_install == 7:
            registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "Install", "No")

    # Installing or Uninstalling the software in user environment
    if registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "Install") == "Yes":
        if Version(package_version) > Version(user_reg_version) or user_reg_version == "":
            print("Installing: %s (%s) in user environment" % (bin_name, package_version))
            install_exe_if_needed(bin_path, silentflags="-s", min_version=package_version)
    elif registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "Install") == "No":
        if isfile(user_app_updater_path):
            killalltasks(control.get_impacted_process_list())
            run('"%s" %s' % (user_app_updater_path, "--uninstall -s"), accept_returncodes=[0, 3010])  # , 4294967295
            if isdir(user_app_dir):
                time.sleep(30)  # Waiting since uninstall may still running
                remove_tree(user_app_dir)
        registry_delete(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "DisableAutorunOnce")

    # Disabling app autorun
    if not reg_value_exists(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "DisableAutorunOnce"):
        time.sleep(20)  # Waiting since install may still running
        registry_delete(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", app_name)
        registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\%s" % app_name, "DisableAutorunOnce", "Done")


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    url = "https://www.deepl.com/app/"
    download_url = "https://www.deepl.com/windows/download/full/DeepLSetup.exe"
    latest_bin = download_url.split("/")[-1]

    # Downloading latest binaries
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)

    # Checking version from file
    version = get_version_from_binary(latest_bin)

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        result = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.version = "%s-%s" % (Version(version), control.version.split("-", 1)[-1])
    # control.set_software_version(version)
    control.save_control_to_wapt()

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # Validating update-package-sources
    return result


def remove_outdated_binaries(version, list_extensions=["exe", "msi", "deb", "rpm", "dmg", "pkg"], filename_contains=None):
    r"""Remove files based on the version contained in his filename, failing over on file version on compatible OSes

    Args:
        version (str): version number of keeped files
        list_extensions (str or list of str): file extensions of compared files
        filename_contains (str or list of str): Part of the filename that must be contained (useful for distinguishing architecture and os)

    Returns:
        list: list of deleted files

    .. versionadded:: 2.0

    .. versionchanged:: 2.2
        Now returns removed files, now checking .exe and .msi file versions

    """
    files = []
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if filename_contains:
        if type(filename_contains) != list:
            filename_contains = [filename_contains]
    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:
                if platform.system() == "Windows":
                    if file_ext == ".exe" or file_ext == ".msi":
                        if Version(version) == Version(get_product_props(bin_in_dir)["FileVersion"]) or Version(version) == Version(
                            get_product_props(bin_in_dir)["ProductVersion"]
                        ):
                            print("%s file or product version is correct (%s)" % (bin_in_dir, version))
                            continue
                remove_file(bin_in_dir)
                files.append(bin_in_dir)
            if filename_contains:
                for filename_contain in filename_contains:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)
                        files.append(bin_in_dir)
    return [fn for fn in files]

2b966b5ccdb5346d7c4d983d1fa91f6db5c035f95be56a0ecf05545128354df3 : setup.py
bd7d7725df388b84455479d88dc284b7b466be1ba3247765805debda3d903328 : DeepLSetup.exe
2cc45845a553e6f3939b26037578f62a894c89b3b5d33c12a172aaa1dd83accf : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
8d03cb221b11477bf0d6c45c90641fd1a2848381550a7be0032c40d2f26e77c2 : luti.json
32fa57f41cd400b12f7dd5a7137356d8d7a3b18948e7ca1ebf70a85c9b441646 : WAPT/control