tis-libreoffice-stable 5.3.6.1-31

  • package : tis-libreoffice-stable
  • version : 5.3.6.1-31
  • description : Suite Bureautique LibreOffice Old stable + Aide. Désinstalle libreooffice 3.xx et OpenOffice 3.xx
  • maintainer : TIS <technique@tranquil-it-systems.fr>
  • date : 2017-09-13 10:21:56
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20170913-102153
  • min_os_version :
  • min_wapt_version :

setup.py

#!/usr/bin/python
# -*- coding: utf-8 -*-

import platform
from setuphelpers import *

uninstallkey = []


def install():

    """
    # FOR x64 install
    msis = glob.glob('*.msi')
    for (msi,name) in msis:
       if iswin64():
          if not 'x64' in msi:
             remove_file(msi)
       else:
          if not 'x86' in msi:
             remove_file(msi)
    """

    libre_office_exe = ['soffice.exe','sbase.exe','scalc.exe','sdraw.exe','simpress.exe','smath.exe','swriter.exe']

    for msi in glob.glob('*.msi'):
        if not 'helppack' in msi:
            versionsoft = get_msi_properties(msi)['ProductVersion']


    """Called by wapt-get or waptservice to install the package"""
    old_libreoff = installed_softwares('libreoffice')
    old_openoff = installed_softwares('openoffice')
    old_office = old_libreoff + old_openoff
    if old_office:
        for uninstall in old_office:
            if 'openoffice' in uninstall or Version(uninstall['version']) > Version(versionsoft) or uninstall['version'].startswith('3.'):
                cmd = WAPT.uninstall_cmd(uninstall['key'])
                killalltasks(libre_office_exe)
                print(u'uninstalling %s' % (uninstall['name'],))
                run(cmd,timeout=1200)

    for msi in glob.glob('*.msi'):
        args = {}
        if not 'helppack' in msi:
            # don't register extensions if Office is installed
            if not file_assoc('.doc').startswith('word.'):
                args['SELECT_WORD']=1
            if not file_assoc('.xls').startswith('excel'):
                args['SELECT_EXCEL']=1
            if not file_assoc('.ppt').startswith('powerpoint'):
                args['SELECT_POWERPOINT']=1
            args['CREATEDESKTOPLINK']=0
            args['RebootYesNo']='No'
            args['ALLUSER']=1
            args['ISCHECKFORPRODUCTUPDATES']=0
            args['QUICKSTART']=0
        install_msi_if_needed(msi,properties=args,killbefore=libre_office_exe,timeout=1200)


def update_package():
    htmlSource = wgets("https://www.libreoffice.org/download/download/").splitlines()
    found = False
    for line in htmlSource :
        if 'still' in line:
            found = True
        if found == True:
            if 'http://download.documentfoundation.org/libreoffice/stable/' in line:
                start = line.find("/stable/")
                startversion = start + 8
                end = line.find("/win/")
                realversion = line[startversion:end]
                break


    url = "http://download.documentfoundation.org/libreoffice/stable/%s/win/" % realversion

    #FOR x86

    helpx86 = "LibreOffice_%s_Win_x86_helppack_fr.msi" % realversion
    msix86 = "LibreOffice_%s_Win_x86.msi" % realversion
    if not isfile(msix86):
        wget(url + "x86/" +msix86,msix86)
    else:
        print(msix86 + ' already exist')
    if not isfile(helpx86):
        wget(url + "x86/" +helpx86,helpx86)
    else:
        print(helpx86 + ' already exist')


    """
    # FOR X64 update_package

    helpx64 = "LibreOffice_%s_Win_x64_helppack_fr.msi" % realversion
    msix64 = "LibreOffice_%s_Win_x64.msi" % realversion
    if not isfile(msix64):
        wget(url + "x86_64/" +msix64,msix64)
    else:
        print(msix64 + ' already exist')
    if not isfile(helpx64):
        wget(url + "x86_64/" +helpx64,helpx64)
    else:
        print(helpx64 + ' already exist')
    """

    lastest_version = get_msi_properties(msix86)['ProductVersion']

    allmsi = glob.glob('*.msi')
    for msi in allmsi:
        vers = get_msi_properties(msi)['ProductVersion']
        if vers != lastest_version :
            remove_file(msi)

    # change version of package
    from waptpackage import PackageEntry
    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())
    pe.version = lastest_version +'-0'
    pe.save_control_to_wapt(os.getcwd())


def file_assoc(ext):
    """Renvoie le type d'application associe à une extension (exemple : .doc)"""
    return registry_readstring(HKEY_CLASSES_ROOT,ext,None).lower()



if __name__ == '__main__':
    update_package()

    

manifest

[["LibreOffice_5.3.6_Win_x86_helppack_fr.msi", "89c030548278ed583fbb99d280f931b7c2330e7c"], ["WAPT/icon.png", "0a9ff261834ddd1efd6b386e3253c00469ca9973"], ["WAPT/certificate.crt", "0db563dc9077b268ca07ba834322d0fc5e21f8e5"], ["LibreOffice_5.3.6_Win_x86.msi", "9dfc14631ecb9ea83b014dbb87bd7f94ffbfe179"], ["setup.py", "a01b54e7324f95bec431e6af910396afebe60a98"], ["WAPT/control", "9e7df07b5b19b484fda2d806eadf088c3d57a83e"], ["WAPT/wapt.psproj", "557e60050809687d56525e6ac46df9c0e02ccae6"]]