Bonjour,
Je me suis inscrit chez ADOBE afin d'avoir les paquets MSI d'installation de flash et adobe reader (ceux qui évitent de télécharger la suite via internet, version offline).
J'ai créé un répertoire c:\dracwapt\flash dans lequel j'ai mis les deux msi de flash (active_x.msi et le plugin.msi)
Je fais la commande : wapt-get make-template c:\dracwapt\flash qui me répond : FATAL ERROR : local variables 'props' referenced before assignment
Que faire ?
Le 25/06/2013 11:42, LECLERCQ Johann a écrit :
Bonjour,
Je me suis inscrit chez ADOBE afin d'avoir les paquets MSI d'installation de flash et adobe reader (ceux qui évitent de télécharger la suite via internet, version offline).
J'ai créé un répertoire c:\dracwapt\flash dans lequel j'ai mis les deux msi de flash (active_x.msi et le plugin.msi)
Je fais la commande : wapt-get make-template c:\dracwapt\flash qui me répond : FATAL ERROR : local variables 'props' referenced before assignment
make-template s'applique à un installeur. donc l'argument doit être l'un des 2 msi exemple : wapt-get make-template c:\dracwapt\flash\install_flash_player_11_plugin.msi drac-flash
le msi désigné sera copié dans le répertoire de développement du paquet. et il faudra ensuite rajouter le deuxième msi dans le répertoire créé, et coder la logique de choix entre les deux msi dans le setup.py. voir l'exemple tis en téléchargeant : http://wapt.tranquil.it/wapt/tis-flash_11.7.700.203_x86.wapt
(je vais rajouter un check pour que le message soir plus explicite...)
Hubert
Que faire ?
Bonjour,
Merci Hubert ! Question : Etant donné que je pars d'un parc assez hétérogène. Comment aborderais-tu la désinstallation de toutes versions (plugin et autre active-x) de flash présents sur les postes ? Merci par avance.
Le 25/06/2013 12:00, LECLERCQ Johann a écrit :
Bonjour,
Merci Hubert ! Question : Etant donné que je pars d'un parc assez hétérogène. Comment aborderais-tu la désinstallation de toutes versions (plugin et autre active-x) de flash présents sur les postes ?
Tu peux tester l'existence d'un logiciel installé par la présence de la clé de désinstallation dans la base de registre. dans la fonction install() de setup.py, avant d'installer le/les plugin flash, désinstaller tous ceux qui ne sont pas conformes.
D'abord il faut stopper les navigateurs en utilisation (killalltasks)
killalltasks('firefox') killalltasks('iexplore') killalltasks('chrome')
Ensuite récupérer la liste des flash players (on prend des :
flashs = installed_softwares('flash player')
pour chacun, vérifier la version et désinstaller si nécessaire.
for flash in flashs: if flash['version'] <> '11.7.700.202': print 'Desinstallation de %(name)s (%(version)s)' % flash run_notfatal(WAPT.uninstall_cmd(flash['key']))
ensuite lancer l'installation des players manquants (on utilise ici la clé de désinstallation pour localiser le logiciel, car c'est un identifiant unique)
if not installed_software('{4036771A-B714-4CA1-8931-782B24EE672C}'): run('install_flash_player_11_plugin.msi')
etc...
Hubert
Merci par avance.
Bonjour,
Quelle est la Différence entre :
run_notfatal('taskkill /im firefox.exe /f') et killalltasks('firefox')
Quelle est la différence entre :
run_notfatal(WAPT.uninstall_cmd(flash['key']))
et cmd = WAPT.uninstall_cmd(uninstall['key']) run(cmd)
Y aurait-il eu des ajouts de nouvelles fonctions ? MERCI.
Le 25/06/2013 14:21, LECLERCQ Johann a écrit :
Bonjour,
Quelle est la Différence entre :
run_notfatal('taskkill /im firefox.exe /f')
et killalltasks('firefox')
killalltasks est une fonction de setuphelpers qui fait la même chose qu'appeller la commande windows taskkill Il est préférable d'utiliser killalltasks car cela ne relance pas un sous-process. Mais les deux approches fonctionnent.
Quelle est la différence entre :
run_notfatal(WAPT.uninstall_cmd(flash['key']))
et cmd = WAPT.uninstall_cmd(uninstall['key']) run(cmd)
les fonctions "run" et "run_notfatal" lancent toutes les deux des sous-processus (installation de msi, de setup.exe ou autres programmes exécutables) La différence se situe dans le comportement si le code de retour du sous-processus est différent de 0 (zéro). Un processus, quand il se termine, renvoie un code numérique (code d'erreur). Un code zéro veut dire tout s'est bien passé. Un code différent de zéro est en général une erreur. (en particulier, l'installation d'un MSI qui échoue renvoie souvent un code 1603... qui ne donne pas beaucoup d'information sur le problème ) Dans le cas de "run", si un code différent de zéro est renvoyé, wapt-get s'arrête avec une erreur (on dit qu'une Exception est levée) Dans le cas de "run_notfatal", on considère que ce n'est pas une erreur fatale si le sous-processus ne renvoie pas zéro... (c'est à dire, qu'il vaut mieux quand même essayer de continuer l'installation ou le processus). Seul un warning est loggé.
Dans le cas ci-dessus, taskkill renvoie un code de retour différent de zéro s'il n'a killé aucun processus. Dinc run_notfatal était utilisé pour ne pas s'arrêter sur ce cas... En fait, il aurait été préférable de traiter chaque cas.
Le code de retour en cas de processus introuvable (ce qui n'est pas une erreur dans notre cas) est 128 C:\tranquilit\wapt>taskkill /im firefox.exe Erreur : le processus "firefox.exe" est introuvable. C:\tranquilit\wapt>echo %ERRORLEVEL% 128
En python : run('taskkill /im firefox.exe /f') Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:\tranquilit\wapt\setuphelpers.py", line 435, in run raise subprocess.CalledProcessError(proc.returncode,cmd,''.join(output)) CalledProcessError: Command '('taskkill /im firefox.exe /f',)' returned non-zero exit status 128
Donc le traitement correct aurait été :
from setuphelpers import * import subprocess
try: run('taskkill /im firefox.exe /f') except subprocess.CalledProcessError,e: if e.returncode <> 128: raise
Y aurait-il eu des ajouts de nouvelles fonctions ? MERCI.