tis-libreoffice 5.3.0.3-1

  • package : tis-libreoffice
  • version : 5.3.0.3-1
  • description : Suite Bureautique LibreOffice + Aide. Désinstalle libreooffice 3.xx et OpenOffice 3.xx
  • maintainer : TIS
  • date : 2017-07-20 11:21:12
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20170720-112110
  • min_os_version :
  • min_wapt_version :

setup.py

#!/usr/bin/python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
#    This file is part of WAPT
#    Copyright (C) 2013  Tranquil IT Systems http://www.tranquil.it
#    WAPT aims to help Windows systems administrators to deploy
#    setup and update applications on users PC.
#
#    WAPT is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    WAPT is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with WAPT.  If not, see <http://www.gnu.org/licenses/>.
#
# -----------------------------------------------------------------------
import platform
from setuphelpers import *

uninstallkey = []

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

def find_msis():
    """Returns msi filename and properties"""
    allmsi = glob.glob('*.msi')

    result = []
    for msi in allmsi:
        # uninstallkey is in msi db
        props = get_msi_properties(msi)
        result.append((msi,props))
    return result


def update_control(entry):
    """Magic Callback to update control version data at build step"""
    (version,packaging) = entry.version.split('-',1)
    msis = find_msis()
    # use first msi's version for the package version
    for (msi,props) in msis:
        if not 'helppack' in msi:
            entry.version = "%s-%s"%(props['ProductVersion'],packaging)
            break

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

    msis = find_msis()
    for (msi,props) in msis:
        # uninstallkey is in msi db
        msikey = props['ProductCode']
        print('Adding uninstall key : %s'%msikey)
        uninstallkey.append(msikey)

        # check if product is already installed
        if WAPT.options.force or not installed_softwares(msikey):
            killalltasks('soffice.bin')
            print("Installing %s..."%(props['ProductName']))
            args = ["msiexec /norestart /quiet /i %s"%msi]
            if not 'helppack' in msi:
                # don't register extensions if Office is installed
                if not file_assoc('.doc').startswith('word.'):
                    args.append('SELECT_WORD=1')
                if not file_assoc('.xls').startswith('excel'):
                    args.append('SELECT_EXCEL=1')
                if not file_assoc('.ppt').startswith('powerpoint'):
                    args.append('SELECT_POWERPOINT=1')

                args.append('CREATEDESKTOPLINK=0')
                args.append('RebootYesNo=No')
                args.append('ALLUSER=1')
                args.append('ISCHECKFORPRODUCTUPDATES=0')
                args.append('QUICKSTART=0')
            cmd = ' '.join(args)
            run(cmd,timeout=1200,accept_returncodes=[0,1601,3010])
            print("Done install %s..."%(props['ProductName']))
        else:
            print("%s already installed, skipping..."%props['ProductName'])

def update_package():
    """updates the package with the latest stable libreoffice version"""
    import re
    # get list of stable versions
    re_versions = re.compile('<td><a href="([\d\.]*)/">')
    index = wgets('http://download.documentfoundation.org/libreoffice/stable/')
    # find latest
    last_version = sorted(re_versions.findall(index))[-1]
    for fn in (
        'LibreOffice_{version}_Win_x86.msi'.format(version=last_version),
        'LibreOffice_{version}_Win_x86_helppack_fr.msi'.format(version=last_version)):
        if not isfile(fn):
            print('Downloading %s'%fn)
            wget('http://download.documentfoundation.org/libreoffice/stable/{version}/win/x86/{fn}'.format(version=last_version,fn=fn),fn)

    # removes old msi
    if last_version:
        msis = glob.glob('*.msi')
        for fn in msis:
            if not last_version in fn:
                remove_file(fn)

if __name__ == '__main__':
    update_package()


    

manifest

[["WAPT/icon.png", "0a9ff261834ddd1efd6b386e3253c00469ca9973"], ["WAPT/certificate.crt", "0db563dc9077b268ca07ba834322d0fc5e21f8e5"], ["WAPT/wapt.psproj", "64055e22f0cba993956a0f847afb4a7660d79c13"], ["LibreOffice_5.3.0_Win_x86.msi", "b81bc9e4a91a013e46cd0ffe319635b85eb339d4"], ["setup.py", "a55786b6c2679b78f8156d1a6702f6577c63b93d"], ["WAPT/control", "31ac98d05a7897c9be904baca137561a1463639b"], ["LibreOffice_5.3.0_Win_x86_helppack_fr.msi", "dad3cc98d015d7e2b3ee36c8a595f78b8d1d8e1c"]]