[Tutor] Fw: Automatic updates for a program?

ALAN GAULD alan.gauld at btinternet.com
Sat May 14 01:54:43 CEST 2011


Forwarding to list for wider feedback.

 Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/




----- Forwarded Message ----
From: Lan Rogers <lan.rogers.book at gmail.com>
To: Alan Gauld <alan.gauld at btinternet.com>
Sent: Friday, 13 May, 2011 22:46:41
Subject: Re: [Tutor] Automatic updates for a program?

On Fri, May 13, 2011 at 12:38 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>> So I have a program I want to release, but it's still in early stages
>> without some of its planned functionality. I want to distribute
>> automatic updates.
>
> Don't assume this will be easy, and be prepared for it to
> cramp your style when it comes to designing and
> developing the app. It will place major restrictions on
> what you can do. Only do it if its essential.

I assume there will be some challenges involved, it's not absolutely
critical, but it's something I'd like to understand even if I don't
incorporate it into my current project.

>> I'm working under the assumption that the easiest
>> way to do this is to just replace the old files with the new ones.
>
> A lot depends on which OS you are using.
> If its Windows thre are a bunch of other things
> you will probably need to do too, like update
> registry entries and mess about with COM IDs etc.
>
>> questions is this: How do I replace a script that is running, with a
>> new version?
>
> Again it depends on the OS. It may not be possible,
> you may have to force a restart. Thats by far the easiest way.
> On Windows its common to do it on the next reboot
> by setting up a RunOnce job in the registry. (But that
> only works well because Windows tends to need
> rebooting a lot!)
>
> You might also want to consider whwether you need a
> backout strategy to revert to a previous working version.
> That will complicate things even more.
>
> OTOH If your program architecture is very simple,
> just a few scripts in a single folder and not using
> the OS features or a database or networking then
> many of these complexities can be avoided. (But
> replacing a running process is still tricky. You
> need to build the functionality into the existing
> code to replace itself - typically using spawn()
> or exec() or fork() assuming Linux/MacOS - and
> then triggger that functionality from your installer)

I'm working on windows, and I distribute a single executable file,
made with py2exe. I'm not sure if that simplifies things or
complicates them. I'm thinking of  writing batch script that will
handle deleting and and replacing the old version of my application
(via restart and RunOnce job, like you mentioned), then deleting that
script on the first execution of the new version of my application.
Does that sound reasonable or am I kidding myself?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110514/026c3875/attachment.html>


More information about the Tutor mailing list