|
|
|
@ -17,24 +17,26 @@ def install(): |
|
|
|
|
|
|
|
|
|
def update_package(): |
|
|
|
|
import re |
|
|
|
|
print('Updating Git Package') |
|
|
|
|
|
|
|
|
|
latest = json.loads(requests.get('https://api.github.com/repos/git-for-windows/git/releases/latest').text.encode('utf-8')) |
|
|
|
|
version = re.search('v(.*)\.windows\.1', latest['tag_name']).group(1) |
|
|
|
|
latest_version = re.search('v(.*)\.windows\.1', latest['tag_name']).group(1) |
|
|
|
|
pe = PackageEntry(); |
|
|
|
|
control = pe.load_control_from_wapt('.') |
|
|
|
|
print('Last version is %s' % version) |
|
|
|
|
for arch in ['32','64']: |
|
|
|
|
for asset in latest['assets']: |
|
|
|
|
if asset['name'] == 'Git-%s-%s-bit.exe' %(version,arch) and not isfile('Git-%s-%s-bit.exe' % (version,arch)): |
|
|
|
|
url = asset['browser_download_url'] |
|
|
|
|
print('Downloading Git %s for win%s from %s' % (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' %(version,arch): |
|
|
|
|
remove_file(old) |
|
|
|
|
current_version = control['version'].split('-',1)[0] |
|
|
|
|
|
|
|
|
|
if Version(latest_version) > Version(current_version): |
|
|
|
|
print('Updateing 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) |
|
|
|
|
|
|
|
|
|
if Version(version) > Version(control['version'].split('-',1)[0]): |
|
|
|
|
print('Updating control file with new version %s' % version) |
|
|
|
|
pe.version = version + '-0' |
|
|
|
|
print('Updating control file with new version %s' % latest_version) |
|
|
|
|
pe.version = latest_version + '-0' |
|
|
|
|
pe.maturity = 'PREPROD' |
|
|
|
|
pe.save_control_to_wapt('.') |