I really don't want to reinvent the wheel if I don't have to. Whats the best way to implement some type of software versioning / updating routine. There will be many ESP8266 in the field and I need them to periodically check for a new version of my .py files and update accordingly.
I've seen references to upip, is that the best way?
Thanks in advance.
Self Updating Mechanism
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Self Updating Mechanism
If your application is sufficiently small not to need frozen bytecode then I'd consider using upip. I don't know if anyone has run it programmatically but there's no obvious reason why you shouldn't. It lacks an update mechanism (it only has install) but I'm sure you could invent a way of checking for a new version on PyPi.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Self Updating Mechanism
Hi;
I have done this using a nodejs webserver to host the update files, using express server-side it is pretty trivial:
Client side I wrote a wget() function to download required files.
I have done this using a nodejs webserver to host the update files, using express server-side it is pretty trivial:
Code: Select all
var express = require('express');
var app = express();
var home = '/nfs/qnap/data/uPython/updates';
app.get('/*', function (req, res) {
if((/robots|sitemap|favicon/).test(req.url)) return res.end();
var path = home+req.url;
console.log('path:',path);
try {
res.download(path);
} catch(e){
res.end()
}
});
app.listen(process.env.PORT, function () {
console.log('Listening on port: '+process.env.PORT);
});