Mozilla Thunderbird for WAPT
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

104 lines
4.3 KiB

#!/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/>.
#
# -----------------------------------------------------------------------
from setuphelpers import *
import time
import subprocess
uninstallkey = []
def install():
waptversion = Version(__version__)
if waptversion > Version('1.5') :
softname = 'Mozilla Thunderbird'
versionsoft = control['version'].split('-',1)[0]
check_installed = installed_softwares(softname)
diskfreespacebefore = get_disk_free_space(programfiles)
if check_installed:
for uninstall in check_installed:
if iswin64():
if 'x86' in uninstall['name'] :
print(u'Remove Thunderbird x86 for install Thunderbird x64' )
if uninstall_key_exists(uninstall['key']):
killalltasks('thunderbird.exe')
cmd = WAPT.uninstall_cmd(uninstall['key'])
run(cmd)
time.sleep (5)
version = control.version.split('-',1)[0]
arch = control.architecture
#locale = control.locale
locale = 'fr'
key='Mozilla Thunderbird %s (%s %s)' % (version,'x64' if iswin64() else 'x86',locale)
install_exe_if_needed(r'win%s\Thunderbird Setup %s.exe' % ('64' if iswin64() else '32',version),silentflags='-ms',key=key ,min_version=version,killbefore=['thunderbird.exe'])
print('Copy local settings')
filecopyto("local-settings.cfg",install_location(key))
filecopyto("local-settings.js",makepath(install_location(key),"defaults","pref"))
diskfreespaceafter = get_disk_free_space(programfiles)
difffreespace = diskfreespacebefore - diskfreespaceafter
print(ur"Needed disk space : " + str(difffreespace))
else:
error('This package is not compatible with your WAPT version. Please upgrade to WAPT 1.5 or more.')
def update_package():
"""updates the package / control version with the latest stable thunderbird version"""
import re,requests,urlparse,glob
filename = ''
url = requests.head('https://download.mozilla.org/?product=thunderbird-latest').headers['Location']
exe = urlparse.unquote(url.rsplit('/',1)[1])
version = re.findall(r'Thunderbird Setup (.*)\.exe',exe)[0]
control = PackageEntry().load_control_from_wapt ('.')
for arch in ['32','64']:
filename = makepath('win%s' % arch, exe)
url = 'https://download-installer.cdn.mozilla.net/pub/thunderbird/releases/%s/win%s/fr/Thunderbird%sSetup%s%s.exe' % (version,arch,'%20','%20',version)
if not isfile(filename):
print('Downloading %s from %s'%(filename,url))
wget(url,filename)
# removes old exe
if isfile(filename):
exes = glob.glob(r'win%s\Thunderbird*.exe' % arch)
for fn in exes:
if fn != filename:
remove_file(fn)
if Version(version) > Version(control['version'].split('-',1)[0]):
print('Updating package to %s' % version)
# updates control version from filename, increment package version.
control.version = '%s-%s'%(re.findall(r'Thunderbird Setup (.*)\.exe',filename)[0],0)
control.save_control_to_wapt('.')
else:
print('No update available')
if __name__ == '__main__':
update_package()