tis-7zip icon

7-Zip

Paquet d’installation silencieuse pour 7-Zip

16.02-37
Utilities
Utilities

  • package: tis-7zip
  • name: 7-Zip
  • version: 16.02-37
  • categories: Utilities
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • editor: Igor Pavlov
  • licence: LGPL
  • locale: all
  • target_os: debian_based
  • impacted_process: 7zFM,7z,7zG
  • architecture: all
  • signature_date:
  • size: 7.18 Ko
  • homepage : https://www.7-zip.org/

package           : tis-7zip
version           : 16.02-37
architecture      : all
section           : base
priority          : optional
name              : 7-Zip
categories        : Utilities
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : 7-Zip is a free and open-source file archiver with a high compression ratio
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : debian_based
min_wapt_version  : 2.0
sources           : https://www.7-zip.org/download.html
installed_size    : 
impacted_process  : 7zFM,7z,7zG
description_fr    : 7-Zip est un logiciel gratuit et open source d'archivage de fichiers avec un taux de compression élevé
description_pl    : 
description_de    : 7-Zip ist ein Datenkompressionsprogramm mit einer hohen Kompressionsrate
description_es    : 7-Zip es un archivador de ficheros con una alta relación de compresión
description_pt    : O 7-Zip é um compactador de arquivos com alta taxa de compressão
description_it    : 
description_nl    : 
description_ru    : 7-Zip свободный файловый архиватор с высокой степенью сжатия данных
audit_schedule    : 
editor            : Igor Pavlov
keywords          : 7zip,7,zip,7-zip,file,archiver,high,compression,ratio
licence           : LGPL
homepage          : https://www.7-zip.org/
package_uuid      : e35d44b1-d192-4eff-a6b2-f56eea1af202
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://www.7-zip.org/history.txt
min_os_version    : 5.0
max_os_version    : 
icon_sha256sum    : eddc038d3625902b6ddeaabd13dd91529e8d457ffbd0c554f96d343ae243a67a
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : lw+c60QAse8ruA4rGtKbJ1K3HTA/zP2e9Fj9G8Tvh93IhBEYlS0p6mDUK5YuuwEEKNwtCa3zWYMeHcW+qj4duEY22pxESICNBNPVGR+HTC84NgcUmVAN/9cYXvRGTvw4iB+LE7PflgiM7HMfyS4EX0oOyddVwL6kT6cxvyIOql7uI1XU1lpl+vJFHX3VEv3EID5Y7yPfqpNqdVTmEzgx94N8Ed0Ki74QRxW3wUVdyloEeEMmwcQ01yCpvuY8EDf2OGCRFmUi2qhC4sqI8BY+qcKR0ifFmHLebmr21nppTQ4sNa2A5My2cHxiu3SWoeApZbjXjywAuolqoeZM1jACGQ==
signature_date    : 2022-06-07T10:18:14.823141
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 bs4 as BeautifulSoup

package_name = "p7zip-full"


def install():
    # Installing the package
    print("Installing: %s" % package_name)
    install_apt(package_name)


def uninstall():
    # Uninstalling the package
    print("Uninstalling: %s" % package_name)
    uninstall_apt(package_name)
    uninstall_apt("p7zip")


def update_package():
    result = False
    # Getting proxy informations from WAPT settings
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    # Specific app values
    url = "https://packages.debian.org/sid/amd64/p7zip-full/download"

    # Getting latest version from official website

    for u in bs_find_all(url, "a", proxies=proxies):
        if "ftp.fr.debian.org/debian" in u.text:
            latest_version = u["href"].split("+")[0].split("_")[-1]
            break

    print("Latest  version is: %s" % latest_version)

    # changing version of the package
    if Version(latest_version) != control.get_software_version():
        result = True
    control.version = "%s-%s" % (latest_version, control.version.split("-", 1)[-1])
    # control.set_software_version(version)
    control.save_control_to_wapt()

    # validating or not update-package-sources
    return result


def get_proxies():
    r"""Return system proxy with the urllib python library

    >>> get_proxies()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    if platform.python_version_tuple()[0] == "3":
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_proxies_from_wapt_console():
    r"""Return proxy information from the current user WAPT console

    >>> get_proxies_from_wapt_console()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    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 bs_find(url, element, attribute=None, value=None, user_agent=None, proxies=None, features="html.parser", **kwargs):
    r""" "Parse html web page with BeautifulSoup and get the first result

    Args:
        url (str): url of the web page to parse
        element (str): searched element
        attribute (str): selected attribute of the element
        value (str): value of the selected attribute
        user_agent (str): specify a user-agent if needed
        proxies (dict): specify your proxy if needed
        **kwargs (str): joker for requests parameters
        features (str): bs feature to use


    >>> bs_find('https://www.w3.org/', 'a', 'title', 'Open Web Platform testing')['href']
    'https://web-platform-tests.org/'

    >>> bs_find('https://www.w3.org/', 'span', 'class', 'alt-logo').string
    'W3C'

    .. versionadded:: 2.0

    """
    import requests

    if user_agent:
        page = requests.get(url, proxies=proxies, headers={"User-Agent": "%s" % user_agent}, **kwargs).text
    else:
        page = requests.get(url, proxies=proxies, **kwargs).text
    soup = BeautifulSoup.BeautifulSoup(page, features=features)
    if value:
        return soup.find(element, {attribute: value})
    else:
        return soup.find(element)


def bs_find_all(url, element, attribute=None, value=None, user_agent=None, proxies=None, features="html.parser", **kwargs):
    r""" "Parse html web page with BeautifulSoup and get a list of the result

    Args:
        url (str): url of the web page to parse
        element (str): searched element
        attribute (str): selected attribute of the element
        value (str): value of the selected attribute
        user_agent (str): specify a user-agent if needed
        proxies (dict): specify your proxy if needed
        **kwargs (str): joker for requests parameters
        features (str): bs feature to use


    >>> bs_find_all('https://www.w3.org/', 'a', 'title', 'Open Web Platform testing')[0]['href']
    'https://web-platform-tests.org/'

    >>> bs_find_all('https://www.w3.org/', 'span', 'class', 'alt-logo')[0].string
    'W3C'

    .. versionadded:: 2.0

    """
    import requests

    if user_agent:
        page = requests.get(url, proxies=proxies, headers={"User-Agent": "%s" % user_agent}, **kwargs).text
    else:
        page = requests.get(url, proxies=proxies, **kwargs).text
    soup = BeautifulSoup.BeautifulSoup(page, features=features)
    if value:
        return soup.find_all(element, {attribute: value})
    else:
        return soup.find_all(element)


def get_version_from_binary(filename, property_name="ProductVersion"):
    r"""Get installer version from file informations, for now, only exe and msi files are compatibles

    Args:
        filename (str): path to the file
        property_name (str): selected property

    Returns:
        str: version number

    """
    if filename.endswith(".msi"):
        return get_msi_properties(filename)[property_name]
    else:
        return get_file_properties(filename)[property_name]


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

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

    Returns:
        None

    .. versionadded:: 2.0

    """
    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:
                remove_file(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)

9a1ca60e7220cb6e0397e96111b1a62bae60740d553580e91df7514fb1ac2566 : setup.py
eddc038d3625902b6ddeaabd13dd91529e8d457ffbd0c554f96d343ae243a67a : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
f9c2e3502bfd167caa9072c2a3c8686efd2418646143160ecc12b723dae95e93 : luti.json
42dc1e440adcd2bffc1bf8273e6ad730ec16625a1ee4a9dc2cbcce268ee593f6 : WAPT/control