Si ça peut servir, voici le code du paquet que j'utilise pour le logiciel Postman :
Pour Windows :
Code : Tout sélectionner
# -*- coding: utf-8 -*-
from setuphelpers import *
import time
uninstallkey = []
setup_path = r'C:\ProgramData\postman-installer'
bin_name = r'Postman-win64-Setup.exe'
def install():
mkdirs(setup_path)
filecopyto(bin_name, makepath(setup_path, bin_name))
def uninstall():
for user_path in local_users_profiles():
# Uninstall silently
if isfile(makepath(user_path, r'\AppData\Local\Postman', r'Update.exe')):
run_notfatal(r'"%s" --uninstall -s' % makepath(user_path, r'\AppData\Local\Postman', r'Update.exe'))
time.sleep(2)
# Remove local appdata dir
if isdir(makepath(user_path, r'\AppData\Local\Postman')):
remove_tree(makepath(user_path, r'\AppData\Local\Postman'))
remove_tree(setup_path)
def session_setup():
run(r'"%s" -s' % makepath(setup_path, bin_name))
time.sleep(5)
for i in range(30):
if not isfile(makepath(user_local_appdata, r'\Postman\Update.exe')):
time.sleep(5)
else:
break
def update_package():
url = r'https://dl.pstmn.io/download/latest/win64'
wget(url, bin_name)
version_from_file = get_version_from_binary(bin_name)
version_from_package = control.version.split('-')[0]
if Version(version_from_file) > Version(version_from_package):
print(r'Latest Postman version is %s' % version_from_file)
# Changing version of the package
control.version = '%s-%s' % (version_from_file, control.version.split('-', 1)[-1])
control.save_control_to_wapt()
print('Changing version to: %s in WAPT\\control' % control.version)
else:
print(r'Already up to date !')
Code : Tout sélectionner
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
zip_name = r'Postman-MacOS-arm64.zip'
app_name = r'Postman.app'
def install():
run(r'unzip -qq %s %s/*' % (zip_name, app_name))
install_app(app_name)
def uninstall():
uninstall_app(app_name)
def update_package():
import plistlib
if isdir(app_name):
remove_tree(app_name)
url = r'https://dl.pstmn.io/download/latest/osx_arm64'
wget(url, zip_name)
unzip(zip_name, target=r'', filenames=r'%s/*' % app_name)
version_from_package = control.version.split('-')[0]
plist_file = plistlib.readPlist(r'%s/Contents/Info.plist' % app_name)
version_from_plist = plist_file[r'CFBundleShortVersionString']
remove_tree(app_name)
if Version(version_from_plist) > Version(version_from_package):
print(r'Latest Postman version is %s' % version_from_plist)
# Changing version of the package
control.version = '%s-%s' % (version_from_plist, control.version.split('-', 1)[-1])
control.save_control_to_wapt()
print('Changing version to: %s in WAPT\\control' % control.version)
else:
print(r'Already up to date !')