58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
from setuphelpers import *
|
|
|
|
uninstallkey = []
|
|
|
|
def install():
|
|
|
|
print('Installing Zulip Desktop')
|
|
version = control['version'].split('-',1)[0]
|
|
|
|
props = {
|
|
'MSIINSTALLPERUSER': '0'
|
|
}
|
|
|
|
if iswin64():
|
|
msi = 'Zulip-%s-x64.msi' % version
|
|
else:
|
|
msi = 'Zulip-%s-ia32.msi' % version
|
|
|
|
install_msi_if_needed(msi, min_version=version, properties=props)
|
|
|
|
|
|
def update_package():
|
|
print('Updating Zulip Desktop package')
|
|
import requests,json
|
|
from waptpackage import PackageEntry
|
|
|
|
latest = json.loads(requests.get('https://api.github.com/repos/zulip/zulip-desktop/releases/latest').text.encode('utf-8'))
|
|
version = latest['tag_name'][1:]
|
|
print('Found latest version %s' % version)
|
|
pe = PackageEntry();
|
|
control = pe.load_control_from_wapt('.')
|
|
bin_found = []
|
|
|
|
for arch in ['x64','ia32']:
|
|
for asset in latest['assets']:
|
|
|
|
if asset['name'] == 'Zulip-%s-%s.msi' % (version, arch) and not isfile('Zulip-%s-%s.msi' % (version, arch)):
|
|
url = asset['browser_download_url']
|
|
print('Downloading Zulip Desktop %s for %s from %s' % (version, arch ,url))
|
|
wget(url,'Zulip-%s-%s.msi' % (version, arch))
|
|
bin_found.append(arch)
|
|
|
|
for file in glob.glob('Zulip-*-%s.msi' % arch):
|
|
if file != 'Zulip-%s-%s.msi' % (version, arch):
|
|
print('Removing %s' % file)
|
|
remove_file(file)
|
|
|
|
if Version(version) > Version(control['version'].split('-',1)[0]) and 'x64' in bin_found and 'ia32' in bin_found:
|
|
print('Updating control file with new version %s' % version)
|
|
pe.version = version + '-0'
|
|
pe.maturity = 'PREPROD'
|
|
pe.save_control_to_wapt('.')
|
|
|
|
if __name__ == '__main__':
|
|
update_package()
|
|
|