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.
44 lines
1.9 KiB
44 lines
1.9 KiB
# -*- coding: utf-8 -*-
|
|
from setuphelpers import *
|
|
import requests,json
|
|
|
|
uninstallkey = []
|
|
|
|
def install():
|
|
print('Installing Git for Windows')
|
|
version = control['version'].split('-',1)[0]
|
|
arch = '64' if iswin64() else '32'
|
|
install_exe_if_needed(
|
|
'Git-%s-%s-bit.exe' % (version,arch),
|
|
silentflags='/LOADINF="git.inf" /VERYSILENT /CLOSEAPPLICATIONS /NORESTART',
|
|
min_version=version,
|
|
key='Git_is1'
|
|
)
|
|
|
|
def update_package():
|
|
import re
|
|
|
|
latest = json.loads(requests.get('https://api.github.com/repos/git-for-windows/git/releases/latest').text.encode('utf-8'))
|
|
latest_version = re.search('v(.*)\.windows\.(\d+)', latest['tag_name']).group(1)
|
|
latest_release = re.search('v(.*)\.windows\.(\d+)', latest['tag_name']).group(2)
|
|
latest_version = '%s.%s' % (latest_version, latest_release)
|
|
pe = PackageEntry();
|
|
control = pe.load_control_from_wapt('.')
|
|
current_version = control['version'].split('-',1)[0]
|
|
|
|
if Version(latest_version) > Version(current_version):
|
|
print('Updating package from %s to %s' % (current_version, latest_version))
|
|
for arch in ['32','64']:
|
|
for asset in latest['assets']:
|
|
if asset['name'] == 'Git-%s-%s-bit.exe' % (latest_version, arch) and not isfile('Git-%s-%s-bit.exe' % (latest_version, arch)):
|
|
url = asset['browser_download_url']
|
|
print('Downloading Git %s for win%s from %s' % (latest_version, arch, url))
|
|
wget(url,asset['name'])
|
|
for old in glob.glob(r'Git-*-%s-bit.exe' % arch):
|
|
if not old == 'Git-%s-%s-bit.exe' % (latest_version, arch):
|
|
remove_file(old)
|
|
|
|
print('Updating control file with new version %s' % latest_version)
|
|
pe.version = latest_version + '-0'
|
|
pe.maturity = 'PREPROD'
|
|
pe.save_control_to_wapt('.') |