tis-greenshot

1.2.10.6-10
Greenshot is a free and open-source screenshot program
2916 downloads
Download

  Description 

  • package : tis-greenshot
  • version : 1.2.10.6-10
  • architecture : all
  • categories : Utilities
  • maintainer : WAPT Team, Tranquil IT, Jimmy PELÉ
  • description : Greenshot is a free and open-source screenshot program
  • locale : all
  • target_os : windows
  • min_wapt_version : 1.7
  • sources : https://github.com/greenshot/greenshot
  • installed_size :
  • impacted_process : Greenshot
  • description_fr : Greenshot est un programme de capture d'écran gratuit et open-source
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : Thomas Braun, Jens Klingen, Robin Krom
  • licence : GPLv3
  • signature_date : 2020-07-27T12:37:44.674631
  • Homepage : https://getgreenshot.org/

  Setup.py 

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

uninstallkey = []

# Defining variables
bin_name_string = 'Greenshot-INSTALLER-%s-RELEASE.exe'
app_uninstallkey = 'Greenshot_is1'
conf_file = 'install.inf'
silent_args = '/LOADINF=install.inf /VERYSILENT /NORESTART'


def install():
    # Initializing variables
    package_version = control.version.split('-',1)[0]
    bin_name = bin_name_string % package_version
    basedir_conf_file = makepath(basedir,conf_file)
    app_dir = makepath(programfiles,'Greenshot')

    # Adapting install.inf to the system
    inifile_writestring(basedir_conf_file,'Setup','Lang',get_language())
    inifile_writestring(basedir_conf_file,'Setup','Dir',app_dir)
    #inifile_writestring(basedir_conf_file,'Setup','Tasks','') # For disabling launch on startup
    #inifile_writestring(basedir_conf_file,'Setup','Tasks','startup') # For allowing launch on startup (default)

    # Installing the package
    print('Installing: %s' % bin_name)
    install_exe_if_needed(bin_name
        ,silentflags=silent_args
        ,key=app_uninstallkey
        ,min_version=package_version)


def session_setup():
    print("Disabling: auto-update-check")
    user_conf_file = 'Greenshot.ini'
    user_conf_dir = makepath(user_appdata,'Greenshot')
    user_conf_path = makepath(user_conf_dir,user_conf_file)

    killalltasks(control.impacted_process)

    # Debugging ini file
    if isfile(user_conf_path):
        fichier = open(user_conf_path,"r")
        data = fichier.read()
        fichier.close()

        if '\xef\xbb\xbf; Greenshot core configuration\n[Core]\n' in data :
            data = data.replace('\xef\xbb\xbf; Greenshot core configuration\n[Core]\n','[Core]\n; Greenshot core configuration\n')

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

    inifile_writestring(user_conf_path,'Core','UpdateCheckInterval','0')


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

    # Initializing variables
    app_name = control.name
    git_repo = 'greenshot/greenshot'
    url_api = 'https://api.github.com/repos/%s/releases/latest' % git_repo
    #bin_end = bin_name_string.split('%s')[-1]
    bin_start = bin_name_string.split('%s')[0]
    proxies = get_proxies()


    # Getting latest version from official website
    print('API used is: ' + url_api)
    json_load = json.loads(wgets(url_api,proxies=proxies))

    for download in json_load['assets']:
        if download['name'].startswith(bin_start):
            url_dl = download['browser_download_url']
            break

    version = json_load['tag_name'].split('-')[-1].replace('v','')
    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 is_version_different(version,version_from_file):
            rename_filename_version(latest_bin,version,version_from_file)

        # Changing version of the package
        update_control_version(version)
        print('Changing version to: %s in WAPT\\control' % control.version)

    # Deleting outdated binaries
    remove_outdated_binary(version)



def get_language(full_locale=False,use_underscore=True):
    import ctypes
    import locale
    windll = ctypes.windll.kernel32
    windll.GetUserDefaultUILanguage()
    win_lang = locale.windows_locale[windll.GetUserDefaultUILanguage()]
    if not use_underscore:
        win_lang.replace('_','-')
    if full_locale:
        return win_lang
    else:
        return win_lang.split('_')[0].split('-')[0]

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 update_control_version(version=control.version.split('-')[0]):
    control.version = '%s-%s'%(version,int(control.version.split('-')[-1])+1)
    control.save_control_to_wapt()

def is_version_different(version_x,version_y):
    if version_x == '':
        return False
    if version_y == '':
        return False
    if Version(version_x) != Version(version_y):
        return True
    else:
        return False

def remove_outdated_binary(version,list_extensions=('exe','msi','deb','rpm','dmg','pkg')):
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob('*.%s' % file_ext):
            if not version in bin_in_dir:
                print('Outdated binary: %s Removed' % bin_in_dir)
                remove_file(bin_in_dir)

def rename_filename_version(filename,old_version,new_version):
    old_filename = filename
    new_filename = filename.replace(old_version,new_version)
    if isfile(new_filename):
        remove_file(new_filename)
    os.rename(old_filename,new_filename)

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

										

  Changelog 



Changelog software url : https://github.com/greenshot/greenshot/releases



No changelog.txt.
									
  manifest.sha256