More work on update system

This commit is contained in:
Adrien Bourmault 2019-07-10 23:05:23 +02:00
parent af92cfb7b0
commit 9dd5ad8d1f
2 changed files with 18 additions and 3 deletions

View File

@ -78,6 +78,6 @@ if updater.UPDATE_IS_MADE:
break
sys.exit(0)
main()
#main()
sys.exit(0)

View File

@ -32,6 +32,7 @@ import shutil
import zipfile
import hashlib
import subprocess
import psutil
import logger # logger.py
import globs # globs.py
@ -204,6 +205,7 @@ def umain():
logfile = logger.logCur
launcherWindow = ihm.launcherWindowCur
# Cleaner for the old version if detected
if len(sys.argv) > 1:
launcherWindow.printmsg('Deleting old version !')
logfile.printdbg("Old install detected : {}".format(sys.argv[1]))
@ -211,8 +213,21 @@ def umain():
try:
shutil.rmtree(str(sys.argv[1]))
except Exception as e:
logfile.printdbg(str(e))
logfile.printerr(str(e))
logfile.printdbg('Trying stop the process !')
launcherWindow.printmsg('Fail :{}'.format(e))
try:
for process in psutil.process_iter():
logfile.printdbg(str(process.cmdline()))
# if process.cmdline() == ['CNIRevelator.exe', '']:
# print('Process found. Terminating it.')
# process.terminate()
# break
else:
logfile.printerr('Process not found')
except Exception as e:
logfile.printerr(str(e))
launcherWindow.printmsg('Fail :{}'.format(e))
try:
try: