tis-stellarium icon

Stellarium

Paquet d’installation silencieuse pour Stellarium

0.22.1-3

  • package: tis-stellarium
  • name: Stellarium
  • version: 0.22.1-3
  • categories: Office,Education
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Simon Fonteneau
  • editor: Fabien Chéreau
  • licence: GPLv2
  • locale: all
  • target_os: windows
  • impacted_process: stellarium
  • architecture: x64
  • signature_date:
  • size: 357.22 Mo
  • homepage : https://stellarium.org/
  • depends:

package           : tis-stellarium
version           : 0.22.1-3
architecture      : x64
section           : base
priority          : optional
name              : Stellarium
categories        : Office,Education
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Simon Fonteneau
description       : Stellarium is an open source planetarium software and free for your computer. It displays a realistic 3D sky, as if you are looking at it with the naked eye
depends           : tis-vcredist
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 1.7
sources           : https://github.com/Stellarium/stellarium/releases
installed_size    : 
impacted_process  : stellarium
description_fr    : Stellarium est un logiciel de planétarium open source et gratuit pour votre ordinateur. Il affiche un ciel réaliste en 3D, comme si vous le regardiez à l'œil nu
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : Fabien Chéreau
keywords          : 
licence           : GPLv2
homepage          : https://stellarium.org/
package_uuid      : 36b1a011-ee34-44bb-b9ff-4f14005c39ac
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://github.com/Stellarium/stellarium/blob/master/ChangeLog
min_os_version    : 6.1
max_os_version    : 
icon_sha256sum    : 4a9df2c9a0233881f12bf807a5ae006db3188c207f6be38b0a516f634b0bb7aa
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : PyPSJ1+kS/uV9Mt12OlZK+y/ywBs7rizI0jLks9DSShFP00KPSX3r9vQMxvTGie8pzzsI++BhA+SjxKMAMJsLuSnHK6DYHCFr0f295auaM4CtuzcZE6rW9+4P/aBpZiQdVSR8TQ6BGPMWBpngv6jgJoZF1HONw48klA513qdxy3/aWXh3pH8oIvzzcJ2G9Z9VibGjtwciUj9HmDCfvuSEzuFkZFSbP214MSFX7TfP2hXQ3WTRnEml07+IUP/nhamzyto05d0lBx4A5whDtukWRyvvEnQsC5xIOxNwcc3c8KBSO6OFHswypPByyHXScTB6OUHvmnhGcj0Gr0BwAvipg==
signature_date    : 2022-04-21T22:07:36.142504
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 json

# 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_contains = 'stellarium-'
silent_args = '/VERYSILENT'
app_uninstallkey = 'Stellarium_is1'


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob('*%s*.exe' % bin_contains)[0]

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

def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    bin_name_sub = bin_contains + '-%s.exe'
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    git_repo = 'Stellarium/stellarium'
    url_api = 'https://api.github.com/repos/%s/releases/latest' % git_repo
    if control.architecture == 'x64':
        arch = 'win64'
    else:
        arch = 'win32'

    # Getting latest version information from official sources
    print("API used is: %s" % url_api)
    json_load = json.loads(wgets(url_api, proxies=proxies))

    for download in json_load['assets']:
        if bin_contains in download['name'] and arch in download['name']:
            url_dl = download['browser_download_url']
            version = json_load['tag_name'].replace('v', '')
            latest_bin = download['name']
            break

    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 and version_from_file != '':
            print("Changing version to the version number of the binary")
            os.rename(latest_bin,bin_name_sub % version_from_file)
            version = version_from_file

    # 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
    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 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 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)

cc5cb6ee6aa4a57723d2b229b9c3e701ede0db248e6bdf55014fd9cd7ce0a84d : setup.py
769e647a6b977ae6b03bc6b9290552bc5ad6a9071b53a7fee7f5291b9229e396 : stellarium-0.22.1-win64.exe
4a9df2c9a0233881f12bf807a5ae006db3188c207f6be38b0a516f634b0bb7aa : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
1c871cf5a8d21f787eece7225a20081aaf66366b3763fd7f1f04da29a8f0085f : luti.json
94d345ad26c1dd3402a188d6bf0841dc57b37b22eace07512e8a3e0391ebc0e3 : WAPT/control