Support update_package
This commit is contained in:
parent
5e78f8cba3
commit
f9e4efac97
|
@ -1,5 +1,5 @@
|
|||
package : fws-itunes
|
||||
version : 12.9.2.6-5
|
||||
version : 12.9.2.6-6
|
||||
architecture : all
|
||||
section : base
|
||||
priority : optional
|
||||
|
|
25
setup.py
25
setup.py
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from setuphelpers import *
|
||||
import os
|
||||
|
||||
uninstallkey = []
|
||||
|
||||
|
@ -25,6 +26,30 @@ def uninstall():
|
|||
if soft['name'] == 'iTunes':
|
||||
run(r'msiexec /qn /norestart /x%s' % soft['key'])
|
||||
|
||||
def update_package():
|
||||
print('Updating iTunes 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','iTunes64.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)
|
||||
os.rename(makepath('temp','32','iTunes.msi'),'iTunes.msi')
|
||||
os.rename(makepath('temp','64','iTunes64.msi'),'iTunes64.msi')
|
||||
pe.version = version + '-0'
|
||||
pe.save_control_to_wapt('.')
|
||||
print('Removing temp files')
|
||||
remove_tree('temp')
|
||||
|
||||
def audit():
|
||||
is_installed = False
|
||||
for soft in installed_softwares('iTunes'):
|
||||
|
|
Loading…
Reference in New Issue