tis-7zip

19.0-21
7-Zip is a free and open-source file archiver with a high compression ratio
95100 downloads
Download
default icon

  Description 

  • package : tis-7zip
  • version : 19.0-21
  • architecture : x64
  • 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
  • locale : all
  • target_os : windows
  • min_wapt_version : 1.7
  • 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 свободный файловый архиватор с высокой степенью сжатия данных
  • editor : Igor Pavlov
  • licence : LGPL
  • signature_date : 2020-09-18T11:03:14.734390
  • Homepage : https://www.7-zip.org/

  Setup.py 

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

uninstallkey = []

# Defining variables
bin_name_string = '7z%s-x64.msi'
ext_file_association = ('.001','.7z','.arj','.bz2','.bzip2','.cab','.cpio','.deb','.dmg','.fat','.gz','.gzip','.hfs','.iso','.lha','.lzh','.lzma','.ntfs','.rar','.rpm','.squashfs','.swm','.tar','.taz','.tbz','.tbz2','.tgz','.tpz','.txz','.vhd','.wim','.xar','.xz','.z','.zip','.zipe')


def install():
    # Initializing variables
    package_version = control.version.split('-',1)[0]
    bin_end = bin_name_string.split('%s')[-1]
    bin_name = glob.glob('*%s' % bin_end)[0]
    app_name = control.name

    # Uninstalling others versions
    for uninstall in installed_softwares(name=app_name):
        if Version(uninstall['version']) != Version(get_version_from_binary(bin_name)):
            print('Incorrect version of %s found: %s (%s)' % (app_name, uninstall['name'], uninstall['version']))
            print('Removing: %s (%s)' % (uninstall['name'], uninstall['version']))
            run(uninstall_cmd(uninstall['key']))

    # Installing the package
    print('Installing: %s' % bin_name)
    install_msi_if_needed(bin_name,
        min_version=package_version)

    # File association for 7-Zip
    for ext in (ext_file_association):
        register_ext('7-zip',ext,'"%s" "%%1"' % (makepath(programfiles, '7-zip', '7zFM.exe')), icon="%s,1" % (makepath(programfiles, '7-zip', '7z.dll')))


def session_setup():
    print('Disabling: CRC Context Menu')
    registry_set(HKEY_CURRENT_USER, r'Software\7-Zip\Options', 'ContextMenu', 16247, REG_DWORD)


def update_package():
    print('Downloading/Updating package content from upstream binary sources')

    # Initializing variables
    proxies = get_proxies()
    app_name = control.name
    url = control.sources
    bin_end = bin_name_string.split('%s')[-1]

    # Getting latest version from official website
    print('URL used is: ' + url)
    version = bs_find_all(url, 'b', proxies=proxies)[1].text.split('Zip ')[-1].split(' (')[0]
    for parturl in bs_find_all(url, 'a', proxies=proxies):
        if parturl['href'].endswith(bin_end):
            url_part = parturl['href']
            break
    url_dl = 'https://www.7-zip.org/%s' % url_part
    latest_bin = bin_name_string % version

    print("Latest %s version is: %s" % (app_name,version))
    print("Download url is: %s" % url_dl)

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

        """ # Checking version from file
        version_from_file = get_version_from_binary(latest_bin)
        if version != version_from_file:
            os.rename(latest_bin,bin_name_string % version_from_file)
            version = version_from_file """

        # Changing version of the package
        control.version = '%s-%s'%(version,int(control.version.split('-')[-1])+1)
        control.save_control_to_wapt()
        print('Changing version to: %s in WAPT\\control' % control.version)

    # Deleting outdated binaries
    remove_outdated_binaries(version)




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


def get_version_from_binary(filename):
    if filename.endswith('.msi'):
        return get_msi_properties(filename)['ProductVersion']
    else:
        return get_file_properties(filename)['ProductVersion']


def remove_outdated_binaries(version, list_extensions=['exe','msi','deb','rpm','dmg','pkg'], list_filename_contain=None):
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if list_filename_contain:
        if type(list_filename_contain) != list:
            list_filename_contain = [list_filename_contain]
    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 list_filename_contain:
                for filename_contain in list_filename_contain:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)


def bs_find_all(url, element, attribute=None, value=None, headers=None, proxies=None, features='html.parser', **kwargs):
    """"You may need to use a header for some websites. For example: headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'}
    """
    import requests
    page = requests.get(url, proxies=proxies, headers=headers, **kwargs).text
    try:
        import bs4 as BeautifulSoup
        soup = BeautifulSoup.BeautifulSoup(page, features=features)
    except:
        import BeautifulSoup
        soup = BeautifulSoup.BeautifulSoup(page)
    if value:
        return soup.findAll(element,{attribute:value})
    else:
        return soup.findAll(element)




										

  Changelog 



Changelog software url : https://www.7-zip.org/history.txt



No changelog.txt.
									
  manifest.sha256