tis-gimp

2.10.24-2
GIMP (GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image retouching and editing, free-form drawing, converting between different image formats, and more specialized tasks.
11925 downloads
Download

  Description 

  • package : tis-gimp
  • version : 2.10.24-2
  • architecture : all
  • categories : Media
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELE,Simon Fonteneau
  • description : GIMP (GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image retouching and editing, free-form drawing, converting between different image formats, and more specialized tasks.
  • locale : all
  • target_os : windows
  • min_os_version : 6.1
  • max_os_version :
  • min_wapt_version : 1.5
  • sources : https://gimp.org/downloads/
  • installed_size :
  • impacted_process : gimp
  • description_fr : GIMP (GNU Image Manipulation Program) est un outil d'édition et de retouche d'image
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : The GIMP Development Team
  • licence : GPLv3+
  • signature_date : 2021-05-11T17:26:13.430381
  • Homepage : https://www.gimp.org/

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform
import bs4 as BeautifulSoup

# Declaring specific app values (TO CHANGE)
bin_name_string = 'gimp-%s-setup.exe'
silent_args = '/VERYSILENT /NORESTART /RESTARTEXITCODE=3010 /SUPPRESSMSGBOXES /SP- --disable-check-update'
app_uninstallkey = 'GIMP-2_is1'
sys_conf_file = makepath(programfiles,'GIMP 2','etc','gimp','2.0','gimprc')


def install():
    # Specific app values
    package_version = control.version.split('-')[0]
    bin_name = bin_name_string % package_version
    bin_name_glob = glob.glob(bin_name.split('.')[0]+'*')[0]

    # Installing the package
    install_exe_if_needed(bin_name_glob
        ,silentflags=silent_args
        ,key=app_uninstallkey
        ,min_version=package_version)

    # Disabling update check
    if isfile(sys_conf_file):
        fichier = open(sys_conf_file,"r")
        data = fichier.read()
        fichier.close()

        if '# (check-updates yes)' in data :
            data = data.replace('# (check-updates yes)','(check-updates no)')
        if '(check-updates yes)' in data :
            data = data.replace('(check-updates yes)','(check-updates no)')

        fichier = open(sys_conf_file, "w")
        fichier.write(data)
        fichier.close()


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name

    # Specific app values
    app_name = control.name
    url = control.sources

    # Getting latest version from official website
    bs_raw_string = bs_find(url,'a','id','win-download-link',proxies=proxies)

    url_dl = 'https:%s' % bs_raw_string['href']
    latest_bin = url_dl.split('/')[-1]
    version = latest_bin.split('-')[1]

    print('Latest ' + app_name + ' version is: ' + version)
    print('Download url is: ' + url_dl)

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

        # Checking version from file
        version_from_file = get_file_properties(latest_bin)['ProductVersion']
        if version != version_from_file and version_from_file != '':
            print("Changing version to the version number of the binary (from: %s to: %s)" % (version, version_from_file))
            os.rename(latest_bin, latest_bin.replace(version, version_from_file))
            version = version_from_file

		# Changing version of the package
        pe = PackageEntry().load_control_from_wapt('.')
        pe.version = '%s-%s'%(version,int(pe.version.split('-',1)[1])+1)
        pe.save_control_to_wapt('.')
        print('Changing version to ' + pe.version + ' in WAPT\\control')
        print('Update package done. You can now build-upload your package')
    
    
    # Changing version of the package
    if Version(version) != control.get_software_version():
        print("Software updated to version: %s" % Version(version))
        result = True
    control.version = '%s-%s' % (version, control.version.split('-', 1)[-1])
    #control.set_software_version(version)
    control.save_control_to_wapt()

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # 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, verify=False, headers={'User-Agent':'%s' % user_agent}, **kwargs).text
    else:
        page = requests.get(url,verify=False,  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)



										

  Changelog 


Changelog software url : https://www.gimp.org/release-notes/

No changelog
  manifest.sha256 
[["gimp-2.10.24-setup-3.exe","5e9eabe5739523a9fc347b4614d919418f3335e7aab082a65f71705421e85e04"],["setup.py","e4fea5674e9539973e2282843a52621df652ec9b3f0af4970bc53ab1ceafb6ab"],["WAPT/certificate.crt","a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf"],["WAPT/icon.png","8c35540fff46fd75507afc4849687b9846c269e59a681d95d0873ae073a169fc"],["WAPT/control","53173b227db6540acadee7a04dd071e6da4a67ce7067ac5c771d924d3ac2e6fe"]]