0

I'm developing a software and I want, for several reasons, to develop my own auto-update feature. The program is a full GUI, written with PyQt, and uses icons, data files, etc. It will be frozen with cx_freeze or pyinstaller.

The auto-update part will download the new version (a zip) on a remote server. Then, it gets complicated:

The software is running, and has downloaded the new version. What does it do with the new version ? Can the software extract the files from the zip, and overwrite the files of the running version ?

Or should I store the new version aside, quit the running version, and somehow use the new version ? If so, how do I do the exchange between the old and new version ?

EDIT:

Here is for example the closeEvent method of my class QMainWindow:

def closeEvent(self, event):

    """Method to perform actions before exiting.
    Allows to save the prefs in a file"""

    ...Do some stuff...

    QtGui.qApp.quit()

    self.logger.info("Closing the program")

Can I use this method to perform the exchange ?

JPFrancoia
  • 4,866
  • 10
  • 43
  • 73
  • Open a thread without `deamon` remove old files, later extract new. But need compare every configuration files for missing/invalid parameters. Of course kill all related applications before starting new ! – dsgdfg Aug 27 '16 at 19:12
  • I edited my question to be more accurate, if it helps. Could you show me how and where I should open the thread ? – JPFrancoia Aug 27 '16 at 19:19

1 Answers1

0

This is a similar question to yours and the accepted answer says:

After downloading the installer for the newer version, you can use atexit.register() with os.exec*() to run the installer, e.g. atexit.register(os.execl, "installer.exe", "installer.exe"). This will make the installer start when the application is about to exit. The application will immediately exit after the os.exec*() call, so no race condition will occur.

Looks like a good solution for your use-case

Community
  • 1
  • 1
BPL
  • 9,632
  • 9
  • 59
  • 117