|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from setuphelpers import *
|
|
|
|
import requests,re
|
|
|
|
|
|
|
|
uninstallkey = []
|
|
|
|
|
|
|
|
def install():
|
|
|
|
print('Installing Tortoise Git')
|
|
|
|
version = control['version'].split('-',1)[0]
|
|
|
|
arch = '64' if iswin64() else '32'
|
|
|
|
install_msi_if_needed('TortoiseGit-%s-%sbit.msi' % (version, arch))
|
|
|
|
|
|
|
|
def update_package():
|
|
|
|
print('Updating Tortoise Git Package')
|
|
|
|
download = requests.get('https://tortoisegit.org/download/').text
|
|
|
|
try:
|
|
|
|
version = re.search('The current stable version is: (\d+\.\d+\.\d+)', download).group(1)
|
|
|
|
except:
|
|
|
|
error('Version not found')
|
|
|
|
|
|
|
|
print('Latest version is %s' % version)
|
|
|
|
pe = PackageEntry();
|
|
|
|
control = pe.load_control_from_wapt('.')
|
|
|
|
for arch in ['32','64']:
|
|
|
|
filename = 'TortoiseGit-%s.0-%sbit.msi' % (version, arch)
|
|
|
|
url = 'https://download.tortoisegit.org/tgit/%s.0/%s' % (version, filename)
|
|
|
|
if not isfile('TortoiseGit-%s.0-%sbit.msi' % (version, arch)):
|
|
|
|
print('Downloading Tortoise Git %s for win%s from %s' % (version, arch, url))
|
|
|
|
wget(url, filename)
|
|
|
|
if isfile(filename):
|
|
|
|
for old in glob.glob(r'TortoiseGit-*%sbit.msi' % arch):
|
|
|
|
if old != filename:
|
|
|
|
remove_file(old)
|
|
|
|
|
|
|
|
if Version(version) > Version(control['version'].split('-',1)[0]):
|
|
|
|
print('Updating control file with new version %s' % version)
|
|
|
|
pe.version = version + '-0'
|
|
|
|
pe.save_control_to_wapt('.')
|