tis-firefox 54.0-98

  • package : tis-firefox
  • version : 54.0-98
  • description : Navigateur Web Firefox Français Windows >=7 (désactivés : pdfjs, mises à jour, ipv6, migration, télémétrie), proxy wpad
  • maintainer : TIS <technique@tranquil-it-systems.fr>
  • date : 2018-02-27 18:59:28


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

uninstallkey = []

def need_install(key,min_version=None,force=False):
    """Return True if the software with key can be found in uninstall registry
        and the registred version is equal or greater than min_version

        key (str) : uninstall key
        min_version (str) : minimum version or None if don't check verion

    if force or not key:
        return True
        current = installed_softwares(uninstallkey=key)
        for soft in current:
            if not min_version or Version(soft['version']) >= Version(min_version):
                return False
        return True

def install_exe_if_needed(exe,silentflags='',key=None,min_version=None,killbefore=[],accept_returncodes=[0,1603,3010],timeout=300):
    """Install silently the supplied setup executable file, and add the uninstall key to
    global uninstallkey list if it is defined.

    Check if already installed at the supllied min_version.

    Kill the processes in killbefore list before launching the setup.

    Raises an error if, after the setup install, the uninstall key is not found in registry.

        exe (str) : path to the setup exe file
        silentflags (str) : flags to append to the exe command line for silent install
                            if not provided, tries to guess them.
        key (str) : uninstall key to check in registry and to add to uninstallkey global list
        min_version (str) : if installed version is equal or gretaer than this, don't install
                            if not provided, guess it from exe setup file properties.
        kill_before (list of str) : processes to kill before setup, to avoid file locks

    if not isfile(exe):
        error('setup exe file %s not found in package' % exe)
    if not silentflags:
        silentflags = getsilentflags(exe)
    if not min_version:
        min_version = getproductprops(exe)['version']

    import inspect
    caller_globals = inspect.stack()[1][0].f_globals
    WAPT = caller_globals.get('WAPT',None)
    force = WAPT and WAPT.options.force

    if need_install(key,min_version=min_version,force=force):
        if killbefore:
        run(r'"%s" %s' % (exe,silentflags),accept_returncodes=accept_returncodes,timeout=timeout)
        if key and not installed_softwares(uninstallkey=key):
            error('Setup %s has been ran but the uninstall key %s can not be found' % (exe,key))
        print('Exe setup %s already installed. Skipping' % exe)
    if key:
        # will try to add key in the caller's (setup.py) uninstallkey list
        if 'uninstallkey' in caller_globals and not key in caller_globals['uninstallkey']:

def install():
    if windows_version() < Version('6.1'):
        error("Firefox >= 53 n'est plus disponible pour XP")
    version = control.version.split('-',1)[0]
    ukey = 'Mozilla Firefox %s (x86 fr)'%version
    exe = 'Firefox Setup %s.exe'%version

    print("Disabling auto update")
    filecopyto("mozilla.cfg",makepath(programfiles32,"Mozilla Firefox"))
    filecopyto("local-settings.js",makepath(programfiles32,"Mozilla Firefox","defaults","pref"))

    print ("Disabling profile migration from ie")
    filecopyto("override.ini",makepath(programfiles32,"Mozilla Firefox","browser"))

    print ("Override User UI")
    ensure_dir(makepath(programfiles32,"Mozilla Firefox","browser","defaults","profile","chrome",""))
    filecopyto("userChrome.css",makepath(programfiles32,"Mozilla Firefox","browser","defaults","profile","chrome"))

    print ("Deploy extensions")
    ensure_dir(makepath(programfiles32,"Mozilla Firefox","browser","extensions",""))
    copytree2("extensions",makepath(programfiles32,"Mozilla Firefox","browser","extensions"))

def update_package():
    """updates the package / control version with the latest stable firefox version"""
    import re,requests,urlparse,glob

    # get index of all dowloads
    #url_base = 'https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest/win32/fr/'
    url_base = 'https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win32/fr/'
    index = wgets(url_base)

    # get list of lastest french versions
    re_setup = re.compile(r'<a href=".*/(Firefox%20Setup%20[0-9.]*.exe)">Firefox Setup .*</a>')
    filename = urlparse.unquote(re_setup.findall(index)[0])
    url = url_base+filename
    url = requests.head('https://download.mozilla.org/?product=firefox-latest&os=win&lang=fr').headers['Location']
    filename = urlparse.unquote(url.rsplit('/',1)[1])

    if not isfile(filename):
        print('Downloading %s from %s'%(filename,url))

    # removes old exe
    if isfile(filename):
        exes = glob.glob('Firefox*.exe')
        for fn in exes:
            if fn != filename:

        # updates control version from filename, increment package version.
        control = PackageEntry().load_control_from_wapt ('.')
        control.version = '%s-%s'%(re.findall('Firefox Setup (.*)\.exe',filename)[0],int(control.version.split('-',1)[1])+1)

if __name__ == '__main__':



[["override.ini", "6cf83b6dcb57e3b08fc64a81c0bb1b2a0f65b4d0"], ["local-settings.js", "a18e82bed82bc9de6ab48dfdeb8cfbf364f1f34a"], ["WAPT/icon.png", "e9148eecf1132466e00621255540168529d53f2d"], ["WAPT/certificate.crt", "a7ed3fe555e7a67200e5002c7ad9139d4c7489c9"], ["WAPT/wapt.psproj", "557e60050809687d56525e6ac46df9c0e02ccae6"], ["Firefox Setup 54.0.exe", "a2a9d5f88fc176a703d8dd353fdc8c2ad314b401"], ["setup.py", "10a95d448107aad463662d00bdf5b5cc55f33a6d"], ["WAPT/changelog.txt", "52124537b41207cc868ecccd24b78ec16bd24246"], ["userChrome.css", "b637e26f5c89b51a99bce1b8f3fab2c4163fb932"], ["WAPT/control", "1760fbce036de3d72ee520d4b5011819c4fea4b0"], ["mozilla.cfg", "ca6eb0c77e4af3428f4f47df6f14766fc88c6392"]]