From 6fea3af40dce35bd6fd8dcf9dfc781c559feee99 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 14 Dec 2018 12:10:41 +0100 Subject: [PATCH] Support update_package --- WAPT/control | 2 +- setup.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/WAPT/control b/WAPT/control index 338526b..a3aaeab 100644 --- a/WAPT/control +++ b/WAPT/control @@ -1,5 +1,5 @@ package : fws-apple-mobile-device-support -version : 12.1.0.25-2 +version : 12.1.0.25-4 architecture : all section : base priority : optional diff --git a/setup.py b/setup.py index c06c019..79b2175 100644 --- a/setup.py +++ b/setup.py @@ -6,3 +6,27 @@ uninstallkey = [] def install(): print('Installing Apple Mobile Device Support') install_msi_if_needed('AppleMobileDeviceSupport64.msi' if iswin64() else 'AppleMobileDeviceSupport.msi') + +def update_package(): + print('Updating Apple Mobile Device 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','AppleMobileDeviceSupport64.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 Apple Mobile Device Support version %s' % version) + os.rename(makepath('temp','32','AppleMobileDeviceSupport.msi'),'AppleMobileDeviceSupport.msi') + os.rename(makepath('temp','64','AppleMobileDeviceSupport64.msi'),'AppleMobileDeviceSupport64.msi') + pe.version = version + '-0' + pe.save_control_to_wapt('.') + print('Removing temp files') + remove_tree('temp') \ No newline at end of file