wapt-apple-application-support/setup.py

37 lines
1.6 KiB
Python
Raw Normal View History

2018-12-05 22:54:39 +01:00
# -*- coding: utf-8 -*-
from setuphelpers import *
2018-12-14 12:06:49 +01:00
import os
2018-12-05 22:54:39 +01:00
uninstallkey = []
def install():
print('Installing Apple Application Support')
2018-12-06 11:42:15 +01:00
install_msi_if_needed('AppleApplicationSupport64.msi' if iswin64() else 'AppleApplicationSupport.msi')
2018-12-14 12:06:49 +01:00
def update_package():
print('Updating Apple Application Support package')
for arch in ['32','64']:
url = 'https://www.apple.com/itunes/download/win%s' % arch
mkdirs(makepath('temp',arch))
filename = makepath('temp', 'itunes%s' % arch)
if not isfile(filename):
print('Downloading %s' % url)
wget(url,filename)
print('Extracting %s' % filename)
run('"%s" e -y -o"%s" %s' % (makepath(programfiles,'7-Zip','7z.exe'),makepath('temp',arch),filename))
version = get_msi_properties(makepath('temp','64','AppleApplicationSupport64.msi'))['ProductVersion']
print('Downloaded version is %s' % version)
pe = PackageEntry();
control = pe.load_control_from_wapt('.')
if Version(version) > Version(control['version'].split('-',1)[0]):
print('New iTunes version %s' % version)
2019-02-15 15:55:39 +01:00
for file in ['AppleApplicationSupport.msi', 'AppleApplicationSupport64.msi' ]:
if isfile(file):
remove_file(file)
2018-12-14 12:06:49 +01:00
os.rename(makepath('temp','32','AppleApplicationSupport.msi'),'AppleApplicationSupport.msi')
os.rename(makepath('temp','64','AppleApplicationSupport64.msi'),'AppleApplicationSupport64.msi')
pe.version = version + '-0'
2019-07-02 10:29:01 +02:00
pe.maturity = 'PREPROD'
2018-12-14 12:06:49 +01:00
pe.save_control_to_wapt('.')
print('Removing temp files')
remove_tree('temp')